diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-03-29 05:50:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 05:50:55 +0800 |
commit | a3e08d779ecc81ebddf8609130eae5e6db08ad48 (patch) | |
tree | 1692e346c343b3b2f9823ff0626d11e961cf5484 /app/scripts/contentscript.js | |
parent | 67892c49a6cb26e433e3dbeaa9f2f7790667f103 (diff) | |
parent | d1733c1f7521d17b0e8acdae5a2be33c1a9bbd5c (diff) | |
download | tangerine-wallet-browser-a3e08d779ecc81ebddf8609130eae5e6db08ad48.tar.gz tangerine-wallet-browser-a3e08d779ecc81ebddf8609130eae5e6db08ad48.tar.zst tangerine-wallet-browser-a3e08d779ecc81ebddf8609130eae5e6db08ad48.zip |
Merge branch 'master' into kovan-faucet-instructions
Diffstat (limited to 'app/scripts/contentscript.js')
-rw-r--r-- | app/scripts/contentscript.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 020208ceb..9a390e580 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -65,10 +65,10 @@ function setupStreams () { } function shouldInjectWeb3 () { - return isAllowedSuffix(window.location.href) + return doctypeCheck() || suffixCheck() } -function isAllowedSuffix (testCase) { +function doctypeCheck () { const doctype = window.document.doctype if (doctype) { return doctype.name === 'html' @@ -76,3 +76,16 @@ function isAllowedSuffix (testCase) { return false } } + +function suffixCheck() { + var prohibitedTypes = ['xml', 'pdf'] + var currentUrl = window.location.href + var currentRegex + for (let i = 0; i < prohibitedTypes.length; i++) { + currentRegex = new RegExp(`\.${prohibitedTypes[i]}$`) + if (currentRegex.test(currentUrl)) { + return false + } + } + return true +} |