From 7f4337f231671bc4c6a6e89a88f1e654a2b18c7e Mon Sep 17 00:00:00 2001 From: stoically Date: Sun, 30 Jun 2019 20:20:49 +0200 Subject: [PATCH] fix: reactivate legacy migration and fix missing var --- src/background/migration-legacy.js | 7 ++++--- src/background/runtime.js | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/background/migration-legacy.js b/src/background/migration-legacy.js index be191b20..cdd1b0ed 100644 --- a/src/background/migration-legacy.js +++ b/src/background/migration-legacy.js @@ -3,7 +3,7 @@ let migrationReady; const migrationReadyPromise = new window.PCancelable(resolve => migrationReady = resolve); -window.setTimeout(() => { +const migrationReadyTimeout = window.setTimeout(() => { migrationReadyPromise.cancel(); }, 15000); @@ -11,13 +11,14 @@ const migrationOnInstalledListener = async function() { browser.runtime.onInstalled.removeListener(migrationOnInstalledListener); const {version} = await browser.storage.local.get('version'); if (version) { + clearTimeout(migrationReadyTimeout); debug('[migration-legacy] version found, skip', version); return; } try { await migrationReadyPromise; - // return tmp.migration.onInstalled.call(tmp.migration, ...arguments); + return tmp.migration.onInstalled.call(tmp.migration, ...arguments); } catch (error) { debug('[migration-legacy] waiting for migration ready timed out'); } @@ -32,7 +33,7 @@ window.migrationLegacy = async (migration) => { window.setTimeout(() => { // onInstalled didnt fire, again. reject(); - }, 5000); + }, 15000); debug('[migration-legacy] ready'); migrationReady(); }); diff --git a/src/background/runtime.js b/src/background/runtime.js index 20bbb101..3e2eaed7 100644 --- a/src/background/runtime.js +++ b/src/background/runtime.js @@ -11,6 +11,7 @@ class Runtime { this.browseraction = this.background.browseraction; this.migration = this.background.migration; this.permissions = this.background.permissions; + this.contextmenu = this.background.contextmenu; browser.runtime.onMessageExternal.addListener(this.onMessageExternal.bind(this)); }