Grammalecte  Check-in [76e08d6ee8]

Overview
Comment:[fx] selection analysis: don’t send directly text from background to the GC
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 76e08d6ee8e5548e9e0073a5852f114d033ae7bdec7912b77c3c7795135f505c
User & Date: olr on 2020-03-21 15:58:00
Other Links: manifest | tags
Context
2020-03-21
23:40
[fr] ajustements check-in: aca27e93d8 user: olr tags: fr, trunk
15:58
[fx] selection analysis: don’t send directly text from background to the GC check-in: 76e08d6ee8 user: olr tags: fx, trunk
15:13
[fx] Web API: warn the webpage when the API script is loaded check-in: 2bedf50a10 user: olr tags: fx, trunk
Changes

Modified gc_lang/fr/webext/background.js from [cc1bfe6b79] to [1a3131ce70].

   358    358               sendCommandToTab(xTab.id, xInfo.menuItemId);
   359    359               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         -            oWorkerHandler.xGCEWorker.postMessage({
   366         -                sCommand: "parseAndSpellcheck",
   367         -                oParam: {sText: xInfo.selectionText, sCountry: "FR", bDebug: false, bContext: false},
   368         -                oInfo: {iReturnPort: xTab.id}
   369         -            });
   370    365               break;
   371    366           // tools
   372    367           case "conjugueur_window":
   373    368               openConjugueurWindow();
   374    369               break;
   375    370           case "conjugueur_tab":
   376    371               openConjugueurTab();

Modified gc_lang/fr/webext/content_scripts/init.js from [ae034ec96f] to [d0cd9c03ec].

   177    177       createMessageBox: function () {
   178    178           if (this.oMessageBox === null) {
   179    179               this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte");
   180    180               this.oMessageBox.insertIntoPage();
   181    181           }
   182    182       },
   183    183   
   184         -    startGCPanel: function (what, bCheckText=true) {
          184  +    startGCPanel: function (what, xResultNode=null) {
   185    185           this.createGCPanel();
   186    186           this.oGCPanel.clear();
   187    187           this.oGCPanel.show();
   188    188           this.oGCPanel.showEditor();
   189    189           this.oGCPanel.start(what);
   190    190           this.oGCPanel.startWaitIcon();
   191         -        if (what && bCheckText) {
          191  +        if (what) {
   192    192               let sText = this.oGCPanel.oTextControl.getText();
   193    193               oGrammalecteBackgroundPort.parseAndSpellcheck(sText, "__GrammalectePanel__");
   194    194           }
   195    195       },
   196    196   
   197    197       showMessage: function (sMessage) {
   198    198           this.createMessageBox();
................................................................................
   462    462                           oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel.");
   463    463                       }
   464    464                       break;
   465    465                   case "grammar_checker_page":
   466    466                       oGrammalecte.startGCPanel(oGrammalecte.getPageText());
   467    467                       break;
   468    468                   case "grammar_checker_selection":
   469         -                    oGrammalecte.startGCPanel(result, false); // result is the selected text
   470         -                    // selected text is sent to the GC worker in the background script.
          469  +                    oGrammalecte.startGCPanel(result); // result is the selected text
   471    470                       break;
   472    471                   case "grammar_checker_iframe":
   473    472                       console.log("[Grammalecte] selected iframe: ", result);
   474    473                       if (document.activeElement.tagName == "IFRAME") {
   475    474                           //console.log(document.activeElement.id); frameId given by result is different than frame.id
   476    475                           oGrammalecte.startGCPanel(document.activeElement);
   477    476                       } else {