Grammalecte  Check-in [9328b22957]

Overview
Comment:[tb] rename variable to avoid collision with another extension
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | tb
Files: files | file ages | folders
SHA3-256: 9328b22957b5ed4d6b1bc605b7b7e4dbaa565acc6007b942af37d0605308d134
User & Date: olr on 2020-03-31 20:29:34
Other Links: manifest | tags
Context
2020-03-31
20:41
[tb] rename variable to avoid collision with another extension check-in: 6f5fe30fdc user: olr tags: tb, trunk
20:29
[tb] rename variable to avoid collision with another extension check-in: 9328b22957 user: olr tags: tb, trunk
20:26
[fr] faux positif et ajustements check-in: 2d9eedba4c user: olr tags: fr, trunk
Changes

Modified gc_lang/fr/mailext/content/overlay.js from [382be936c1] to [4e5a5c3792].

     5      5   
     6      6   const Cc = Components.classes;
     7      7   const Ci = Components.interfaces;
     8      8   //const Cu = Components.utils;
     9      9   //const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {});
    10     10   
    11     11   const { BasePromiseWorker } = ChromeUtils.import('resource://gre/modules/PromiseWorker.jsm', {});
    12         -const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");
           12  +const xGrammalectePrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");
    13     13   
    14     14   //const text = require("resource://grammalecte/text.js");
    15     15   //const tf = require("resource://grammalecte/fr/textformatter.js");
    16     16   
    17     17   
    18     18   const oConverterToExponent = {
    19     19       dNumbers: new Map ([
................................................................................
    35     35       xGCEWorker: null,
    36     36       loadGC: function () {
    37     37           if (this.xGCEWorker === null) {
    38     38               // Grammar checker
    39     39               console.log('Loading Grammalecte');
    40     40               this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
    41     41               let that = this;
    42         -            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]);
           42  +            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [xGrammalectePrefs.getCharPref("sGCOptions"), "Thunderbird"]);
    43     43               xPromise.then(
    44     44                   function (aVal) {
    45     45                       console.log(aVal);
    46         -                    prefs.setCharPref("sGCOptions", aVal);
           46  +                    xGrammalectePrefs.setCharPref("sGCOptions", aVal);
    47     47                       // spelling dictionary
    48         -                    if (prefs.getCharPref("sMainDicName")) {
    49         -                        let sMainDicName = prefs.getCharPref("sMainDicName");
           48  +                    if (xGrammalectePrefs.getCharPref("sMainDicName")) {
           49  +                        let sMainDicName = xGrammalectePrefs.getCharPref("sMainDicName");
    50     50                           if (sMainDicName == "fr-classic.json" || sMainDicName == "fr-reform.json") {
    51     51                               that.xGCEWorker.post("setDictionary", ["main", sMainDicName]);
    52     52                           }
    53     53                       }
    54     54                       // personal dictionary
    55         -                    if (prefs.getBoolPref("bPersonalDictionary")) {
           55  +                    if (xGrammalectePrefs.getBoolPref("bPersonalDictionary")) {
    56     56                           let sDicJSON = oFileHandler.loadFile("fr.personal.json");
    57     57                           if (sDicJSON) {
    58     58                               that.xGCEWorker.post('setDictionary', ["personal", sDicJSON]);
    59     59                           }
    60     60                       }
    61     61                   },
    62     62                   function (aReason) { console.log('Promise rejected - ', aReason); }
................................................................................
    95     95               function (aReason) { console.log('Promise rejected', aReason); }
    96     96           ).catch(
    97     97               function (aCaught) { console.log('Promise Error', aCaught); }
    98     98           );
    99     99       },
   100    100       setOptions: function () {
   101    101           console.log('Set options');
   102         -        let xPromise = this.xGCEWorker.post('setOptions', [prefs.getCharPref("sGCOptions")]);
          102  +        let xPromise = this.xGCEWorker.post('setOptions', [xGrammalectePrefs.getCharPref("sGCOptions")]);
   103    103           xPromise.then(
   104    104               function (aVal) {
   105    105                   console.log(aVal);
   106         -                prefs.setCharPref("sGCOptions", aVal);
          106  +                xGrammalectePrefs.setCharPref("sGCOptions", aVal);
   107    107               },
   108    108               function (aReason) { console.log('Promise rejected', aReason); }
   109    109           ).catch(
   110    110               function (aCaught) { console.log('Promise Error', aCaught); }
   111    111           );
   112    112       },
   113    113       resetOptions: function () {
   114    114           let xPromise = this.xGCEWorker.post('resetOptions');
   115    115           xPromise.then(
   116    116               function (aVal) {
   117    117                   console.log(aVal);
   118         -                prefs.setCharPref("sGCOptions", aVal);
          118  +                xGrammalectePrefs.setCharPref("sGCOptions", aVal);
   119    119               },
   120    120               function (aReason) { console.log('Promise rejected', aReason); }
   121    121           ).catch(
   122    122               function (aCaught) { console.log('Promise Error', aCaught); }
   123    123           );
   124    124       },
   125    125       parse: async function () {
................................................................................
   442    442       },
   443    443       onOpenGCOptions: function (e) {
   444    444           let that = this;
   445    445           let xPromise = this.xGCEWorker.post('getDefaultOptions');
   446    446           xPromise.then(
   447    447               function (aVal) {
   448    448                   console.log(aVal);
   449         -                prefs.setCharPref("sGCDefaultOptions", aVal);
          449  +                xGrammalectePrefs.setCharPref("sGCDefaultOptions", aVal);
   450    450               },
   451    451               function (aReason) { console.log('Promise rejected', aReason); }
   452    452           ).catch(
   453    453               function (aCaught) { console.log('Promise Error', aCaught); }
   454    454           ).then(
   455    455               function () {
   456    456                   that.openDialog("chrome://grammarchecker/content/gc_options.xul", "", "chrome, dialog, modal, resizable=no");
................................................................................
   483    483   
   484    484   
   485    485   var oTextFormatter = {
   486    486       init: function () {
   487    487           try {
   488    488               this.closePanel();
   489    489               this.listen();
   490         -            let sTFOptions = prefs.getCharPref("sTFOptions");
          490  +            let sTFOptions = xGrammalectePrefs.getCharPref("sTFOptions");
   491    491               if (sTFOptions !== "") {
   492    492                   this.setOptionsInPanel(JSON.parse(sTFOptions));
   493    493                   this.resetProgressBar();
   494    494               } else {
   495    495                   this.reset();
   496    496               }
   497    497           }
................................................................................
   527    527       },
   528    528       saveOptions: function () {
   529    529           let oOptions = {};
   530    530           for (let xNode of document.getElementsByClassName("option")) {
   531    531               oOptions[xNode.id] = xNode.checked;
   532    532           }
   533    533           //console.log("save options: " + JSON.stringify(oOptions));
   534         -        prefs.setCharPref("sTFOptions", JSON.stringify(oOptions));
          534  +        xGrammalectePrefs.setCharPref("sTFOptions", JSON.stringify(oOptions));
   535    535       },
   536    536       setOptionsInPanel: function (oOptions) {
   537    537           for (let sOptName in oOptions) {
   538    538               //console.log(sOptName + ":" + oOptions[sOptName]);
   539    539               if (document.getElementById(sOptName) !== null) {
   540    540                   document.getElementById(sOptName).checked = oOptions[sOptName];
   541    541                   if (sOptName.startsWith("o_group_")) {