187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
let xGCESharedWorker = new SharedWorker("gce_sharedworker.js");
xGCESharedWorker.port.onmessage = function (e) {
// https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
try {
switch (e.data[0]) {
case "grammar_errors":
console.log("GRAMMAR ERRORS");
console.log("GRAMMAR ERRORS (SHARE)");
console.log(e.data[1].aGrammErr);
//browser.runtime.sendMessage({sCommand: "grammar_errors", aGrammErr: e.data[1].aGrammErr});
break;
case "spelling_and_grammar_errors":
console.log("SPELLING AND GRAMMAR ERRORS");
console.log("SPELLING AND GRAMMAR ERRORS (SHARE)");
console.log(e.data[1].aSpellErr);
console.log(e.data[1].aGrammErr);
break;
case "text_to_test_result":
console.log("TESTS RESULTS");
console.log("TESTS RESULTS (SHARE)");
console.log(e.data[1]);
break;
case "fulltests_result":
console.log("TESTS RESULTS");
console.log("TESTS RESULTS (SHARE)");
console.log(e.data[1]);
break;
case "options":
console.log("OPTIONS");
console.log("OPTIONS (SHARE)");
console.log(e.data[1]);
break;
case "tokens":
console.log("TOKENS");
console.log("TOKENS (SHARE)");
console.log(e.data[1]);
let xLxgTab = browser.tabs.create({
url: browser.extension.getURL("panel/lexicographer.html"),
});
xLxgTab.then(onCreated, onError);
break;
case "error":
console.log("ERROR");
console.log("ERROR (SHARE)");
console.log(e.data[1]);
break;
default:
console.log("Unknown command: " + e.data[0]);
console.log("Unknown command (SHARE): " + e.data[0]);
}
}
catch (e) {
showError(e);
}
};
|