1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-01-03 18:42:00 +01:00

Run setting migration only in background script

This commit is contained in:
kkapsner 2019-04-19 14:09:56 +02:00
parent b7a8a51a56
commit 505fb6409e
2 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,14 @@
scope = require.register("./extension", {}); scope = require.register("./extension", {});
} }
const browserAvailable = typeof browser !== "undefined";
scope.inBackgroundScript = !!(
browserAvailable &&
browser.extension.getBackgroundPage &&
browser.extension.getBackgroundPage() === window
);
scope.getTranslation = function getTranslation(id){ scope.getTranslation = function getTranslation(id){
return browser.i18n.getMessage(id); return browser.i18n.getMessage(id);
}; };

View File

@ -400,7 +400,7 @@
} }
initialized = true; initialized = true;
logging.message("settings loaded"); logging.message("settings loaded");
if (require.exists("./settingsMigration")){ if (require("./extension").inBackgroundScript){
const settingsMigration = require("./settingsMigration"); const settingsMigration = require("./settingsMigration");
settingsMigration.check( settingsMigration.check(
storage, storage,