diff options
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/contentscript.js | 19 | ||||
-rw-r--r-- | app/scripts/lib/extension.js | 5 | ||||
-rw-r--r-- | app/scripts/lib/notifications.js | 4 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 6 | ||||
-rw-r--r-- | app/scripts/migrations/index.js | 1 |
5 files changed, 29 insertions, 6 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 09c1841bf..9a390e580 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -65,14 +65,27 @@ 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' } else { - return true + 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 +} diff --git a/app/scripts/lib/extension.js b/app/scripts/lib/extension.js index 4b670490f..6f8b5d800 100644 --- a/app/scripts/lib/extension.js +++ b/app/scripts/lib/extension.js @@ -11,4 +11,7 @@ */ const Extension = require('./extension-instance') -module.exports = new Extension() +const instance = new Extension() +window.METAMASK_EXTENSION = instance +module.exports = instance + diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index 3db1ac6b5..0ec01f3a7 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -22,10 +22,12 @@ function show () { extension.windows.create({ url: 'notification.html', type: 'popup', - focused: true, width, height, }) + .catch((reason) => { + log.error('failed to create poupup', reason) + }) } }) } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 92533e022..03ea104e0 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -386,7 +386,7 @@ module.exports = class MetamaskController extends EventEmitter { .then((serialized) => { const seedWords = serialized.mnemonic this.configManager.setSeedWords(seedWords) - cb() + cb(null, seedWords) }) } @@ -623,6 +623,10 @@ module.exports = class MetamaskController extends EventEmitter { case '3': url = 'https://faucet.metamask.io/' break + + case '42': + url = 'https://github.com/kovan-testnet/faucet' + break } if (url) extension.tabs.create({ url }) diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index a3dd48c17..019b4d13d 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -22,4 +22,5 @@ module.exports = [ require('./009'), require('./010'), require('./011'), + require('./012'), ] |