Index: gc_lang/fr/webext/background.js ================================================================== --- gc_lang/fr/webext/background.js +++ gc_lang/fr/webext/background.js @@ -7,12 +7,14 @@ console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ +let bChrome = false; if (typeof(browser) !== "object") { var browser = chrome; + bChrome = true; } /* Worker (separate thread to avoid freezing Firefox) @@ -65,22 +67,27 @@ catch (e) { showError(e); } }; +function initGrammarChecker (dSavedOptions) { + let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null; + xGCEWorker.postMessage({ + sCommand: "init", + dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"}, + dInfo: {} + }); +} function init () { + if (bChrome) { + browser.storage.local.get("gc_options", initGrammarChecker); + return; + } let xPromise = browser.storage.local.get("gc_options"); xPromise.then( - function (dSavedOptions) { - let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null; - xGCEWorker.postMessage({ - sCommand: "init", - dParam: {sExtensionPath: browser.extension.getURL("."), dOptions: dOptions, sContext: "Firefox"}, - dInfo: {} - }); - }, + initGrammarChecker, function (e) { showError(e); xGCEWorker.postMessage({ sCommand: "init", dParam: {sExtensionPath: browser.extension.getURL("."), dOptions: null, sContext: "Firefox"},