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
96
97
98
99
100
101
102
103
104
105
106
107
|
console.log(e.data);
}
}
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: {}
});
}
);
}
init();
/*
Ports from content-scripts
|
>
>
>
>
>
>
>
>
>
>
|
<
<
<
|
<
<
<
<
<
<
<
|
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
96
97
98
99
100
101
102
103
104
105
106
107
|
console.log(e.data);
}
}
catch (e) {
showError(e);
}
};
function initUIOptions (dSavedOptions) {
if (!dSavedOptions.hasOwnProperty("ui_options")) {
browser.storage.local.set({"ui_options": {
textarea: true,
editablenode: false
}});
}
}
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);
browser.storage.local.get("ui_options", initUIOptions);
return;
}
browser.storage.local.get("gc_options").then(initGrammarChecker, showError);
browser.storage.local.get("ui_options").then(initUIOptions, showError);
}
init();
/*
Ports from content-scripts
|