Skip to content

Commit

Permalink
fix: reactivate legacy migration and fix missing var
Browse files Browse the repository at this point in the history
  • Loading branch information
stoically committed Jun 30, 2019
1 parent fe7fd6f commit 7f4337f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/background/migration-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@

let migrationReady;
const migrationReadyPromise = new window.PCancelable(resolve => migrationReady = resolve);
window.setTimeout(() => {
const migrationReadyTimeout = window.setTimeout(() => {
migrationReadyPromise.cancel();
}, 15000);

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');
}
Expand All @@ -32,7 +33,7 @@ window.migrationLegacy = async (migration) => {
window.setTimeout(() => {
// onInstalled didnt fire, again.
reject();
}, 5000);
}, 15000);
debug('[migration-legacy] ready');
migrationReady();
});
Expand Down
1 change: 1 addition & 0 deletions src/background/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 7f4337f

Please sign in to comment.