diff options
| author | Stephen Blott | 2015-05-01 06:51:53 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-01 06:51:53 +0100 |
| commit | 7dcee922623d9865d9b896a9d9531023bf544dc3 (patch) | |
| tree | d09f2ce16f529bab104a0b0f5721962e2c84043c | |
| parent | caa748f89bf90d5791b734d4bc1576a7a44c2011 (diff) | |
| parent | e3fbdd860d1e5085964de62c33ca9cea13964251 (diff) | |
| download | vimium-7dcee922623d9865d9b896a9d9531023bf544dc3.tar.bz2 | |
Merge pull request #1621 from smblott-github/url-decode-bookmarklets
URL decode bookmarklets, if necessary.
| -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 |
