Overview
| Comment: | [fx] fix gc options loading at startup (at least for Chrome) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fx |
| Files: | files | file ages | folders |
| SHA3-256: |
0734ff8f6bbac2131e962c206abe64cf |
| User & Date: | olr on 2018-03-05 15:47:23 |
| Other Links: | manifest | tags |
Context
|
2018-03-06
| ||
| 11:33 | [build][tb] move the Thunberbird debug profile somewhere else check-in: d7e8aec548 user: olr tags: trunk, build, tb | |
|
2018-03-05
| ||
| 18:15 | merge trunk check-in: c0e7e2c228 user: olr tags: multid | |
| 15:47 | [fx] fix gc options loading at startup (at least for Chrome) check-in: 0734ff8f6b user: olr tags: trunk, fx | |
| 15:45 | [fx] change notice in dictionary options panel check-in: 8e9eda66c4 user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/background.js from [1d15c00f44] to [1f59a4fda9].
| ︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - + + + + + + |
Worker (separate thread to avoid freezing Firefox)
*/
let xGCEWorker = new Worker("gce_worker.js");
xGCEWorker.onmessage = function (e) {
// https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
try {
|
| ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + + + - + |
editablenode: true
}});
}
}
function initGrammarChecker (dSavedOptions) {
let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null;
if (bChrome) {
// JS crap again. Chrome can’t store Map object.
dOptions = helpers.objectToMap(dOptions);
}
xGCEWorker.postMessage({
sCommand: "init",
dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
dInfo: {}
});
}
function setSpellingDictionary (dSavedDictionary) {
if (dSavedDictionary.hasOwnProperty("oExtendedDictionary")) {
xGCEWorker.postMessage({
sCommand: "setDictionary",
dParam: { sType: "extended", oDict: dSavedDictionary["oExtendedDictionary"] },
dInfo: {}
});
}
|
| ︙ |
Modified gc_lang/fr/webext/gce_worker.js from [efd11a103b] to [9f37b00cd8].
| ︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + |
Message Event Object
https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
*/
onmessage = function (e) {
let {sCommand, dParam, dInfo} = e.data;
switch (sCommand) {
case "init":
|
| ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | + |
oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json");
oTokenizer = new Tokenizer("fr");
oLocution = helpers.loadFile(sExtensionPath + "/grammalecte/fr/locutions_data.json");
oLxg = new Lexicographe(oSpellChecker, oTokenizer, oLocution);
if (dOptions !== null) {
console.log(dOptions);
gc_engine.setOptions(dOptions);
}
//tests();
bInitDone = true;
} else {
console.log("[Worker] Already initialized…")
}
|
| ︙ | |||
229 230 231 232 233 234 235 | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | + - - + + + |
function setOptions (dOptions, dInfo={}) {
gc_engine.setOptions(dOptions);
postMessage(createResponse("setOptions", gc_engine.getOptions(), dInfo, true));
}
function setOption (sOptName, bValue, dInfo={}) {
console.log(sOptName+": "+bValue);
if (sOptName) {
|
| ︙ |
Modified gc_lang/fr/webext/panel/main.js from [5258bba8d8] to [82866d8fd8].
| ︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | + - - - - - + + + + + + |
browser.runtime.sendMessage({
sCommand: "resetOptions",
dParam: {},
dInfo: {}
});
}
else if (xElem.id.startsWith("option_")) {
if (xElem.dataset.option) {
|
| ︙ | |||
206 207 208 209 210 211 212 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + |
function _setGCOptions (dSavedOptions) {
if (dSavedOptions.hasOwnProperty("gc_options")) {
setGCOptions(dSavedOptions.gc_options);
}
}
function setGCOptions (dOptions) {
try {
|