Grammalecte  Check-in [470dd34432]

Overview
Comment:[fx] Add filter in messages exchange to fix some double exec
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext_sharedworker
Files: files | file ages | folders
SHA3-256: 470dd344326a239573d38a7777464e6ecd55cb091f7758a4ea8b08783e4b7c26
User & Date: IllusionPerdu on 2017-08-10 17:54:44
Other Links: branch diff | manifest | tags
Context
2017-08-10
18:03
[fx] Use the extension ID for the Frame name limit the chance of interference with other extension or code in webpage check-in: f7edaf2be9 user: IllusionPerdu tags: fx, webext_sharedworker
17:54
[fx] Add filter in messages exchange to fix some double exec check-in: 470dd34432 user: IllusionPerdu tags: fx, webext_sharedworker
17:23
[fx] loadImage cleanup and minor change check-in: 07a6a29cb1 user: IllusionPerdu tags: fx, webext_sharedworker
Changes

Modified gc_lang/fr/webext/content_scripts/comunicate.js from [a57bb48944] to [9a6ca194be].

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
80
81
82
}


var savePathExtension = '';
var savePathOrigine = '';
console.log('[Iframe] Set receivedMessageWeb');
function receivedMessageWeb (oEvent) {
    console.log('[Iframe] received:', oEvent, savePathExtension, savePathOrigine, oEvent.origin);
    //Pour être sure que ca viens bien de notre iframe ;)
    if ( !xGCEWorker && typeof oEvent.data.sPath !== "undefined" && typeof oEvent.data.sPage !== "undefined" && oEvent.data.sPage === oEvent.origin ){
        console.log('Create the Sharedworker ', oEvent.origin);
        savePathExtension = oEvent.data.sPath;
        savePathOrigine = oEvent.origin;
        //On créer le Shraredworker
        createSharedworker(savePathExtension);
        //On initialise le Shraredworker
        xGCEWorker.port.postMessage(["init", {sExtensionPath: savePathExtension, sOptions: "", sContext: "Firefox"}]);
    } else if ( xGCEWorker && savePathOrigine === oEvent.origin) {
        //Les messages reçus maintenant on un Sharedworker fonctionnel et donc si ça viens bien de la page on lui transmet


        //TODO: Fodrait établir un protocol de communication afin qu'on ne traite vraiment que les messages a transmettre util ;)
        console.log('[Iframe] exec command with Sharedworker');
        xGCEWorker.port.postMessage(oEvent.data);
        console.log('[Iframe] end send message to worker');
    }
}
window.addEventListener("message", receivedMessageWeb, false);


console.log('[Iframe] END');







<


|






|
|
>
>










54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
}


var savePathExtension = '';
var savePathOrigine = '';
console.log('[Iframe] Set receivedMessageWeb');
function receivedMessageWeb (oEvent) {

    //Pour être sure que ca viens bien de notre iframe ;)
    if ( !xGCEWorker && typeof oEvent.data.sPath !== "undefined" && typeof oEvent.data.sPage !== "undefined" && oEvent.data.sPage === oEvent.origin ){
        console.log('[Iframe] Create the Sharedworker ', oEvent.origin);
        savePathExtension = oEvent.data.sPath;
        savePathOrigine = oEvent.origin;
        //On créer le Shraredworker
        createSharedworker(savePathExtension);
        //On initialise le Shraredworker
        xGCEWorker.port.postMessage(["init", {sExtensionPath: savePathExtension, sOptions: "", sContext: "Firefox"}]);
    } else if ( xGCEWorker && savePathOrigine === oEvent.origin && typeof oEvent.data.SharedWorker === "undefined") {
        console.log('[Iframe] received (no Sharedworker):', oEvent, savePathExtension, savePathOrigine, oEvent.origin);
        //Les messages reçus maintenant, on un Sharedworker fonctionnel 
        //On transmet au Sharedworker uniquement si ça viens bien de la page web et on s'assure que c'est pas une réponse du Sharedworker
        //TODO: Fodrait établir un protocol de communication afin qu'on ne traite vraiment que les messages a transmettre util ;)
        console.log('[Iframe] exec command with Sharedworker');
        xGCEWorker.port.postMessage(oEvent.data);
        console.log('[Iframe] end send message to worker');
    }
}
window.addEventListener("message", receivedMessageWeb, false);


console.log('[Iframe] END');