diff options
| author | Stephen Blott | 2015-09-11 16:54:09 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-09-11 16:54:09 +0100 |
| commit | f68a558d0a027bcb38b863619eeec94f9034be3b (patch) | |
| tree | 2bfc248fc6b5bf0c4e45e559de1a5afbb93e5983 | |
| parent | 4e5b82e3783bebe640ce98df4bd432da7640c69d (diff) | |
| parent | fe24f3c89fca9ac7a0f31eb175e3905946727e63 (diff) | |
| download | vimium-f68a558d0a027bcb38b863619eeec94f9034be3b.tar.bz2 | |
Merge pull request #1813 from mrmr1993/stop-decoding-js-uris-after-fix
Don't decode javascript URIs on Chrome 46.0.2467.2 and later
| -rw-r--r-- | lib/utils.coffee | 5 | ||||
| -rw-r--r-- | tests/unit_tests/test_chrome_stubs.coffee | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee index 90469fad..54cb38d2 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -144,7 +144,8 @@ Utils = if Utils.hasChromePrefix string string else if Utils.hasJavascriptPrefix string - Utils.decodeURIByParts string + # In Chrome versions older than 46.0.2467.2, encoded javascript URIs weren't handled correctly by. + if Utils.haveChromeVersion "46.0.2467.2" then string else Utils.decodeURIByParts string else if Utils.isUrl string Utils.createFullUrl string else @@ -176,7 +177,7 @@ Utils = # True if the current Chrome version is at least the required version. haveChromeVersion: (required) -> - chromeVersion = navigator.appVersion.match(/Chrome\/(.*?) /)?[1] + chromeVersion = navigator.appVersion.match(/Chrom(e|ium)\/(.*?) /)?[2] chromeVersion and 0 <= Utils.compareVersions chromeVersion, required # Zip two (or more) arrays: diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee index 0bb6ed81..8814ab23 100644 --- a/tests/unit_tests/test_chrome_stubs.coffee +++ b/tests/unit_tests/test_chrome_stubs.coffee @@ -8,6 +8,9 @@ exports.window = {} exports.localStorage = {} +global.navigator = + appVersion: "5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36" + global.document = createElement: -> {} addEventListener: -> |
