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: trunk, fr
15:58
[fx] selection analysis: don’t send directly text from background to the GC check-in: 76e08d6ee8 user: olr tags: trunk, fx
15:13
[fx] Web API: warn the webpage when the API script is loaded check-in: 2bedf50a10 user: olr tags: trunk, fx
Changes

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

358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
            sendCommandToTab(xTab.id, xInfo.menuItemId);
            break;
        case "grammar_checker_iframe":
            sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.frameId);
            break;
        case "grammar_checker_selection":
            sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.selectionText);
            oWorkerHandler.xGCEWorker.postMessage({
                sCommand: "parseAndSpellcheck",
                oParam: {sText: xInfo.selectionText, sCountry: "FR", bDebug: false, bContext: false},
                oInfo: {iReturnPort: xTab.id}
            });
            break;
        // tools
        case "conjugueur_window":
            openConjugueurWindow();
            break;
        case "conjugueur_tab":
            openConjugueurTab();







<
<
<
<
<







358
359
360
361
362
363
364





365
366
367
368
369
370
371
            sendCommandToTab(xTab.id, xInfo.menuItemId);
            break;
        case "grammar_checker_iframe":
            sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.frameId);
            break;
        case "grammar_checker_selection":
            sendCommandToTab(xTab.id, xInfo.menuItemId, xInfo.selectionText);





            break;
        // tools
        case "conjugueur_window":
            openConjugueurWindow();
            break;
        case "conjugueur_tab":
            openConjugueurTab();

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

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
    createMessageBox: function () {
        if (this.oMessageBox === null) {
            this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte");
            this.oMessageBox.insertIntoPage();
        }
    },

    startGCPanel: function (what, bCheckText=true) {
        this.createGCPanel();
        this.oGCPanel.clear();
        this.oGCPanel.show();
        this.oGCPanel.showEditor();
        this.oGCPanel.start(what);
        this.oGCPanel.startWaitIcon();
        if (what && bCheckText) {
            let sText = this.oGCPanel.oTextControl.getText();
            oGrammalecteBackgroundPort.parseAndSpellcheck(sText, "__GrammalectePanel__");
        }
    },

    showMessage: function (sMessage) {
        this.createMessageBox();







|






|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
    createMessageBox: function () {
        if (this.oMessageBox === null) {
            this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte");
            this.oMessageBox.insertIntoPage();
        }
    },

    startGCPanel: function (what, xResultNode=null) {
        this.createGCPanel();
        this.oGCPanel.clear();
        this.oGCPanel.show();
        this.oGCPanel.showEditor();
        this.oGCPanel.start(what);
        this.oGCPanel.startWaitIcon();
        if (what) {
            let sText = this.oGCPanel.oTextControl.getText();
            oGrammalecteBackgroundPort.parseAndSpellcheck(sText, "__GrammalectePanel__");
        }
    },

    showMessage: function (sMessage) {
        this.createMessageBox();
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
                        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.");
                    }
                    break;
                case "grammar_checker_page":
                    oGrammalecte.startGCPanel(oGrammalecte.getPageText());
                    break;
                case "grammar_checker_selection":
                    oGrammalecte.startGCPanel(result, false); // result is the selected text
                    // selected text is sent to the GC worker in the background script.
                    break;
                case "grammar_checker_iframe":
                    console.log("[Grammalecte] selected iframe: ", result);
                    if (document.activeElement.tagName == "IFRAME") {
                        //console.log(document.activeElement.id); frameId given by result is different than frame.id
                        oGrammalecte.startGCPanel(document.activeElement);
                    } else {







|
<







462
463
464
465
466
467
468
469

470
471
472
473
474
475
476
                        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.");
                    }
                    break;
                case "grammar_checker_page":
                    oGrammalecte.startGCPanel(oGrammalecte.getPageText());
                    break;
                case "grammar_checker_selection":
                    oGrammalecte.startGCPanel(result); // result is the selected text

                    break;
                case "grammar_checker_iframe":
                    console.log("[Grammalecte] selected iframe: ", result);
                    if (document.activeElement.tagName == "IFRAME") {
                        //console.log(document.activeElement.id); frameId given by result is different than frame.id
                        oGrammalecte.startGCPanel(document.activeElement);
                    } else {