Grammalecte  Check-in [fc5f0c057a]

Overview
Comment:[fx] unfruitful tests with import/export
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext
Files: files | file ages | folders
SHA3-256: fc5f0c057a84224ad636fb15216b02fa369fa5070832c746b0f6881ee562fa31
User & Date: olr on 2017-07-26 06:26:45
Original Comment: [fx] logos for sponsor and unfruitful tests with import/export
Other Links: branch diff | manifest | tags
Context
2017-07-28
10:17
[fx] other tests... (sigh) check-in: 0053e9898b user: olr tags: fx, webext
2017-07-26
06:26
[fx] unfruitful tests with import/export check-in: fc5f0c057a user: olr tags: fx, webext
2017-07-24
12:53
[fr] pt: soue à cochons check-in: abec092d7c user: olr tags: fr, webext
Changes

Modified gc_core/js/helpers.js from [6c4ecd114f] to [871413f780].

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
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
84
85
86
87
88

"use strict";

// In Firefox, there is no console.log in PromiseWorker, but there is worker.log.
// In Thunderbird, you can’t access to console directly. So it’s required to pass a log function.
let funcOutput = null;

function setLogOutput (func) {
    funcOutput = func;
}

function echo (obj) {
    if (funcOutput !== null) {
        funcOutput(obj);
    } else {
        console.log(obj);
    }
    return true;
}

function logerror (e, bStack=false) {
    let sMsg = "\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message;
    if (bStack) {
        sMsg += "\n--- Stack ---\n" + e.stack;
    }
    if (funcOutput !== null) {
        funcOutput(sMsg);
    } else {
................................................................................
    }
}


// load ressources in workers (suggested by Mozilla extensions reviewers)
// for more options have a look here: https://gist.github.com/Noitidart/ec1e6b9a593ec7e3efed
// if not in workers, use sdk/data.load() instead
function loadFile (spf) {
    try {
        let xRequest;
        if (typeof XMLHttpRequest !== "undefined") {
            xRequest = new XMLHttpRequest();
        }
        else {
            // JS bullshit again… necessary for Thunderbird
................................................................................
    }
    catch (e) {
        logerror(e);
        return null
    }
}


    


// conversions
function objectToMap (obj) {
    let m = new Map();
    for (let param in obj) {
        //console.log(param + " " + obj[param]);
        m.set(param, obj[param]);
    }
    return m;
}

function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}

exports.echo = echo;
exports.logerror = logerror;
exports.objectToMap = objectToMap;
exports.mapToObject = mapToObject;
exports.setLogOutput = setLogOutput;
exports.loadFile = loadFile;







|



|








|







 







|







 








<
<
<

|








|






<
<
<
<
<
<
<
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
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








"use strict";

// In Firefox, there is no console.log in PromiseWorker, but there is worker.log.
// In Thunderbird, you can’t access to console directly. So it’s required to pass a log function.
let funcOutput = null;

export function setLogOutput (func) {
    funcOutput = func;
}

export function echo (obj) {
    if (funcOutput !== null) {
        funcOutput(obj);
    } else {
        console.log(obj);
    }
    return true;
}

export function logerror (e, bStack=false) {
    let sMsg = "\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message;
    if (bStack) {
        sMsg += "\n--- Stack ---\n" + e.stack;
    }
    if (funcOutput !== null) {
        funcOutput(sMsg);
    } else {
................................................................................
    }
}


// load ressources in workers (suggested by Mozilla extensions reviewers)
// for more options have a look here: https://gist.github.com/Noitidart/ec1e6b9a593ec7e3efed
// if not in workers, use sdk/data.load() instead
export function loadFile (spf) {
    try {
        let xRequest;
        if (typeof XMLHttpRequest !== "undefined") {
            xRequest = new XMLHttpRequest();
        }
        else {
            // JS bullshit again… necessary for Thunderbird
................................................................................
    }
    catch (e) {
        logerror(e);
        return null
    }
}





// conversions
export function objectToMap (obj) {
    let m = new Map();
    for (let param in obj) {
        //console.log(param + " " + obj[param]);
        m.set(param, obj[param]);
    }
    return m;
}

export function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}







Added gc_lang/fr/oxt/_img/Algoo_logo.png version [9509b33506].

cannot compute difference between binary files

Added gc_lang/fr/oxt/_img/logo120_text.png version [c438dd0680].

cannot compute difference between binary files

Added gc_lang/fr/tb/skin/Algoo_logo.png version [59954b3904].

cannot compute difference between binary files

Modified gc_lang/fr/webext/content_scripts/modify_page.js from [7e16bf9b14] to [0d51f6815a].


1
2
3



4
5
6

7
8
9
10
11
12
13
..
18
19
20
21
22
23
24
25


function do_something (request, sender, sendResponse) {
  //removeEverything();



  change(request.myparam);
  console.log("DONE!!");
  browser.runtime.onMessage.removeListener(do_something);

}

function removeEverything () {
  while (document.body.firstChild) {
    document.body.firstChild.remove();
  }
}
................................................................................
  document.getElementById("title").setAttribute("background-color", "#FF0000");
}


/*
  Assign do_something() as a listener for messages from the extension.
*/
browser.runtime.onMessage.addListener(do_something);
>

<
|
>
>
>

<
|
>







 







|
1
2

3
4
5
6
7

8
9
10
11
12
13
14
15
16
..
21
22
23
24
25
26
27
28
import { echo } from "../mymodule";


echo("CONTENT SCRIPRT!!!");

function handleMessage2 (oRequest, xSender, sendResponse) {
  console.log(`[Content script] received: ${oRequest.content}`);
  change(request.myparam);

  //browser.runtime.onMessage.removeListener(handleMessage);
  sendResponse({response: "response from content script"});
}

function removeEverything () {
  while (document.body.firstChild) {
    document.body.firstChild.remove();
  }
}
................................................................................
  document.getElementById("title").setAttribute("background-color", "#FF0000");
}


/*
  Assign do_something() as a listener for messages from the extension.
*/
browser.runtime.onMessage.addListener(handleMessage2);

Modified gc_lang/fr/webext/gce_worker.js from [a4e3a48dc5] to [92282c126d].

1
2
3








4
5
6
7
8
9
10
...
109
110
111
112
113
114
115
116
117
118
119
120







// Background script
// for calling the grammar checker engine










let gce = null; // module: grammar checker engine
let text = null;
let tkz = null; // module: tokenizer
let lxg = null; // module: lexicographer
let helpers = null;

................................................................................
        helpers.logerror(e);
    }
    return JSON.stringify([]);
}


function handleMessage (oRequest, xSender, sendResponse) {
  console.log(`content script sent a message: ${oRequest.content}`);
  sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);







|
|

>
>
>
>
>
>
>
>







 







|




>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
import { echo } from "mymodule";

try {
    echo("It works! At last!");
}
catch (e) {
    console.error(e);
}
*/
"use strict";

let gce = null; // module: grammar checker engine
let text = null;
let tkz = null; // module: tokenizer
let lxg = null; // module: lexicographer
let helpers = null;

................................................................................
        helpers.logerror(e);
    }
    return JSON.stringify([]);
}


function handleMessage (oRequest, xSender, sendResponse) {
  console.log(`[background] received: ${oRequest.content}`);
  sendResponse({response: "response from background script"});
}

browser.runtime.onMessage.addListener(handleMessage);

try {
    loadGrammarChecker();
}
catch (e) {
    console.error(e);
}

Modified gc_lang/fr/webext/panel/main.js from [5e706eccfa] to [72659a6e1c].

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  }
  catch (e) {
    showError(e);
  }
}

function handleResponse(message) {
  console.log(`background script sent a response: ${message.response}`);
}

function handleError(error) {
  console.log(`Error: ${error}`);
}

function sendMessage (sMessage) {
  let sending = browser.runtime.sendMessage({content: sMessage});
  sending.then(handleResponse, handleError);  
}







|



|






53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  }
  catch (e) {
    showError(e);
  }
}

function handleResponse(message) {
  console.log(`[Panel] received: ${message.response}`);
}

function handleError(error) {
  console.log(`[Panel] Error: ${error}`);
}

function sendMessage (sMessage) {
  let sending = browser.runtime.sendMessage({content: sMessage});
  sending.then(handleResponse, handleError);  
}

Added gc_lang/fr/xpi/data/img/Algoo_logo.png version [59954b3904].

cannot compute difference between binary files