aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/contentscript.js
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-03-29 05:50:55 +0800
committerGitHub <noreply@github.com>2017-03-29 05:50:55 +0800
commita3e08d779ecc81ebddf8609130eae5e6db08ad48 (patch)
tree1692e346c343b3b2f9823ff0626d11e961cf5484 /app/scripts/contentscript.js
parent67892c49a6cb26e433e3dbeaa9f2f7790667f103 (diff)
parentd1733c1f7521d17b0e8acdae5a2be33c1a9bbd5c (diff)
downloadtangerine-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.js17
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
+}