Grammalecte  Check-in [c262fc885d]

Overview
Comment:[fx] Le SharedWorker ne se partage pas dans toutes les fenêtres... Estce à cause de la bidouille ???
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext_sharedworker
Files: files | file ages | folders
SHA3-256: c262fc885da821b05cc0235dd19782d60ab4ecec702f031ab6a4f988a15da70f
User & Date: IllusionPerdu on 2017-08-11 10:44:02
Other Links: branch diff | manifest | tags
Context
2017-08-11
16:33
[fx] Pas mal de simplifications dans le code, mais le SharedWorker ne se partage toujours pas... Leaf check-in: d51f7da951 user: IllusionPerdu tags: fx, webext_sharedworker
10:44
[fx] Le SharedWorker ne se partage pas dans toutes les fenêtres... Estce à cause de la bidouille ??? check-in: c262fc885d user: IllusionPerdu tags: fx, webext_sharedworker
09:48
[fx] Simple test of previous commit check-in: acd22b9ea0 user: IllusionPerdu tags: fx, webext_sharedworker
Changes

Modified gc_lang/fr/webext/background.js from [b961377700] to [897ba1cfeb].

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
                console.log("Unknown command: " + e.data[0]);
        }
    }
    catch (e) {
        showError(e);
    }
};

xGCEWorker.postMessage(["init", {sExtensionPath: browser.extension.getURL("."), sOptions: "", sContext: "Firefox"}]);


/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
                console.log("Unknown command: " + e.data[0]);
        }
    }
    catch (e) {
        showError(e);
    }
};
xGCEWorker.start();
xGCEWorker.postMessage(["init", {sExtensionPath: browser.extension.getURL("."), sOptions: "", sContext: "Firefox"}]);


/*
    Messages from the extension (not the Worker)
*/
function handleMessage (oRequest, xSender, sendResponse) {

Modified gc_lang/fr/webext/content_scripts/communicate.js from [f425809667] to [dd49867218].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
            console.log("[Iframe] send from Message Worker");
            window.postMessage({SharedWorker: e.data}, sPath);
        }
        catch (e) {
            console.error(e);
        }
    };


    console.log("[Iframe] [worker]");
    console.log(xGCEWorker);

    //xGCEWorker.port.start();
    //console.log("Content script [port started]");








>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
            console.log("[Iframe] send from Message Worker");
            window.postMessage({SharedWorker: e.data}, sPath);
        }
        catch (e) {
            console.error(e);
        }
    };
    xGCEWorker.port.start();

    console.log("[Iframe] [worker]");
    console.log(xGCEWorker);

    //xGCEWorker.port.start();
    //console.log("Content script [port started]");

Modified gc_lang/fr/webext/gce_sharedworker.js from [72e7a7fc85] to [1348682312].

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
function showError (e) {
    for (let sParam in e) {
        console.log(sParam);
        console.log(e[sParam]);
    }
}

onconnect = function(e) {
    console.log("START CONNECTION");
    xPort = e.ports[0];
    xListPort.push(xPort);

    xPort.onmessage = function (e) {
        console.log("[Sharedworker] ONMESSAGE");
        console.log(e);
        console.log(e.data[0]);
        let oParam = e.data[1];
        switch (e.data[0]) {
            case "init":
                loadGrammarChecker(oParam.sExtensionPath, oParam.sOptions, oParam.sContext);







|



|
<







65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
function showError (e) {
    for (let sParam in e) {
        console.log(sParam);
        console.log(e[sParam]);
    }
}

self.addEventListener("connect", function(e){
    console.log("START CONNECTION");
    xPort = e.ports[0];
    xListPort.push(xPort);
    xPort.addEventListener("message", function(e){

        console.log("[Sharedworker] ONMESSAGE");
        console.log(e);
        console.log(e.data[0]);
        let oParam = e.data[1];
        switch (e.data[0]) {
            case "init":
                loadGrammarChecker(oParam.sExtensionPath, oParam.sOptions, oParam.sContext);
110
111
112
113
114
115
116

117
118
119
120

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
            case "fullTests":
                fullTests();
                break;
            case "getListOfTokens":
                getListOfTokens(oParam.sText);
                break;
            case "other":

                console.log("Message to Other");
                toReply.Other("Message to Other");
                break;
            case "all":

                console.log("Message to All");
                toReply.All("Message to All");
                break;
            default:
                console.log("Unknown command: " + showError(e.data[0]));
        }
    }
    //xPort.start();
}

let toReply = {
    All: function(data){
        xListPort.forEach(function(client){
            client.postMessage(data);
        });
    },







>




>






|
|
|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
            case "fullTests":
                fullTests();
                break;
            case "getListOfTokens":
                getListOfTokens(oParam.sText);
                break;
            case "other":
                console.log("[Sharedworker Other] Number of client: "+xListPort.length);
                console.log("Message to Other");
                toReply.Other("Message to Other");
                break;
            case "all":
                console.log("[Sharedworker All] Number of client: "+xListPort.length);
                console.log("Message to All");
                toReply.All("Message to All");
                break;
            default:
                console.log("Unknown command: " + showError(e.data[0]));
        }
    });
    xPort.start();
});

let toReply = {
    All: function(data){
        xListPort.forEach(function(client){
            client.postMessage(data);
        });
    },