Grammalecte  Check-in [f7edaf2be9]

Overview
Comment:[fx] Use the extension ID for the Frame name limit the chance of interference with other extension or code in webpage
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext_sharedworker
Files: files | file ages | folders
SHA3-256: f7edaf2be989bb10c3d6a78165353a12770145a7af10a5137ee4efa7d6c1f220
User & Date: IllusionPerdu on 2017-08-10 18:03:41
Other Links: branch diff | manifest | tags
Context
2017-08-10
18:25
[fx] Fix previous commit check-in: 438b74bcdf user: IllusionPerdu tags: fx, webext_sharedworker
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
Changes

Modified gc_lang/fr/webext/content_scripts/modify_page.js from [ca56c295c7] to [f0736e207f].

18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
        console.log('[Web] received (from iframe (Sharedworker)):', oEvent);
    }    
}

/*
* Creation d'une iframe pour communiquer entre la page visitée et le Shareworker
*/

var iframe = document.createElement('iframe');
iframe.id = "GrammaFrameModule";
iframe.src = browser.extension.getURL('content_scripts/comunicate.html');
iframe.hidden = true;
iframe.onload= function() {
    console.log('[Web] Init protocol de communication');
    //var iframeContent = iframe.contentWindow;
    var iframeContent = document.getElementById("GrammaFrameModule").contentWindow;
    iframeContent.addEventListener("message", receivedMessageIframe, false);

    try {
        //La frame est chargé on envoie l'initialisation du Sharedworker
        console.log('[Web] Initialise the worker :s');
        console.log('[Web] Domaine ext: '+browser.extension.getURL(''));
        iframeContent.postMessage({sPath:browser.extension.getURL(''), sPage:location.origin.trim("/")}, browser.extension.getURL('') );
   

        //Un petit test pour débogage ;)
        console.log('[Web] Test the worker :s');
        iframeContent.postMessage(["parse", {sText: "Vas... J’en aie mare...", sCountry: "FR", bDebug: false, bContext: false}], browser.extension.getURL(''));
    }
    catch (e) {
        console.error(e);
    }
}
document.body.appendChild(iframe);








>

|





|





|
|




|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        console.log('[Web] received (from iframe (Sharedworker)):', oEvent);
    }    
}

/*
* Creation d'une iframe pour communiquer entre la page visitée et le Shareworker
*/
let sFrameID = browser.extension.getURL("").split('/').pop();
var iframe = document.createElement('iframe');
iframe.id = sFrameID;
iframe.src = browser.extension.getURL('content_scripts/comunicate.html');
iframe.hidden = true;
iframe.onload= function() {
    console.log('[Web] Init protocol de communication');
    //var iframeContent = iframe.contentWindow;
    var iframeContent = document.getElementById(sFrameID).contentWindow;
    iframeContent.addEventListener("message", receivedMessageIframe, false);

    try {
        //La frame est chargé on envoie l'initialisation du Sharedworker
        console.log('[Web] Initialise the worker :s');
        console.log('[Web] Domaine ext: '+browser.extension.getURL(""));
        iframeContent.postMessage({sPath:browser.extension.getURL(""), sPage:location.origin.trim("/")}, browser.extension.getURL("") );
   

        //Un petit test pour débogage ;)
        console.log('[Web] Test the worker :s');
        iframeContent.postMessage(["parse", {sText: "Vas... J’en aie mare...", sCountry: "FR", bDebug: false, bContext: false}], browser.extension.getURL(""));
    }
    catch (e) {
        console.error(e);
    }
}
document.body.appendChild(iframe);