diff options
| author | Stephen Blott | 2017-09-18 12:23:15 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2017-09-18 12:26:56 +0100 | 
| commit | fbd9d54b68446f30441149ffa4a77045b259438b (patch) | |
| tree | 3b72eef1c51ce7934d679fb2be362d7ccb3014e7 | |
| parent | 2def9eac46d2bb61eafa016dff4d7019949743a2 (diff) | |
| download | vimium-fbd9d54b68446f30441149ffa4a77045b259438b.tar.bz2 | |
Recognise (FF) internal URLs.
Recognise URLs like:
   - moz-extension://c66906b4-3785-4a60-97bc-094a6366017e/pages/options.html
Fixes #2657.
| -rw-r--r-- | lib/utils.coffee | 2 | ||||
| -rw-r--r-- | tests/unit_tests/utils_test.coffee | 3 | 
2 files changed, 4 insertions, 1 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index 93cc3246..03dab999 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -56,7 +56,7 @@ Utils =      url.startsWith "javascript:"    hasFullUrlPrefix: do -> -    urlPrefix = new RegExp "^[a-z]{3,}://." +    urlPrefix = new RegExp "^[a-z][-+.a-z0-9]{2,}://."      (url) -> urlPrefix.test url    # Decode valid escape sequences in a URI.  This is intended to mimic the best-effort decoding diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee index 04cf34b6..cc1081dd 100644 --- a/tests/unit_tests/utils_test.coffee +++ b/tests/unit_tests/utils_test.coffee @@ -22,6 +22,9 @@ context "isUrl",      assert.isTrue Utils.isUrl "illinois.state.museum"      assert.isTrue Utils.isUrl "eqt5g4fuenphqinx.onion" +    # Internal URLs. +    assert.isTrue Utils.isUrl "moz-extension://c66906b4-3785-4a60-97bc-094a6366017e/pages/options.html" +    should "reject invalid URLs", ->      assert.isFalse Utils.isUrl "a.x"      assert.isFalse Utils.isUrl "www-domain-tld" | 
