Grammalecte  Check-in [58ba816fa3]

Overview
Comment:[fx][tb] code clarification
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | tb | fx
Files: files | file ages | folders
SHA3-256: 58ba816fa35e6a2fb36235dd3fc0f1cd614bde3eeef1628a179b32ca0f2b27cb
User & Date: olr on 2020-03-18 14:04:15
Other Links: manifest | tags
Context
2020-03-18
17:36
[fx] update observePage() check-in: 99326d3d4b user: olr tags: fx, trunk
14:04
[fx][tb] code clarification check-in: 58ba816fa3 user: olr tags: fx, tb, trunk
13:29
[doc] Web API update check-in: 1cefc9c400 user: olr tags: doc, trunk
Changes

Modified gc_lang/fr/mailext/background.js from [3a88cd4eaf] to [84cc5ca0a0].

    14     14       start: function () {
    15     15           this.xGCEWorker = new Worker("gce_worker.js");
    16     16           this.xGCEWorker.onmessage = function (e) {
    17     17               // Messages received from the Worker
    18     18               // https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    19     19               try {
    20     20                   this.nLastTimeWorkerResponse = Date.now();
    21         -                let {sActionDone, result, dInfo, bEnd, bError} = e.data;
           21  +                let {sActionDone, result, oInfo, bEnd, bError} = e.data;
    22     22                   if (bError) {
    23     23                       console.log(result);
    24         -                    console.log(dInfo);
           24  +                    console.log(oInfo);
    25     25                       return;
    26     26                   }
    27     27                   switch (sActionDone) {
    28     28                       case "init":
    29     29                           storeGCOptions(result);
    30     30                           break;
    31     31                       case "parse":
................................................................................
    32     32                       case "parseAndSpellcheck":
    33     33                       case "parseAndSpellcheck1":
    34     34                       case "parseFull":
    35     35                       case "getListOfTokens":
    36     36                       case "getSpellSuggestions":
    37     37                       case "getVerb":
    38     38                           // send result to content script
    39         -                        if (typeof(dInfo.iReturnPort) === "number") {
    40         -                            let xPort = dConnx.get(dInfo.iReturnPort);
           39  +                        if (typeof(oInfo.iReturnPort) === "number") {
           40  +                            let xPort = dConnx.get(oInfo.iReturnPort);
    41     41                               xPort.postMessage(e.data);
    42     42                           } else {
    43     43                               console.log("[background] don’t know where to send results");
    44     44                               console.log(e.data);
    45     45                           }
    46     46                           break;
    47     47                       case "textToTest":
................................................................................
   137    137               let dOptions = (oSavedOptions.hasOwnProperty("gc_options")) ? oSavedOptions.gc_options : null;
   138    138               if (dOptions !== null && Object.getOwnPropertyNames(dOptions).length == 0) {
   139    139                   console.log("# Error: the saved options was an empty object.");
   140    140                   dOptions = null;
   141    141               }
   142    142               oWorkerHandler.xGCEWorker.postMessage({
   143    143                   sCommand: "init",
   144         -                dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
   145         -                dInfo: {}
          144  +                oParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
          145  +                oInfo: {}
   146    146               });
   147    147           }
   148    148           catch (e) {
   149    149               console.log("initGrammarChecker failed");
   150    150               showError(e);
   151    151           }
   152    152       },
   153    153   
   154    154       _setSpellingDictionaries: function (oData) {
   155    155           if (oData.hasOwnProperty("community_dictionary")) {
   156         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, dInfo: {} });
          156  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, oInfo: {} });
   157    157           }
   158    158           if (oData.hasOwnProperty("personal_dictionary")) {
   159         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, dInfo: {} });
          159  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, oInfo: {} });
   160    160           }
   161    161       },
   162    162   
   163    163       _initSCOptions: function (oData) {
   164    164           if (!oData.hasOwnProperty("sc_options")) {
   165    165               browser.storage.local.set({"sc_options": {
   166    166                   community: true,
   167    167                   personal: true
   168    168               }});
   169         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "community", bActivate: true }, dInfo: {} });
   170         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "personal", bActivate: true }, dInfo: {} });
          169  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: true }, oInfo: {} });
          170  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: true }, oInfo: {} });
   171    171           } else {
   172         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, dInfo: {} });
   173         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, dInfo: {} });
          172  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, oInfo: {} });
          173  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, oInfo: {} });
   174    174           }
   175    175       }
   176    176   }
   177    177   
   178    178   // start the Worker for the GC
   179    179   oWorkerHandler.start();
   180    180   

Modified gc_lang/fr/mailext/content/lex_editor.js from [1f70f3f40f] to [e12409ccd5].

   472    472           let lEntry = oLexiconTable.getEntries();
   473    473           if (lEntry.length > 0) {
   474    474               let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "fr.personal", "Dictionnaire personnel", xProgressNode);
   475    475               let oJSON = oDAWG.createBinaryJSON(1);
   476    476               oFileHandler.saveFile("fr.personal.json", JSON.stringify(oJSON));
   477    477               this.oIBDAWG = new IBDAWG(oJSON);
   478    478               this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
   479         -            //browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} });
          479  +            //browser.runtime.sendMessage({ sCommand: "setDictionary", oParam: {sType: "personal", oDict: oJSON}, oInfo: {} });
   480    480               enableElement("export_button");
   481    481           } else {
   482    482               oFileHandler.deleteFile("fr.personal.json");
   483    483               this.setDictData(0, "[néant]");
   484    484               disableElement("export_button");
   485    485           }
   486    486       },

Modified gc_lang/fr/mailext/gce_worker.js from [3191c72f90] to [946a66a85a].

    54     54       Warning.
    55     55       Initialization can’t be completed at startup of the worker,
    56     56       for we need the path of the extension to load data stored in JSON files.
    57     57       This path is retrieved in background.js and passed with the event “init”.
    58     58   */
    59     59   
    60     60   
    61         -function createResponse (sActionDone, result, dInfo, bEnd, bError=false) {
           61  +function createResponse (sActionDone, result, oInfo, bEnd, bError=false) {
    62     62       return {
    63     63           "sActionDone": sActionDone,
    64     64           "result": result, // can be of any type
    65         -        "dInfo": dInfo,
           65  +        "oInfo": oInfo,
    66     66           "bEnd": bEnd,
    67     67           "bError": bError
    68     68       };
    69     69   }
    70     70   
    71     71   function createErrorResult (e, sDescr="no description") {
    72     72       return {
................................................................................
    85     85   
    86     86   
    87     87   /*
    88     88       Message Event Object
    89     89       https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    90     90   */
    91     91   onmessage = function (e) {
    92         -    let {sCommand, dParam, dInfo} = e.data;
           92  +    let {sCommand, oParam, oInfo} = e.data;
    93     93       switch (sCommand) {
    94     94           case "init":
    95         -            init(dParam.sExtensionPath, dParam.dOptions, dParam.sContext, dInfo);
           95  +            init(oParam.sExtensionPath, oParam.dOptions, oParam.sContext, oInfo);
    96     96               break;
    97     97           case "parse":
    98         -            parse(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
           98  +            parse(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
    99     99               break;
   100    100           case "parseAndSpellcheck":
   101         -            parseAndSpellcheck(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          101  +            parseAndSpellcheck(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   102    102               break;
   103    103           case "parseAndSpellcheck1":
   104         -            parseAndSpellcheck1(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          104  +            parseAndSpellcheck1(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   105    105               break;
   106    106           case "parseFull":
   107         -            parseFull(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          107  +            parseFull(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   108    108               break;
   109    109           case "getListOfTokens":
   110         -            getListOfTokens(dParam.sText, dInfo);
          110  +            getListOfTokens(oParam.sText, oInfo);
   111    111               break;
   112    112           case "getOptions":
   113         -            getOptions(dInfo);
          113  +            getOptions(oInfo);
   114    114               break;
   115    115           case "getDefaultOptions":
   116         -            getDefaultOptions(dInfo);
          116  +            getDefaultOptions(oInfo);
   117    117               break;
   118    118           case "setOptions":
   119         -            setOptions(dParam.sOptions, dInfo);
          119  +            setOptions(oParam.sOptions, oInfo);
   120    120               break;
   121    121           case "setOption":
   122         -            setOption(dParam.sOptName, dParam.bValue, dInfo);
          122  +            setOption(oParam.sOptName, oParam.bValue, oInfo);
   123    123               break;
   124    124           case "resetOptions":
   125         -            resetOptions(dInfo);
          125  +            resetOptions(oInfo);
   126    126               break;
   127    127           case "textToTest":
   128         -            textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          128  +            textToTest(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   129    129               break;
   130    130           case "fullTests":
   131         -            fullTests(dInfo);
          131  +            fullTests(oInfo);
   132    132               break;
   133    133           case "setDictionary":
   134         -            setDictionary(dParam.sDictionary, dParam.oDict, dInfo);
          134  +            setDictionary(oParam.sDictionary, oParam.oDict, oInfo);
   135    135               break;
   136    136           case "setDictionaryOnOff":
   137         -            setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo);
          137  +            setDictionaryOnOff(oParam.sDictionary, oParam.bActivate, oInfo);
   138    138               break;
   139    139           case "getSpellSuggestions":
   140         -            getSpellSuggestions(dParam.sWord, dInfo);
          140  +            getSpellSuggestions(oParam.sWord, oInfo);
   141    141               break;
   142    142           case "getVerb":
   143         -            getVerb(dParam.sVerb, dParam.bPro, dParam.bNeg, dParam.bTpsCo, dParam.bInt, dParam.bFem, dInfo);
          143  +            getVerb(oParam.sVerb, oParam.bPro, oParam.bNeg, oParam.bTpsCo, oParam.bInt, oParam.bFem, oInfo);
   144    144               break;
   145    145           default:
   146    146               console.log("[Worker] Unknown command: " + sCommand);
   147    147               showData(e.data);
   148    148       }
   149    149   }
   150    150   
................................................................................
   164    164       This worker don’t work as a PromiseWorker (which returns a promise),  so when we send request
   165    165       to this worker, we can’t wait the return of the answer just after the request made.
   166    166       The answer is received by the background in another function (onmessage).
   167    167       That’s why the full text to analyze is send in one block, but analyse is returned paragraph
   168    168       by paragraph.
   169    169   */
   170    170   
   171         -function init (sExtensionPath, dOptions=null, sContext="JavaScript", dInfo={}) {
          171  +function init (sExtensionPath, dOptions=null, sContext="JavaScript", oInfo={}) {
   172    172       try {
   173    173           if (!bInitDone) {
   174    174               console.log("[Worker] Loading… Extension path: " + sExtensionPath);
   175    175               conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json"));
   176    176               phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json"));
   177    177               mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json"));
   178    178               //console.log("[Worker] Modules have been initialized…");
................................................................................
   191    191               //tests();
   192    192               bInitDone = true;
   193    193           } else {
   194    194               console.log("[Worker] Already initialized…")
   195    195           }
   196    196           // we always retrieve options from the gc_engine, for setOptions filters obsolete options
   197    197           dOptions = helpers.mapToObject(gc_engine.getOptions());
   198         -        postMessage(createResponse("init", dOptions, dInfo, true));
          198  +        postMessage(createResponse("init", dOptions, oInfo, true));
   199    199       }
   200    200       catch (e) {
   201    201           console.error(e);
   202         -        postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true));
          202  +        postMessage(createResponse("init", createErrorResult(e, "init failed"), oInfo, true, true));
   203    203       }
   204    204   }
   205    205   
   206    206   
   207         -function parse (sText, sCountry, bDebug, bContext, dInfo={}) {
          207  +function parse (sText, sCountry, bDebug, bContext, oInfo={}) {
   208    208       sText = sText.replace(/­/g, "").normalize("NFC");
   209    209       for (let sParagraph of text.getParagraph(sText)) {
   210    210           let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext);
   211         -        postMessage(createResponse("parse", aGrammErr, dInfo, false));
          211  +        postMessage(createResponse("parse", aGrammErr, oInfo, false));
   212    212       }
   213         -    postMessage(createResponse("parse", null, dInfo, true));
          213  +    postMessage(createResponse("parse", null, oInfo, true));
   214    214   }
   215    215   
   216         -function parseAndSpellcheck (sText, sCountry, bDebug, bContext, dInfo={}) {
          216  +function parseAndSpellcheck (sText, sCountry, bDebug, bContext, oInfo={}) {
   217    217       let i = 0;
   218    218       sText = sText.replace(/­/g, "").normalize("NFC");
   219    219       for (let sParagraph of text.getParagraph(sText)) {
   220    220           let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext);
   221    221           let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
   222         -        postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, false));
          222  +        postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, false));
   223    223           i += 1;
   224    224       }
   225         -    postMessage(createResponse("parseAndSpellcheck", null, dInfo, true));
          225  +    postMessage(createResponse("parseAndSpellcheck", null, oInfo, true));
   226    226   }
   227    227   
   228         -function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, dInfo={}) {
          228  +function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, oInfo={}) {
   229    229       sParagraph = sParagraph.replace(/­/g, "").normalize("NFC");
   230    230       let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext);
   231    231       let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
   232         -    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true));
          232  +    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, true));
   233    233   }
   234    234   
   235         -function parseFull (sText, sCountry, bDebug, bContext, dInfo={}) {
          235  +function parseFull (sText, sCountry, bDebug, bContext, oInfo={}) {
   236    236       let i = 0;
   237    237       sText = sText.replace(/­/g, "").normalize("NFC");
   238    238       for (let sParagraph of text.getParagraph(sText)) {
   239    239           let lSentence = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext, true);
   240    240           console.log("*", lSentence);
   241         -        postMessage(createResponse("parseFull", {sParagraph: sParagraph, iParaNum: i, lSentence: lSentence}, dInfo, false));
          241  +        postMessage(createResponse("parseFull", {sParagraph: sParagraph, iParaNum: i, lSentence: lSentence}, oInfo, false));
   242    242           i += 1;
   243    243       }
   244         -    postMessage(createResponse("parseFull", null, dInfo, true));
          244  +    postMessage(createResponse("parseFull", null, oInfo, true));
   245    245   }
   246    246   
   247         -function getListOfTokens (sText, dInfo={}) {
          247  +function getListOfTokens (sText, oInfo={}) {
   248    248       // lexicographer
   249    249       try {
   250    250           sText = sText.replace(/­/g, "").normalize("NFC");
   251    251           for (let sParagraph of text.getParagraph(sText)) {
   252    252               if (sParagraph.trim() !== "") {
   253         -                postMessage(createResponse("getListOfTokens", oLxg.getListOfTokensReduc(sParagraph, true), dInfo, false));
          253  +                postMessage(createResponse("getListOfTokens", oLxg.getListOfTokensReduc(sParagraph, true), oInfo, false));
   254    254               }
   255    255           }
   256         -        postMessage(createResponse("getListOfTokens", null, dInfo, true));
          256  +        postMessage(createResponse("getListOfTokens", null, oInfo, true));
   257    257       }
   258    258       catch (e) {
   259    259           console.error(e);
   260         -        postMessage(createResponse("getListOfTokens", createErrorResult(e, "no tokens"), dInfo, true, true));
          260  +        postMessage(createResponse("getListOfTokens", createErrorResult(e, "no tokens"), oInfo, true, true));
   261    261       }
   262    262   }
          263  +
          264  +function getOptions (oInfo={}) {
          265  +    let dOptions = helpers.mapToObject(gc_engine.getOptions());
          266  +    postMessage(createResponse("getOptions", dOptions, oInfo, true));
          267  +}
   263    268   
   264         -function getOptions (dInfo={}) {
   265         -    let dOptions = helpers.mapToObject(gc_engine.getOptions());
   266         -    postMessage(createResponse("getOptions", dOptions, dInfo, true));
          269  +function getDefaultOptions (oInfo={}) {
          270  +    let dOptions = helpers.mapToObject(gc_engine.getDefaultOptions());
          271  +    postMessage(createResponse("getDefaultOptions", dOptions, oInfo, true));
   267    272   }
   268    273   
   269         -function getDefaultOptions (dInfo={}) {
   270         -    let dOptions = helpers.mapToObject(gc_engine.getDefaultOptions());
   271         -    postMessage(createResponse("getDefaultOptions", dOptions, dInfo, true));
   272         -}
   273         -
   274         -function setOptions (dOptions, dInfo={}) {
          274  +function setOptions (dOptions, oInfo={}) {
   275    275       if (!(dOptions instanceof Map)) {
   276    276           dOptions = helpers.objectToMap(dOptions);
   277    277       }
   278    278       gc_engine.setOptions(dOptions);
   279    279       dOptions = helpers.mapToObject(gc_engine.getOptions());
   280         -    postMessage(createResponse("setOptions", dOptions, dInfo, true));
          280  +    postMessage(createResponse("setOptions", dOptions, oInfo, true));
   281    281   }
   282    282   
   283         -function setOption (sOptName, bValue, dInfo={}) {
          283  +function setOption (sOptName, bValue, oInfo={}) {
   284    284       console.log(sOptName+": "+bValue);
   285    285       if (sOptName) {
   286    286           gc_engine.setOption(sOptName, bValue);
   287    287           let dOptions = helpers.mapToObject(gc_engine.getOptions());
   288         -        postMessage(createResponse("setOption", dOptions, dInfo, true));
          288  +        postMessage(createResponse("setOption", dOptions, oInfo, true));
   289    289       }
   290    290   }
   291    291   
   292         -function resetOptions (dInfo={}) {
          292  +function resetOptions (oInfo={}) {
   293    293       gc_engine.resetOptions();
   294    294       let dOptions = helpers.mapToObject(gc_engine.getOptions());
   295         -    postMessage(createResponse("resetOptions", dOptions, dInfo, true));
          295  +    postMessage(createResponse("resetOptions", dOptions, oInfo, true));
   296    296   }
   297    297   
   298    298   function tests () {
   299    299       console.log(conj.getConj("devenir", ":E", ":2s"));
   300    300       console.log(mfsp.getMasForm("emmerdeuse", true));
   301    301       console.log(mfsp.getMasForm("pointilleuse", false));
   302    302       console.log(phonet.getSimil("est"));
   303    303       let aRes = gc_engine.parse("Je suit...");
   304    304       for (let oErr of aRes) {
   305    305           console.log(text.getReadableError(oErr));
   306    306       }
   307    307   }
   308    308   
   309         -function textToTest (sText, sCountry, bDebug, bContext, dInfo={}) {
          309  +function textToTest (sText, sCountry, bDebug, bContext, oInfo={}) {
   310    310       if (!gc_engine) {
   311         -        postMessage(createResponse("textToTest", "# Grammar checker not loaded.", dInfo, true));
          311  +        postMessage(createResponse("textToTest", "# Grammar checker not loaded.", oInfo, true));
   312    312           return;
   313    313       }
   314    314       sText = sText.replace(/­/g, "").normalize("NFC");
   315    315       let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext);
   316    316       let sMsg = "";
   317    317       for (let oErr of aGrammErr) {
   318    318           sMsg += text.getReadableError(oErr) + "\n";
   319    319       }
   320    320       if (sMsg == "") {
   321    321           sMsg =  "Aucune erreur détectée.";
   322    322       }
   323         -    postMessage(createResponse("textToTest", sMsg, dInfo, true));
          323  +    postMessage(createResponse("textToTest", sMsg, oInfo, true));
   324    324   }
   325    325   
   326         -function fullTests (dInfo={}) {
          326  +function fullTests (oInfo={}) {
   327    327       if (!gc_engine) {
   328         -        postMessage(createResponse("fullTests", "# Grammar checker not loaded.", dInfo, true));
          328  +        postMessage(createResponse("fullTests", "# Grammar checker not loaded.", oInfo, true));
   329    329           return;
   330    330       }
   331    331       let dMemoOptions = gc_engine.getOptions();
   332    332       let dTestOptions = gc_engine.getDefaultOptions();
   333    333       dTestOptions.set("nbsp", true);
   334    334       dTestOptions.set("esp", true);
   335    335       dTestOptions.set("unit", true);
................................................................................
   337    337       gc_engine.setOptions(dTestOptions);
   338    338       let sMsg = "";
   339    339       for (let sRes of oTest.testParse()) {
   340    340           sMsg += sRes + "\n";
   341    341           console.log(sRes);
   342    342       }
   343    343       gc_engine.setOptions(dMemoOptions);
   344         -    postMessage(createResponse("fullTests", sMsg, dInfo, true));
          344  +    postMessage(createResponse("fullTests", sMsg, oInfo, true));
   345    345   }
   346    346   
   347    347   
   348    348   // SpellChecker
   349    349   
   350         -function setDictionary (sDictionary, oDict, dInfo) {
          350  +function setDictionary (sDictionary, oDict, oInfo) {
   351    351       if (!oSpellChecker) {
   352         -        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
          352  +        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", oInfo, true));
   353    353           return;
   354    354       }
   355    355       //console.log("setDictionary", sDictionary);
   356    356       switch (sDictionary) {
   357    357           case "main":
   358         -            oSpellChecker.setMainDictionary(oDict, dInfo["sExtPath"]+"/grammalecte/graphspell/_dictionaries");
          358  +            oSpellChecker.setMainDictionary(oDict, oInfo["sExtPath"]+"/grammalecte/graphspell/_dictionaries");
   359    359               break;
   360    360           case "community":
   361    361               oSpellChecker.setCommunityDictionary(oDict);
   362    362               break;
   363    363           case "personal":
   364    364               oSpellChecker.setPersonalDictionary(oDict);
   365    365               break;
   366    366           default:
   367    367               console.log("[worker] setDictionary: Unknown dictionary <"+sDictionary+">");
   368    368       }
   369         -    postMessage(createResponse("setDictionary", true, dInfo, true));
          369  +    postMessage(createResponse("setDictionary", true, oInfo, true));
   370    370   }
   371    371   
   372         -function setDictionaryOnOff (sDictionary, bActivate, dInfo) {
          372  +function setDictionaryOnOff (sDictionary, bActivate, oInfo) {
   373    373       if (!oSpellChecker) {
   374         -        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
          374  +        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", oInfo, true));
   375    375           return;
   376    376       }
   377    377       //console.log("setDictionaryOnOff", sDictionary, bActivate);
   378    378       switch (sDictionary) {
   379    379           case "community":
   380    380               if (bActivate) {
   381    381                   oSpellChecker.activateCommunityDictionary();
................................................................................
   389    389               } else {
   390    390                   oSpellChecker.deactivatePersonalDictionary();
   391    391               }
   392    392               break;
   393    393           default:
   394    394               console.log("[worker] setDictionaryOnOff: Unknown dictionary <"+sDictionary+">");
   395    395       }
   396         -    postMessage(createResponse("setDictionaryOnOff", true, dInfo, true));
          396  +    postMessage(createResponse("setDictionaryOnOff", true, oInfo, true));
   397    397   }
   398    398   
   399         -function getSpellSuggestions (sWord, dInfo) {
          399  +function getSpellSuggestions (sWord, oInfo) {
   400    400       if (!oSpellChecker) {
   401         -        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true));
          401  +        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", oInfo, true));
   402    402           return;
   403    403       }
   404    404       let i = 0;
   405    405       for (let aSugg of oSpellChecker.suggest(sWord)) {
   406         -        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
          406  +        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, oInfo, true));
   407    407           i += 1;
   408    408       }
   409    409   }
   410    410   
   411    411   
   412    412   // Conjugueur
   413    413   
   414         -function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, dInfo) {
          414  +function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, oInfo) {
   415    415       try {
   416    416           let oVerb = null;
   417    417           let oConjTable = null;
   418    418           if (conj.isVerb(sWord)) {
   419    419               oVerb = new Verb(sWord);
   420    420               oConjTable = oVerb.createConjTable(bPro, bNeg, bTpsCo, bInt, bFem);
   421    421           }
   422         -        postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, dInfo, true));
          422  +        postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, oInfo, true));
   423    423       }
   424    424       catch (e) {
   425    425           console.error(e);
   426         -        postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), dInfo, true, true));
          426  +        postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), oInfo, true, true));
   427    427       }
   428    428   }

Modified gc_lang/fr/tb/content/lex_editor.js from [52568b3e47] to [7c96d2821d].

   479    479           let lEntry = oLexiconTable.getEntries();
   480    480           if (lEntry.length > 0) {
   481    481               let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "fr.personal", "Dictionnaire personnel", xProgressNode);
   482    482               let oJSON = oDAWG.createBinaryJSON(1);
   483    483               oFileHandler.saveFile("fr.personal.json", JSON.stringify(oJSON));
   484    484               this.oIBDAWG = new IBDAWG(oJSON);
   485    485               this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
   486         -            //browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} });
          486  +            //browser.runtime.sendMessage({ sCommand: "setDictionary", oParam: {sType: "personal", oDict: oJSON}, oInfo: {} });
   487    487               enableElement("export_button");
   488    488           } else {
   489    489               oFileHandler.deleteFile("fr.personal.json");
   490    490               this.setDictData(0, "[néant]");
   491    491               disableElement("export_button");
   492    492           }
   493    493       },

Modified gc_lang/fr/webext/background.js from [3d2146a610] to [cc1bfe6b79].

    26     26       start: function () {
    27     27           this.xGCEWorker = new Worker("gce_worker.js");
    28     28           this.xGCEWorker.onmessage = function (e) {
    29     29               // Messages received from the Worker
    30     30               // https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    31     31               try {
    32     32                   this.nLastTimeWorkerResponse = Date.now();
    33         -                let {sActionDone, result, dInfo, bEnd, bError} = e.data;
           33  +                let {sActionDone, result, oInfo, bEnd, bError} = e.data;
    34     34                   if (bError) {
    35     35                       console.log(result);
    36         -                    console.log(dInfo);
           36  +                    console.log(oInfo);
    37     37                       return;
    38     38                   }
    39     39                   switch (sActionDone) {
    40     40                       case "init":
    41     41                           storeGCOptions(result);
    42     42                           break;
    43     43                       case "parse":
................................................................................
    44     44                       case "parseAndSpellcheck":
    45     45                       case "parseAndSpellcheck1":
    46     46                       case "parseFull":
    47     47                       case "getListOfTokens":
    48     48                       case "getSpellSuggestions":
    49     49                       case "getVerb":
    50     50                           // send result to content script
    51         -                        if (typeof(dInfo.iReturnPort) === "number") {
    52         -                            let xPort = dConnx.get(dInfo.iReturnPort);
           51  +                        if (typeof(oInfo.iReturnPort) === "number") {
           52  +                            let xPort = dConnx.get(oInfo.iReturnPort);
    53     53                               xPort.postMessage(e.data);
    54     54                           } else {
    55     55                               console.log("[background] don’t know where to send results");
    56     56                               console.log(e.data);
    57     57                           }
    58     58                           break;
    59     59                       case "textToTest":
................................................................................
   165    165               let dOptions = (oSavedOptions.hasOwnProperty("gc_options")) ? oSavedOptions.gc_options : null;
   166    166               if (dOptions !== null && Object.getOwnPropertyNames(dOptions).length == 0) {
   167    167                   console.log("# Error: the saved options was an empty object.");
   168    168                   dOptions = null;
   169    169               }
   170    170               oWorkerHandler.xGCEWorker.postMessage({
   171    171                   sCommand: "init",
   172         -                dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
   173         -                dInfo: {}
          172  +                oParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
          173  +                oInfo: {}
   174    174               });
   175    175           }
   176    176           catch (e) {
   177    177               console.log("initGrammarChecker failed");
   178    178               showError(e);
   179    179           }
   180    180       },
   181    181   
   182    182       _setSpellingDictionaries: function (oData) {
   183    183           if (oData.hasOwnProperty("oPersonalDictionary")) {
   184    184               // deprecated (to be removed in 2020)
   185    185               console.log("personal dictionary migration");
   186    186               browser.storage.local.set({ "personal_dictionary": oData["oPersonalDictionary"] });
   187         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "personal", oDict: oData["oPersonalDictionary"] }, dInfo: {} });
          187  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["oPersonalDictionary"] }, oInfo: {} });
   188    188               browser.storage.local.remove("oPersonalDictionary");
   189    189           }
   190    190           if (oData.hasOwnProperty("main_dic_name")) {
   191         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "main", oDict: oData["main_dic_name"] }, dInfo: {sExtPath: browser.extension.getURL("")} });
          191  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "main", oDict: oData["main_dic_name"] }, oInfo: {sExtPath: browser.extension.getURL("")} });
   192    192           }
   193    193           if (oData.hasOwnProperty("community_dictionary")) {
   194         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, dInfo: {} });
          194  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "community", oDict: oData["community_dictionary"] }, oInfo: {} });
   195    195           }
   196    196           if (oData.hasOwnProperty("personal_dictionary")) {
   197         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", dParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, dInfo: {} });
          197  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionary", oParam: { sDictionary: "personal", oDict: oData["personal_dictionary"] }, oInfo: {} });
   198    198           }
   199    199       },
   200    200   
   201    201       _initSCOptions: function (oData) {
   202    202           if (!oData.hasOwnProperty("sc_options")) {
   203    203               browser.storage.local.set({"sc_options": {
   204    204                   community: true,
   205    205                   personal: true
   206    206               }});
   207         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "community", bActivate: true }, dInfo: {} });
   208         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "personal", bActivate: true }, dInfo: {} });
          207  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: true }, oInfo: {} });
          208  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: true }, oInfo: {} });
   209    209           } else {
   210         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, dInfo: {} });
   211         -            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", dParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, dInfo: {} });
          210  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "community", bActivate: oData.sc_options["community"] }, oInfo: {} });
          211  +            oWorkerHandler.xGCEWorker.postMessage({ sCommand: "setDictionaryOnOff", oParam: { sDictionary: "personal", bActivate: oData.sc_options["personal"] }, oInfo: {} });
   212    212           }
   213    213       }
   214    214   }
   215    215   
   216    216   // start the Worker for the GC
   217    217   oWorkerHandler.start();
   218    218   
................................................................................
   242    242   
   243    243   /*
   244    244       Messages from the extension (not the Worker)
   245    245   */
   246    246   function handleMessage (oRequest, xSender, sendResponse) {
   247    247       // message from panels
   248    248       //console.log(xSender);
   249         -    let {sCommand, dParam, dInfo} = oRequest;
          249  +    let {sCommand, oParam, oInfo} = oRequest;
   250    250       switch (sCommand) {
   251    251           case "getOptions":
   252    252           case "getDefaultOptions":
   253    253           case "setOptions":
   254    254           case "setOption":
   255    255           case "resetOptions":
   256    256           case "textToTest":
   257    257           case "fullTests":
   258    258           case "setDictionary":
   259    259           case "setDictionaryOnOff":
   260    260               oWorkerHandler.xGCEWorker.postMessage(oRequest);
   261    261               break;
   262    262           case "restartWorker":
   263         -            oWorkerHandler.restart(dParam["nDelayLimit"]);
          263  +            oWorkerHandler.restart(oParam["nDelayLimit"]);
   264    264               break;
   265    265           case "openURL":
   266         -            browser.tabs.create({url: dParam.sURL});
          266  +            browser.tabs.create({url: oParam.sURL});
   267    267               break;
   268    268           case "openConjugueurTab":
   269    269               openConjugueurTab();
   270    270               break;
   271    271           case "openLexiconEditor":
   272         -            openLexiconEditor(dParam["dictionary"]);
          272  +            openLexiconEditor(oParam["dictionary"]);
   273    273               break;
   274    274           case "openDictionaries":
   275    275               openDictionaries();
   276    276               break;
   277    277           default:
   278    278               console.log("[background] Unknown command: " + sCommand);
   279    279               console.log(oRequest);
................................................................................
   285    285   
   286    286   
   287    287   function handleConnexion (xPort) {
   288    288       // Messages from tabs
   289    289       let iPortId = xPort.sender.tab.id; // identifier for the port: each port can be found at dConnx[iPortId]
   290    290       dConnx.set(iPortId, xPort);
   291    291       xPort.onMessage.addListener(function (oRequest) {
   292         -        let {sCommand, dParam, dInfo} = oRequest;
          292  +        let {sCommand, oParam, oInfo} = oRequest;
   293    293           switch (sCommand) {
   294    294               case "parse":
   295    295               case "parseAndSpellcheck":
   296    296               case "parseAndSpellcheck1":
   297    297               case "parseFull":
   298    298               case "getListOfTokens":
   299    299               case "getSpellSuggestions":
   300    300               case "getVerb":
   301         -                oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer
          301  +                oRequest.oInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer
   302    302                   oWorkerHandler.xGCEWorker.postMessage(oRequest);
   303    303                   break;
   304    304               case "restartWorker":
   305         -                oWorkerHandler.restart(dParam["nDelayLimit"]);
          305  +                oWorkerHandler.restart(oParam["nDelayLimit"]);
   306    306                   break;
   307    307               case "openURL":
   308         -                browser.tabs.create({url: dParam.sURL});
          308  +                browser.tabs.create({url: oParam.sURL});
   309    309                   break;
   310    310               case "openConjugueurTab":
   311    311                   openConjugueurTab();
   312    312                   break;
   313    313               case "openConjugueurWindow":
   314    314                   openConjugueurWindow();
   315    315                   break;
................................................................................
   360    360           case "grammar_checker_iframe":
   361    361               sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.frameId);
   362    362               break;
   363    363           case "grammar_checker_selection":
   364    364               sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.selectionText);
   365    365               oWorkerHandler.xGCEWorker.postMessage({
   366    366                   sCommand: "parseAndSpellcheck",
   367         -                dParam: {sText: xInfo.selectionText, sCountry: "FR", bDebug: false, bContext: false},
   368         -                dInfo: {iReturnPort: xTab.id}
          367  +                oParam: {sText: xInfo.selectionText, sCountry: "FR", bDebug: false, bContext: false},
          368  +                oInfo: {iReturnPort: xTab.id}
   369    369               });
   370    370               break;
   371    371           // tools
   372    372           case "conjugueur_window":
   373    373               openConjugueurWindow();
   374    374               break;
   375    375           case "conjugueur_tab":
................................................................................
   440    440           dOptions = helpers.mapToObject(dOptions);
   441    441       }
   442    442       browser.storage.local.set({"gc_options": dOptions});
   443    443   }
   444    444   
   445    445   function sendCommandToTab (iTab, sCommand, result=null) {
   446    446       let xTabPort = dConnx.get(iTab);
   447         -    xTabPort.postMessage({sActionDone: sCommand, result: result, dInfo: null, bEnd: false, bError: false});
          447  +    xTabPort.postMessage({sActionDone: sCommand, result: result, oInfo: null, bEnd: false, bError: false});
   448    448   }
   449    449   
   450    450   function sendCommandToCurrentTab (sCommand) {
   451    451       if (bChrome) {
   452    452           browser.tabs.query({ currentWindow: true, active: true }, (lTabs) => {
   453    453               for (let xTab of lTabs) {
   454    454                   //console.log(xTab);
................................................................................
   463    463               browser.tabs.sendMessage(xTab.id, {sActionRequest: sCommand});
   464    464           }
   465    465       }, showError);
   466    466   }
   467    467   
   468    468   function sendCommandToAllTabs (sCommand) {
   469    469       for (let [iTab, xTabPort] of dConnx.entries()) {
   470         -        xTabPort.postMessage({sActionDone: sCommand, result: null, dInfo: null, bEnd: false, bError: false});
          470  +        xTabPort.postMessage({sActionDone: sCommand, result: null, oInfo: null, bEnd: false, bError: false});
   471    471       }
   472    472   }
   473    473   
   474    474   function openLexiconEditor (sName="__personal__") {
   475    475       if (nTabLexiconEditor === null) {
   476    476           if (bChrome) {
   477    477               browser.tabs.create({

Modified gc_lang/fr/webext/content_scripts/init.js from [39a18c330c] to [b745010b16].

   308    308   
   309    309       xConnect: browser.runtime.connect({name: "content-script port"}),
   310    310   
   311    311       /*
   312    312           Send messages to the background
   313    313           object {
   314    314               sCommand: the action to perform
   315         -            dParam: parameters necessary for the execution of the action
   316         -            dInfo: all kind of informations that needs to be sent back (usually to know where to use the result)
          315  +            oParam: parameters necessary for the execution of the action
          316  +            oInfo: all kind of informations that needs to be sent back (usually to know where to use the result)
   317    317           }
   318    318       */
   319    319       parseAndSpellcheck: function (sText, sDestination) {
   320    320           this.xConnect.postMessage({
   321    321               sCommand: "parseAndSpellcheck",
   322         -            dParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false },
   323         -            dInfo: { sDestination: sDestination }
          322  +            oParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false },
          323  +            oInfo: { sDestination: sDestination }
   324    324           });
   325    325       },
   326    326   
   327    327       parseAndSpellcheck1: function (sText, sDestination, sParagraphId) {
   328    328           this.xConnect.postMessage({
   329    329               sCommand: "parseAndSpellcheck1",
   330         -            dParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false },
   331         -            dInfo: { sDestination: sDestination, sParagraphId: sParagraphId }
          330  +            oParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false },
          331  +            oInfo: { sDestination: sDestination, sParagraphId: sParagraphId }
   332    332           });
   333    333       },
   334    334   
   335    335       getListOfTokens: function (sText) {
   336         -        this.xConnect.postMessage({ sCommand: "getListOfTokens", dParam: { sText: sText }, dInfo: {} });
          336  +        this.xConnect.postMessage({ sCommand: "getListOfTokens", oParam: { sText: sText }, oInfo: {} });
   337    337       },
   338    338   
   339    339       parseFull: function (sText) {
   340    340           this.xConnect.postMessage({
   341    341               sCommand: "parseFull",
   342         -            dParam: { sText: sTex, sCountry: "FR", bDebug: false, bContext: false },
   343         -            dInfo: {}
          342  +            oParam: { sText: sTex, sCountry: "FR", bDebug: false, bContext: false },
          343  +            oInfo: {}
   344    344           });
   345    345       },
   346    346   
   347    347       getVerb: function (sVerb, bStart=true, bPro=false, bNeg=false, bTpsCo=false, bInt=false, bFem=false) {
   348    348           this.xConnect.postMessage({
   349    349               sCommand: "getVerb",
   350         -            dParam: { sVerb: sVerb, bPro: bPro, bNeg: bNeg, bTpsCo: bTpsCo, bInt: bInt, bFem: bFem },
   351         -            dInfo: { bStart: bStart }
          350  +            oParam: { sVerb: sVerb, bPro: bPro, bNeg: bNeg, bTpsCo: bTpsCo, bInt: bInt, bFem: bFem },
          351  +            oInfo: { bStart: bStart }
   352    352           });
   353    353       },
   354    354   
   355    355       getSpellSuggestions: function (sWord, sDestination, sErrorId) {
   356         -        this.xConnect.postMessage({ sCommand: "getSpellSuggestions", dParam: { sWord: sWord }, dInfo: { sDestination: sDestination, sErrorId: sErrorId } });
          356  +        this.xConnect.postMessage({ sCommand: "getSpellSuggestions", oParam: { sWord: sWord }, oInfo: { sDestination: sDestination, sErrorId: sErrorId } });
   357    357       },
   358    358   
   359    359       openURL: function (sURL) {
   360         -        this.xConnect.postMessage({ sCommand: "openURL", dParam: { "sURL": sURL }, dInfo: null });
          360  +        this.xConnect.postMessage({ sCommand: "openURL", oParam: { "sURL": sURL }, oInfo: null });
   361    361       },
   362    362   
   363    363       openLexiconEditor: function () {
   364         -        this.xConnect.postMessage({ sCommand: "openLexiconEditor", dParam: null, dInfo: null });
          364  +        this.xConnect.postMessage({ sCommand: "openLexiconEditor", oParam: null, oInfo: null });
   365    365       },
   366    366   
   367    367       restartWorker: function (nTimeDelay=10) {
   368         -        this.xConnect.postMessage({ sCommand: "restartWorker", dParam: { "nTimeDelay": nTimeDelay }, dInfo: {} });
          368  +        this.xConnect.postMessage({ sCommand: "restartWorker", oParam: { "nTimeDelay": nTimeDelay }, oInfo: {} });
   369    369       },
   370    370   
   371    371       /*
   372    372           Messages from the background
   373    373       */
   374    374       listen: function () {
   375    375           this.xConnect.onMessage.addListener(function (oMessage) {
   376         -            let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
          376  +            let {sActionDone, result, oInfo, bEnd, bError} = oMessage;
   377    377               switch (sActionDone) {
   378    378                   case "init":
   379    379                       oGrammalecte.sExtensionUrl = oMessage.sUrl;
   380    380                       oGrammalecte.listenRightClick();
   381    381                       oGrammalecte.createButtons();
   382    382                       oGrammalecte.observePage();
   383    383                       break;
   384    384                   case "parseAndSpellcheck":
   385         -                    if (dInfo.sDestination == "__GrammalectePanel__") {
          385  +                    if (oInfo.sDestination == "__GrammalectePanel__") {
   386    386                           if (!bEnd) {
   387    387                               oGrammalecte.oGCPanel.addParagraphResult(result);
   388    388                           } else {
   389    389                               oGrammalecte.oGCPanel.stopWaitIcon();
   390    390                               oGrammalecte.oGCPanel.endTimer();
   391    391                           }
   392    392                       }
   393         -                    else if (dInfo.sDestination  &&  document.getElementById(dInfo.sDestination)) {
   394         -                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "errors", oResult: result, oInfo: dInfo }) });
   395         -                        document.getElementById(dInfo.sDestination).dispatchEvent(xEvent);
          393  +                    else if (oInfo.sDestination  &&  document.getElementById(oInfo.sDestination)) {
          394  +                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "errors", oResult: result, oInfo: oInfo }) });
          395  +                        document.getElementById(oInfo.sDestination).dispatchEvent(xEvent);
   396    396                       }
   397    397                       break;
   398    398                   case "parseAndSpellcheck1":
   399         -                    if (dInfo.sDestination == "__GrammalectePanel__") {
   400         -                        oGrammalecte.oGCPanel.refreshParagraph(dInfo.sParagraphId, result);
          399  +                    if (oInfo.sDestination == "__GrammalectePanel__") {
          400  +                        oGrammalecte.oGCPanel.refreshParagraph(oInfo.sParagraphId, result);
   401    401                       }
   402    402                       break;
   403    403                   case "parseFull":
   404    404                       // TODO
   405    405                       break;
   406    406                   case "getListOfTokens":
   407    407                       if (!bEnd) {
................................................................................
   408    408                           oGrammalecte.oGCPanel.addListOfTokens(result);
   409    409                       } else {
   410    410                           oGrammalecte.oGCPanel.stopWaitIcon();
   411    411                           oGrammalecte.oGCPanel.endTimer();
   412    412                       }
   413    413                       break;
   414    414                   case "getSpellSuggestions":
   415         -                    if (dInfo.sDestination == "__GrammalectePanel__") {
   416         -                        oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId);
          415  +                    if (oInfo.sDestination == "__GrammalectePanel__") {
          416  +                        oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, oInfo.sErrorId);
   417    417                       }
   418         -                    else if (dInfo.sDestination  &&  document.getElementById(dInfo.sDestination)) {
   419         -                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "spellsugg", oResult: result, oInfo: dInfo }) });
   420         -                        document.getElementById(dInfo.sDestination).dispatchEvent(xEvent);
          418  +                    else if (oInfo.sDestination  &&  document.getElementById(oInfo.sDestination)) {
          419  +                        const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "spellsugg", oResult: result, oInfo: oInfo }) });
          420  +                        document.getElementById(oInfo.sDestination).dispatchEvent(xEvent);
   421    421                       }
   422    422                       break;
   423    423                   case "getVerb":
   424         -                    if (dInfo.bStart) {
          424  +                    if (oInfo.bStart) {
   425    425                           oGrammalecte.oGCPanel.conjugateWith(result.oVerb, result.oConjTable);
   426    426                       } else {
   427    427                           oGrammalecte.oGCPanel.displayConj(result.oConjTable);
   428    428                       }
   429    429                       break;
   430    430                   case "workerRestarted":
   431    431                       oGrammalecte.oGCPanel.stopWaitIcon();

Modified gc_lang/fr/webext/gce_worker.js from [1361b7ed42] to [2a88013ffc].

    54     54       Warning.
    55     55       Initialization can’t be completed at startup of the worker,
    56     56       for we need the path of the extension to load data stored in JSON files.
    57     57       This path is retrieved in background.js and passed with the event “init”.
    58     58   */
    59     59   
    60     60   
    61         -function createResponse (sActionDone, result, dInfo, bEnd, bError=false) {
           61  +function createResponse (sActionDone, result, oInfo, bEnd, bError=false) {
    62     62       return {
    63     63           "sActionDone": sActionDone,
    64     64           "result": result, // can be of any type
    65         -        "dInfo": dInfo,
           65  +        "oInfo": oInfo,
    66     66           "bEnd": bEnd,
    67     67           "bError": bError
    68     68       };
    69     69   }
    70     70   
    71     71   function createErrorResult (e, sDescr="no description") {
    72     72       return {
................................................................................
    85     85   
    86     86   
    87     87   /*
    88     88       Message Event Object
    89     89       https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
    90     90   */
    91     91   onmessage = function (e) {
    92         -    let {sCommand, dParam, dInfo} = e.data;
           92  +    let {sCommand, oParam, oInfo} = e.data;
    93     93       switch (sCommand) {
    94     94           case "init":
    95         -            init(dParam.sExtensionPath, dParam.dOptions, dParam.sContext, dInfo);
           95  +            init(oParam.sExtensionPath, oParam.dOptions, oParam.sContext, oInfo);
    96     96               break;
    97     97           case "parse":
    98         -            parse(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
           98  +            parse(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
    99     99               break;
   100    100           case "parseAndSpellcheck":
   101         -            parseAndSpellcheck(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          101  +            parseAndSpellcheck(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   102    102               break;
   103    103           case "parseAndSpellcheck1":
   104         -            parseAndSpellcheck1(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          104  +            parseAndSpellcheck1(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   105    105               break;
   106    106           case "parseFull":
   107         -            parseFull(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          107  +            parseFull(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   108    108               break;
   109    109           case "getListOfTokens":
   110         -            getListOfTokens(dParam.sText, dInfo);
          110  +            getListOfTokens(oParam.sText, oInfo);
   111    111               break;
   112    112           case "getOptions":
   113         -            getOptions(dInfo);
          113  +            getOptions(oInfo);
   114    114               break;
   115    115           case "getDefaultOptions":
   116         -            getDefaultOptions(dInfo);
          116  +            getDefaultOptions(oInfo);
   117    117               break;
   118    118           case "setOptions":
   119         -            setOptions(dParam.sOptions, dInfo);
          119  +            setOptions(oParam.sOptions, oInfo);
   120    120               break;
   121    121           case "setOption":
   122         -            setOption(dParam.sOptName, dParam.bValue, dInfo);
          122  +            setOption(oParam.sOptName, oParam.bValue, oInfo);
   123    123               break;
   124    124           case "resetOptions":
   125         -            resetOptions(dInfo);
          125  +            resetOptions(oInfo);
   126    126               break;
   127    127           case "textToTest":
   128         -            textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
          128  +            textToTest(oParam.sText, oParam.sCountry, oParam.bDebug, oParam.bContext, oInfo);
   129    129               break;
   130    130           case "fullTests":
   131         -            fullTests(dInfo);
          131  +            fullTests(oInfo);
   132    132               break;
   133    133           case "setDictionary":
   134         -            setDictionary(dParam.sDictionary, dParam.oDict, dInfo);
          134  +            setDictionary(oParam.sDictionary, oParam.oDict, oInfo);
   135    135               break;
   136    136           case "setDictionaryOnOff":
   137         -            setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo);
          137  +            setDictionaryOnOff(oParam.sDictionary, oParam.bActivate, oInfo);
   138    138               break;
   139    139           case "getSpellSuggestions":
   140         -            getSpellSuggestions(dParam.sWord, dInfo);
          140  +            getSpellSuggestions(oParam.sWord, oInfo);
   141    141               break;
   142    142           case "getVerb":
   143         -            getVerb(dParam.sVerb, dParam.bPro, dParam.bNeg, dParam.bTpsCo, dParam.bInt, dParam.bFem, dInfo);
          143  +            getVerb(oParam.sVerb, oParam.bPro, oParam.bNeg, oParam.bTpsCo, oParam.bInt, oParam.bFem, oInfo);
   144    144               break;
   145    145           default:
   146    146               console.log("[Worker] Unknown command: " + sCommand);
   147    147               showData(e.data);
   148    148       }
   149    149   }
   150    150   
................................................................................
   164    164       This worker don’t work as a PromiseWorker (which returns a promise),  so when we send request
   165    165       to this worker, we can’t wait the return of the answer just after the request made.
   166    166       The answer is received by the background in another function (onmessage).
   167    167       That’s why the full text to analyze is send in one block, but analyse is returned paragraph
   168    168       by paragraph.
   169    169   */
   170    170   
   171         -function init (sExtensionPath, dOptions=null, sContext="JavaScript", dInfo={}) {
          171  +function init (sExtensionPath, dOptions=null, sContext="JavaScript", oInfo={}) {
   172    172       try {
   173    173           if (!bInitDone) {
   174    174               //console.log("[Worker] Loading… Extension path: " + sExtensionPath);
   175    175               conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json"));
   176    176               phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json"));
   177    177               mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json"));
   178    178               //console.log("[Worker] Modules have been initialized…");
................................................................................
   191    191               //tests();
   192    192               bInitDone = true;
   193    193           } else {
   194    194               console.log("[Worker] Already initialized…")
   195    195           }
   196    196           // we always retrieve options from the gc_engine, for setOptions filters obsolete options
   197    197           dOptions = helpers.mapToObject(gc_engine.getOptions());
   198         -        postMessage(createResponse("init", dOptions, dInfo, true));
          198  +        postMessage(createResponse("init", dOptions, oInfo, true));
   199    199       }
   200    200       catch (e) {
   201    201           console.error(e);
   202         -        postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true));
          202  +        postMessage(createResponse("init", createErrorResult(e, "init failed"), oInfo, true, true));
   203    203       }
   204    204   }
   205    205   
   206    206   
   207         -function parse (sText, sCountry, bDebug, bContext, dInfo={}) {
          207  +function parse (sText, sCountry, bDebug, bContext, oInfo={}) {
   208    208       sText = sText.replace(/­/g, "").normalize("NFC");
   209    209       for (let sParagraph of text.getParagraph(sText)) {
   210    210           let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext);
   211         -        postMessage(createResponse("parse", aGrammErr, dInfo, false));
          211  +        postMessage(createResponse("parse", aGrammErr, oInfo, false));
   212    212       }
   213         -    postMessage(createResponse("parse", null, dInfo, true));
          213  +    postMessage(createResponse("parse", null, oInfo, true));
   214    214   }
   215    215   
   216         -function parseAndSpellcheck (sText, sCountry, bDebug, bContext, dInfo={}) {
          216  +function parseAndSpellcheck (sText, sCountry, bDebug, bContext, oInfo={}) {
   217    217       let i = 0;
   218    218       sText = sText.replace(/­/g, "").normalize("NFC");
   219    219       for (let sParagraph of text.getParagraph(sText)) {
   220    220           let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext);
   221    221           let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
   222         -        postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, false));
          222  +        postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, false));
   223    223           i += 1;
   224    224       }
   225         -    postMessage(createResponse("parseAndSpellcheck", null, dInfo, true));
          225  +    postMessage(createResponse("parseAndSpellcheck", null, oInfo, true));
   226    226   }
   227    227   
   228         -function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, dInfo={}) {
          228  +function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, oInfo={}) {
   229    229       sParagraph = sParagraph.replace(/­/g, "").normalize("NFC");
   230    230       let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext);
   231    231       let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
   232         -    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true));
          232  +    postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, true));
   233    233   }
   234    234   
   235         -function parseFull (sText, sCountry, bDebug, bContext, dInfo={}) {
          235  +function parseFull (sText, sCountry, bDebug, bContext, oInfo={}) {
   236    236       let i = 0;
   237    237       sText = sText.replace(/­/g, "").normalize("NFC");
   238    238       for (let sParagraph of text.getParagraph(sText)) {
   239    239           let lSentence = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext, true);
   240    240           console.log("*", lSentence);
   241         -        postMessage(createResponse("parseFull", {sParagraph: sParagraph, iParaNum: i, lSentence: lSentence}, dInfo, false));
          241  +        postMessage(createResponse("parseFull", {sParagraph: sParagraph, iParaNum: i, lSentence: lSentence}, oInfo, false));
   242    242           i += 1;
   243    243       }
   244         -    postMessage(createResponse("parseFull", null, dInfo, true));
          244  +    postMessage(createResponse("parseFull", null, oInfo, true));
   245    245   }
   246    246   
   247         -function getListOfTokens (sText, dInfo={}) {
          247  +function getListOfTokens (sText, oInfo={}) {
   248    248       // lexicographer
   249    249       try {
   250    250           sText = sText.replace(/­/g, "").normalize("NFC");
   251    251           for (let sParagraph of text.getParagraph(sText)) {
   252    252               if (sParagraph.trim() !== "") {
   253         -                postMessage(createResponse("getListOfTokens", oLxg.getListOfTokensReduc(sParagraph, true), dInfo, false));
          253  +                postMessage(createResponse("getListOfTokens", oLxg.getListOfTokensReduc(sParagraph, true), oInfo, false));
   254    254               }
   255    255           }
   256         -        postMessage(createResponse("getListOfTokens", null, dInfo, true));
          256  +        postMessage(createResponse("getListOfTokens", null, oInfo, true));
   257    257       }
   258    258       catch (e) {
   259    259           console.error(e);
   260         -        postMessage(createResponse("getListOfTokens", createErrorResult(e, "no tokens"), dInfo, true, true));
          260  +        postMessage(createResponse("getListOfTokens", createErrorResult(e, "no tokens"), oInfo, true, true));
   261    261       }
   262    262   }
          263  +
          264  +function getOptions (oInfo={}) {
          265  +    let dOptions = helpers.mapToObject(gc_engine.getOptions());
          266  +    postMessage(createResponse("getOptions", dOptions, oInfo, true));
          267  +}
   263    268   
   264         -function getOptions (dInfo={}) {
   265         -    let dOptions = helpers.mapToObject(gc_engine.getOptions());
   266         -    postMessage(createResponse("getOptions", dOptions, dInfo, true));
          269  +function getDefaultOptions (oInfo={}) {
          270  +    let dOptions = helpers.mapToObject(gc_engine.getDefaultOptions());
          271  +    postMessage(createResponse("getDefaultOptions", dOptions, oInfo, true));
   267    272   }
   268    273   
   269         -function getDefaultOptions (dInfo={}) {
   270         -    let dOptions = helpers.mapToObject(gc_engine.getDefaultOptions());
   271         -    postMessage(createResponse("getDefaultOptions", dOptions, dInfo, true));
   272         -}
   273         -
   274         -function setOptions (dOptions, dInfo={}) {
          274  +function setOptions (dOptions, oInfo={}) {
   275    275       if (!(dOptions instanceof Map)) {
   276    276           dOptions = helpers.objectToMap(dOptions);
   277    277       }
   278    278       gc_engine.setOptions(dOptions);
   279    279       dOptions = helpers.mapToObject(gc_engine.getOptions());
   280         -    postMessage(createResponse("setOptions", dOptions, dInfo, true));
          280  +    postMessage(createResponse("setOptions", dOptions, oInfo, true));
   281    281   }
   282    282   
   283         -function setOption (sOptName, bValue, dInfo={}) {
          283  +function setOption (sOptName, bValue, oInfo={}) {
   284    284       console.log(sOptName+": "+bValue);
   285    285       if (sOptName) {
   286    286           gc_engine.setOption(sOptName, bValue);
   287    287           let dOptions = helpers.mapToObject(gc_engine.getOptions());
   288         -        postMessage(createResponse("setOption", dOptions, dInfo, true));
          288  +        postMessage(createResponse("setOption", dOptions, oInfo, true));
   289    289       }
   290    290   }
   291    291   
   292         -function resetOptions (dInfo={}) {
          292  +function resetOptions (oInfo={}) {
   293    293       gc_engine.resetOptions();
   294    294       let dOptions = helpers.mapToObject(gc_engine.getOptions());
   295         -    postMessage(createResponse("resetOptions", dOptions, dInfo, true));
          295  +    postMessage(createResponse("resetOptions", dOptions, oInfo, true));
   296    296   }
   297    297   
   298    298   function tests () {
   299    299       console.log(conj.getConj("devenir", ":E", ":2s"));
   300    300       console.log(mfsp.getMasForm("emmerdeuse", true));
   301    301       console.log(mfsp.getMasForm("pointilleuse", false));
   302    302       console.log(phonet.getSimil("est"));
   303    303       let aRes = gc_engine.parse("Je suit...");
   304    304       for (let oErr of aRes) {
   305    305           console.log(text.getReadableError(oErr));
   306    306       }
   307    307   }
   308    308   
   309         -function textToTest (sText, sCountry, bDebug, bContext, dInfo={}) {
          309  +function textToTest (sText, sCountry, bDebug, bContext, oInfo={}) {
   310    310       if (!gc_engine) {
   311         -        postMessage(createResponse("textToTest", "# Grammar checker not loaded.", dInfo, true));
          311  +        postMessage(createResponse("textToTest", "# Grammar checker not loaded.", oInfo, true));
   312    312           return;
   313    313       }
   314    314       sText = sText.replace(/­/g, "").normalize("NFC");
   315    315       let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext);
   316    316       let sMsg = "";
   317    317       for (let oErr of aGrammErr) {
   318    318           sMsg += text.getReadableError(oErr) + "\n";
   319    319       }
   320    320       if (sMsg == "") {
   321    321           sMsg =  "Aucune erreur détectée.";
   322    322       }
   323         -    postMessage(createResponse("textToTest", sMsg, dInfo, true));
          323  +    postMessage(createResponse("textToTest", sMsg, oInfo, true));
   324    324   }
   325    325   
   326         -function fullTests (dInfo={}) {
          326  +function fullTests (oInfo={}) {
   327    327       if (!gc_engine) {
   328         -        postMessage(createResponse("fullTests", "# Grammar checker not loaded.", dInfo, true));
          328  +        postMessage(createResponse("fullTests", "# Grammar checker not loaded.", oInfo, true));
   329    329           return;
   330    330       }
   331    331       let dMemoOptions = gc_engine.getOptions();
   332    332       let dTestOptions = gc_engine.getDefaultOptions();
   333    333       dTestOptions.set("nbsp", true);
   334    334       dTestOptions.set("esp", true);
   335    335       dTestOptions.set("unit", true);
................................................................................
   337    337       gc_engine.setOptions(dTestOptions);
   338    338       let sMsg = "";
   339    339       for (let sRes of oTest.testParse()) {
   340    340           sMsg += sRes + "\n";
   341    341           console.log(sRes);
   342    342       }
   343    343       gc_engine.setOptions(dMemoOptions);
   344         -    postMessage(createResponse("fullTests", sMsg, dInfo, true));
          344  +    postMessage(createResponse("fullTests", sMsg, oInfo, true));
   345    345   }
   346    346   
   347    347   
   348    348   // SpellChecker
   349    349   
   350         -function setDictionary (sDictionary, oDict, dInfo) {
          350  +function setDictionary (sDictionary, oDict, oInfo) {
   351    351       if (!oSpellChecker) {
   352         -        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
          352  +        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", oInfo, true));
   353    353           return;
   354    354       }
   355    355       //console.log("setDictionary", sDictionary);
   356    356       switch (sDictionary) {
   357    357           case "main":
   358         -            oSpellChecker.setMainDictionary(oDict, dInfo["sExtPath"]+"/grammalecte/graphspell/_dictionaries");
          358  +            oSpellChecker.setMainDictionary(oDict, oInfo["sExtPath"]+"/grammalecte/graphspell/_dictionaries");
   359    359               break;
   360    360           case "community":
   361    361               oSpellChecker.setCommunityDictionary(oDict);
   362    362               break;
   363    363           case "personal":
   364    364               oSpellChecker.setPersonalDictionary(oDict);
   365    365               break;
   366    366           default:
   367    367               console.log("[worker] setDictionary: Unknown dictionary <"+sDictionary+">");
   368    368       }
   369         -    postMessage(createResponse("setDictionary", true, dInfo, true));
          369  +    postMessage(createResponse("setDictionary", true, oInfo, true));
   370    370   }
   371    371   
   372         -function setDictionaryOnOff (sDictionary, bActivate, dInfo) {
          372  +function setDictionaryOnOff (sDictionary, bActivate, oInfo) {
   373    373       if (!oSpellChecker) {
   374         -        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
          374  +        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", oInfo, true));
   375    375           return;
   376    376       }
   377    377       //console.log("setDictionaryOnOff", sDictionary, bActivate);
   378    378       switch (sDictionary) {
   379    379           case "community":
   380    380               if (bActivate) {
   381    381                   oSpellChecker.activateCommunityDictionary();
................................................................................
   389    389               } else {
   390    390                   oSpellChecker.deactivatePersonalDictionary();
   391    391               }
   392    392               break;
   393    393           default:
   394    394               console.log("[worker] setDictionaryOnOff: Unknown dictionary <"+sDictionary+">");
   395    395       }
   396         -    postMessage(createResponse("setDictionaryOnOff", true, dInfo, true));
          396  +    postMessage(createResponse("setDictionaryOnOff", true, oInfo, true));
   397    397   }
   398    398   
   399         -function getSpellSuggestions (sWord, dInfo) {
          399  +function getSpellSuggestions (sWord, oInfo) {
   400    400       if (!oSpellChecker) {
   401         -        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true));
          401  +        postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", oInfo, true));
   402    402           return;
   403    403       }
   404    404       let i = 0;
   405    405       for (let aSugg of oSpellChecker.suggest(sWord)) {
   406         -        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
          406  +        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, oInfo, true));
   407    407           i += 1;
   408    408       }
   409    409   }
   410    410   
   411    411   
   412    412   // Conjugueur
   413    413   
   414         -function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, dInfo) {
          414  +function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, oInfo) {
   415    415       try {
   416    416           let oVerb = null;
   417    417           let oConjTable = null;
   418    418           if (conj.isVerb(sWord)) {
   419    419               oVerb = new Verb(sWord);
   420    420               oConjTable = oVerb.createConjTable(bPro, bNeg, bTpsCo, bInt, bFem);
   421    421           }
   422         -        postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, dInfo, true));
          422  +        postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, oInfo, true));
   423    423       }
   424    424       catch (e) {
   425    425           console.error(e);
   426         -        postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), dInfo, true, true));
          426  +        postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), oInfo, true, true));
   427    427       }
   428    428   }

Modified gc_lang/fr/webext/panel/dictionaries.js from [185528ef06] to [a0f430df19].

   423    423           for (let sName of this.dSelectedDictionaries.keys()) {
   424    424               lDict.push(this.dDict.get(sName));
   425    425           }
   426    426           let oDict = dic_merger.merge(lDict, "S", "fr", "Français", "fr.community", "Dictionnaire communautaire (personnalisé)", this.xProgressBar);
   427    427           console.log(oDict);
   428    428           browser.storage.local.set({ "community_dictionary": oDict });
   429    429           browser.storage.local.set({ "selected_dictionaries_list": Array.from(this.dSelectedDictionaries.keys()) });
   430         -        browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "community", oDict: oDict}, dInfo: {} });
          430  +        browser.runtime.sendMessage({ sCommand: "setDictionary", oParam: {sDictionary: "community", oDict: oDict}, oInfo: {} });
   431    431       }
   432    432   }
   433    433   
   434    434   const oDicTable = new Table("dictionaries_table", ["Nom", "Entrées", "Description", "Date"], "wait_progress", "num_dic", false, true);
   435    435   
   436    436   oDicTable.init();
   437    437   
   438    438   oMessage.listen();
   439    439   
   440    440   oConnect.init();
   441    441   oConnect.listen();

Modified gc_lang/fr/webext/panel/lex_editor.js from [a72eb5ad85] to [621914c742].

   589    589   
   590    590       saveDictionary: function (sName, oJSON) {
   591    591           if (!sName) {
   592    592               console.log("Error: name of dictionary to save is empty.")
   593    593               return;
   594    594           }
   595    595           if (sName == "__personal__") {
   596         -            browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sDictionary: "personal", oDict: oJSON}, dInfo: {} });
          596  +            browser.runtime.sendMessage({ sCommand: "setDictionary", oParam: {sDictionary: "personal", oDict: oJSON}, oInfo: {} });
   597    597               browser.storage.local.set({ "personal_dictionary": oJSON });
   598    598           }
   599    599           else {
   600    600               this.oDictionaries[sName] = oJSON;
   601    601               if (oJSON === null) {
   602    602                   delete this.oDictionaries[sName];
   603    603               }

Modified gc_lang/fr/webext/panel/main.js from [56de373e52] to [0cb6672536].

    24     24       function (xEvent) {
    25     25           let xElem = xEvent.target;
    26     26           if (xElem.id) {
    27     27               // tests
    28     28               if (xElem.id === "text_to_test_button") {
    29     29                   browser.runtime.sendMessage({
    30     30                       sCommand: "textToTest",
    31         -                    dParam: {sText: document.getElementById("text_to_test").value, sCountry: "FR", bDebug: true, bContext: false},
    32         -                    dInfo: {}
           31  +                    oParam: {sText: document.getElementById("text_to_test").value, sCountry: "FR", bDebug: true, bContext: false},
           32  +                    oInfo: {}
    33     33                   });
    34     34               }
    35     35               else if (xElem.id === "fulltests_button") {
    36     36                   document.getElementById("tests_result").textContent = "Veuillez patienter…";
    37     37                   browser.runtime.sendMessage({
    38     38                       sCommand: "fullTests",
    39         -                    dParam: {},
    40         -                    dInfo: {}
           39  +                    oParam: {},
           40  +                    oInfo: {}
    41     41                   });
    42     42               }
    43     43               else if (xElem.id == "restart_worker") {
    44     44                   browser.runtime.sendMessage({
    45     45                       sCommand: "restartWorker",
    46         -                    dParam: { "nDelayLimit": 3 },
    47         -                    dInfo: {}
           46  +                    oParam: { "nDelayLimit": 3 },
           47  +                    oInfo: {}
    48     48                   });
    49     49               }
    50     50               // grammar options
    51     51               else if (xElem.id === "default_options_button") {
    52     52                   browser.runtime.sendMessage({
    53     53                      sCommand: "resetOptions",
    54         -                   dParam: {},
    55         -                   dInfo: {}
           54  +                   oParam: {},
           55  +                   oInfo: {}
    56     56                   });
    57     57               }
    58     58               else if (xElem.id.startsWith("option_")) {
    59     59                   if (xElem.dataset.option) {
    60     60                       browser.runtime.sendMessage({
    61     61                           sCommand: "setOption",
    62         -                        dParam: {sOptName: xElem.dataset.option, bValue: xElem.checked},
    63         -                        dInfo: {}
           62  +                        oParam: {sOptName: xElem.dataset.option, bValue: xElem.checked},
           63  +                        oInfo: {}
    64     64                       });
    65     65                   }
    66     66               }
    67     67               // dictionaries options
    68     68               else if (xElem.id.endsWith("_dic")) {
    69     69                   if (xElem.dataset.dictionary) {
    70     70                       storeSCOptions();
    71     71                       browser.runtime.sendMessage({
    72     72                           sCommand: "setDictionaryOnOff",
    73         -                        dParam: {sDictionary: xElem.dataset.dictionary, bActivate: xElem.checked},
    74         -                        dInfo: {}
           73  +                        oParam: {sDictionary: xElem.dataset.dictionary, bActivate: xElem.checked},
           74  +                        oInfo: {}
    75     75                       });
    76     76                   }
    77     77               }
    78     78               else if (xElem.id.startsWith("spelling_")) {
    79     79                   updateSpellingChoiceUI(xElem.id);
    80     80                   let sMainDicName = document.getElementById(xElem.id).dataset.dicname;
    81     81                   browser.storage.local.set({"main_dic_name": sMainDicName});
    82     82                   browser.runtime.sendMessage({
    83     83                       sCommand: "setDictionary",
    84         -                    dParam: { sDictionary: "main", oDict: sMainDicName },
    85         -                    dInfo: { sExtPath: browser.extension.getURL("") }
           84  +                    oParam: { sDictionary: "main", oDict: sMainDicName },
           85  +                    oInfo: { sExtPath: browser.extension.getURL("") }
    86     86                   });
    87     87               }
    88     88               // UI options
    89     89               else if (xElem.id.startsWith("ui_option_")) {
    90     90                   storeUIOptions();
    91     91               }
    92     92               //
    93     93               else if (xElem.id.startsWith("link_")) {
    94     94                   browser.tabs.create({url: xElem.dataset.url});
    95     95               }
    96     96               else if (xElem.id == "conj_button") {
    97     97                   browser.runtime.sendMessage({
    98     98                       sCommand: "openConjugueurTab",
    99         -                    dParam: {},
   100         -                    dInfo: {}
           99  +                    oParam: {},
          100  +                    oInfo: {}
   101    101                   });
   102    102               }
   103    103               else if (xElem.id == "dictionaries_button") {
   104    104                   browser.runtime.sendMessage({
   105    105                       sCommand: "openDictionaries",
   106         -                    dParam: {},
   107         -                    dInfo: {}
          106  +                    oParam: {},
          107  +                    oInfo: {}
   108    108                   });
   109    109               }
   110    110               else if (xElem.id == "dic_community_button") {
   111    111                   browser.runtime.sendMessage({
   112    112                       sCommand: "openLexiconEditor",
   113         -                    dParam: { "dictionary": "__community__"},
   114         -                    dInfo: {}
          113  +                    oParam: { "dictionary": "__community__"},
          114  +                    oInfo: {}
   115    115                   });
   116    116               }
   117    117               else if (xElem.id == "dic_personal_button") {
   118    118                   browser.runtime.sendMessage({
   119    119                       sCommand: "openLexiconEditor",
   120         -                    dParam: { "dictionary": "__personal__"},
   121         -                    dInfo: {}
          120  +                    oParam: { "dictionary": "__personal__"},
          121  +                    oInfo: {}
   122    122                   });
   123    123               }
   124    124           // change UI page
   125    125           } else if (xElem.className.startsWith("select")) {
   126    126               showPage(xElem.dataset.page);
   127    127           }/* else if (xElem.tagName === "A") {
   128    128               openURL(xElem.getAttribute("href"));
................................................................................
   152    152   }
   153    153   
   154    154   
   155    155   /*
   156    156       Messages received
   157    157   */
   158    158   function handleMessage (oMessage, xSender, sendResponse) {
   159         -    let {sActionDone, result, dInfo, bEnd, bError} = oMessage;
          159  +    let {sActionDone, result, oInfo, bEnd, bError} = oMessage;
   160    160       switch(sActionDone) {
   161    161           case "textToTest":
   162    162           case "fullTests":
   163    163               showTestResult(result);
   164    164               break;
   165    165           case "resetOptions":
   166    166               displayGCOptions(result);