Overview
| Comment: | [fx] WebExt: adaptation to Chrome (GC init) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fx |
| Files: | files | file ages | folders |
| SHA3-256: |
b93b38b03d4caf27e95f50405361aa9a |
| User & Date: | olr on 2017-09-26 10:25:15 |
| Other Links: | manifest | tags |
Context
|
2017-09-26
| ||
| 11:36 | [fx] WebExt: adaptation to Chrome (load options) check-in: 939c8db8c7 user: olr tags: trunk, fx | |
| 10:25 | [fx] WebExt: adaptation to Chrome (GC init) check-in: b93b38b03d user: olr tags: trunk, fx | |
| 09:03 | [fx] WebExt: adaptation to Chrome (browser=chrome) check-in: 0e89b6ede9 user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/background.js from [be440d6472] to [d893b16f09].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// Background
"use strict";
function showError (e) {
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/
if (typeof(browser) !== "object") {
var browser = chrome;
}
/*
Worker (separate thread to avoid freezing Firefox)
*/
let xGCEWorker = new Worker("gce_worker.js");
| > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// Background
"use strict";
function showError (e) {
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)
*/
let xGCEWorker = new Worker("gce_worker.js");
|
| ︙ | ︙ | |||
63 64 65 66 67 68 69 |
}
}
catch (e) {
showError(e);
}
};
| < | < < < | | | | | | > | > > > > > > > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
}
}
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(
initGrammarChecker,
function (e) {
showError(e);
xGCEWorker.postMessage({
sCommand: "init",
dParam: {sExtensionPath: browser.extension.getURL("."), dOptions: null, sContext: "Firefox"},
dInfo: {}
});
|
| ︙ | ︙ |