diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.coffee | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee index 64c87842..fba03b61 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -26,12 +26,15 @@ Utils = -> id += 1 hasChromePrefix: do -> - chromePrefixes = [ "about:", "view-source:", "extension:", "chrome-extension:", "data:", "javascript:" ] + chromePrefixes = [ "about:", "view-source:", "extension:", "chrome-extension:", "data:" ] (url) -> for prefix in chromePrefixes return true if url.startsWith prefix false + hasJavascriptPrefix: (url) -> + url.startsWith "javascript:" + hasFullUrlPrefix: do -> urlPrefix = new RegExp "^[a-z]{3,}://." (url) -> urlPrefix.test url @@ -107,6 +110,11 @@ Utils = # Special-case about:[url], view-source:[url] and the like if Utils.hasChromePrefix string string + else if Utils.hasJavascriptPrefix string + # We blindly URL decode javascript: URLs. That's what Chrome does when they're clicked, or entered into + # the omnibox. However, Chrome does not URL decode such URLs in chrome.tabs.update. + # This is arguably a Chrome bug. See https://code.google.com/p/chromium/issues/detail?id=483000. + decodeURI string else if Utils.isUrl string Utils.createFullUrl string else |
