From 3597759151f6b58e2a0369a551e65e5c28639224 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 Aug 2016 13:35:07 -0700 Subject: [PATCH 01/10] Add MSFT Edge keys to manifest.json --- app/manifest.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/manifest.json b/app/manifest.json index fa71742b1..8f6171878 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -3,6 +3,7 @@ "short_name": "Metamask", "version": "2.7.3", "manifest_version": 2, + "author": "https://metamask.io", "description": "Ethereum Browser Extension", "icons": { "16": "images/icon-16.png", @@ -18,7 +19,8 @@ "scripts": [ "scripts/chromereload.js", "scripts/background.js" - ] + ], + "persistent": true }, "browser_action": { "default_icon": { From 40d5b446cfbea436a012d1799d0d7710caca752c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 Aug 2016 13:36:02 -0700 Subject: [PATCH 02/10] Add Edge build to gulp config --- gulpfile.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index aeaf3e674..dac6cce3e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,6 +34,7 @@ gulp.task('copy:locales', copyTask({ destinations: [ './dist/firefox/_locales', './dist/chrome/_locales', + './dist/edge/_locales', ] })) gulp.task('copy:images', copyTask({ @@ -41,6 +42,7 @@ gulp.task('copy:images', copyTask({ destinations: [ './dist/firefox/images', './dist/chrome/images', + './dist/edge/images', ], })) gulp.task('copy:fonts', copyTask({ @@ -48,6 +50,7 @@ gulp.task('copy:fonts', copyTask({ destinations: [ './dist/firefox/fonts', './dist/chrome/fonts', + './dist/edge/fonts', ], })) gulp.task('copy:reload', copyTask({ @@ -55,6 +58,7 @@ gulp.task('copy:reload', copyTask({ destinations: [ './dist/firefox/scripts', './dist/chrome/scripts', + './dist/edge/scripts', ], pattern: '/chromereload.js', })) @@ -63,6 +67,7 @@ gulp.task('copy:root', copyTask({ destinations: [ './dist/firefox', './dist/chrome', + './dist/edge', ], pattern: '/*', })) @@ -131,13 +136,18 @@ gulp.task('zip:chrome', () => { return gulp.src('dist/chrome/**') .pipe(zip(`metamask-chrome-${manifest.version}.zip`)) .pipe(gulp.dest('builds')); -}); +}) gulp.task('zip:firefox', () => { return gulp.src('dist/firefox/**') .pipe(zip(`metamask-firefox-${manifest.version}.zip`)) .pipe(gulp.dest('builds')); -}); -gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox')) +}) +gulp.task('zip:edge', () => { + return gulp.src('dist/edge/**') + .pipe(zip(`metamask-edge-${manifest.version}.zip`)) + .pipe(gulp.dest('builds')); +}) +gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge')) // high level tasks @@ -200,6 +210,7 @@ function bundleTask(opts) { .pipe(sourcemaps.write('./')) // writes .map file .pipe(gulp.dest('./dist/firefox/scripts')) .pipe(gulp.dest('./dist/chrome/scripts')) + .pipe(gulp.dest('./dist/edge/scripts')) .pipe(livereload()) ) From fb6476224ff0537e179705c2ae0895672a23a67b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 29 Aug 2016 16:40:57 -0700 Subject: [PATCH 03/10] Add tolerance for failed form persisting --- ui/lib/persistent-form.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/lib/persistent-form.js b/ui/lib/persistent-form.js index 2fd7600a2..c2bf99360 100644 --- a/ui/lib/persistent-form.js +++ b/ui/lib/persistent-form.js @@ -14,6 +14,9 @@ inherits(PersistentForm, Component) PersistentForm.prototype.componentDidMount = function () { const fields = document.querySelectorAll('[data-persistent-formid]') const store = this.getPersistentStore() + if (!fields) { + return + } fields.forEach((field) => { const key = field.getAttribute('data-persistent-formid') const cached = store[key] @@ -50,8 +53,12 @@ PersistentForm.prototype.persistentFieldDidUpdate = function (event) { PersistentForm.prototype.componentWillUnmount = function () { const fields = document.querySelectorAll('[data-persistent-formid]') + if (!fields) { + return + } fields.forEach((field) => { field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this)) }) this.setPersistentStore({}) } + From 6838027c6587e41b996dd1cec201980ffd96af08 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 29 Aug 2016 16:49:58 -0700 Subject: [PATCH 04/10] Remove bind calls from console errors --- app/scripts/contentscript.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index de2cf263b..b3a560c88 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -43,20 +43,20 @@ function setupStreams(){ name: 'contentscript', target: 'inpage', }) - pageStream.on('error', console.error.bind(console)) + pageStream.on('error', console.error) var pluginPort = extension.runtime.connect({name: 'contentscript'}) var pluginStream = new PortStream(pluginPort) - pluginStream.on('error', console.error.bind(console)) + pluginStream.on('error', console.error) // forward communication plugin->inpage pageStream.pipe(pluginStream).pipe(pageStream) // connect contentscript->inpage reload stream var mx = ObjectMultiplex() - mx.on('error', console.error.bind(console)) + mx.on('error', console.error) mx.pipe(pageStream) var reloadStream = mx.createStream('reload') - reloadStream.on('error', console.error.bind(console)) + reloadStream.on('error', console.error) // if we lose connection with the plugin, trigger tab refresh pluginStream.on('close', function () { From b36b7603384309a7ef714e269818775bab02e52c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 29 Aug 2016 17:32:39 -0700 Subject: [PATCH 05/10] Fix console.error references Microsoft edge does not support console.error.bind, nor is that call necessary here. --- app/scripts/chromereload.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scripts/chromereload.js b/app/scripts/chromereload.js index 88333ba8a..f0bae403c 100644 --- a/app/scripts/chromereload.js +++ b/app/scripts/chromereload.js @@ -324,13 +324,13 @@ window.LiveReloadOptions = { host: 'localhost' }; this.pluginIdentifiers = {} this.console = this.window.console && this.window.console.log && this.window.console.error ? this.window.location.href.match(/LR-verbose/) ? this.window.console : { log: function () {}, - error: this.window.console.error.bind(this.window.console), + error: console.error, } : { log: function () {}, error: function () {}, } if (!(this.WebSocket = this.window.WebSocket || this.window.MozWebSocket)) { - this.console.error('LiveReload disabled because the browser does not seem to support web sockets') + console.error('LiveReload disabled because the browser does not seem to support web sockets') return } if ('LiveReloadOptions' in window) { @@ -344,7 +344,7 @@ window.LiveReloadOptions = { host: 'localhost' }; } else { this.options = Options.extract(this.window.document) if (!this.options) { - this.console.error('LiveReload disabled because it could not find its own