diff options
| author | Stephen Blott | 2017-09-18 15:07:03 +0100 |
|---|---|---|
| committer | GitHub | 2017-09-18 15:07:03 +0100 |
| commit | 4099067f7c03551bea20b6cf6504e4c15d6e7506 (patch) | |
| tree | 3b72eef1c51ce7934d679fb2be362d7ccb3014e7 | |
| parent | 2def9eac46d2bb61eafa016dff4d7019949743a2 (diff) | |
| parent | fbd9d54b68446f30441149ffa4a77045b259438b (diff) | |
| download | vimium-4099067f7c03551bea20b6cf6504e4c15d6e7506.tar.bz2 | |
Merge pull request #2658 from smblott-github/recognise-moz-extension-URL
Recognise (FF) internal URLs.
| -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" |
