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].

1
2
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
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
1
2
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
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46









-
+



-
+








-
+















-
+








// HELPERS

"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) {
export function setLogOutput (func) {
    funcOutput = func;
}

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

function logerror (e, bStack=false) {
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 {
        console.error(sMsg);
    }
}


// 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) {
export function loadFile (spf) {
    try {
        let xRequest;
        if (typeof XMLHttpRequest !== "undefined") {
            xRequest = new XMLHttpRequest();
        }
        else {
            // JS bullshit again… necessary for Thunderbird
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
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















-
-
-

-
+








-
+






-
-
-
-
-
-
-
    }
    catch (e) {
        logerror(e);
        return null
    }
}


    


// conversions
function objectToMap (obj) {
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;
}

function mapToObject (m) {
export 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;

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
14
15
16
17
18
19
20
21
22
23
24
25

1
2
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
+

+
-
+
-
+
+

-
-
+
+


















-
+
import { echo } from "../mymodule";

echo("CONTENT SCRIPRT!!!");
function do_something (request, sender, sendResponse) {

  //removeEverything();
function handleMessage2 (oRequest, xSender, sendResponse) {
  console.log(`[Content script] received: ${oRequest.content}`);
  change(request.myparam);
  console.log("DONE!!");
  browser.runtime.onMessage.removeListener(do_something);
  //browser.runtime.onMessage.removeListener(handleMessage);
  sendResponse({response: "response from content script"});
}

function removeEverything () {
  while (document.body.firstChild) {
    document.body.firstChild.remove();
  }
}

function change (param) {
  document.getElementById("title").setAttribute("background-color", "#809060");
  console.log("param: " + param);
  document.getElementById("title").setAttribute("background-color", "#FF0000");
}


/*
  Assign do_something() as a listener for messages from the extension.
*/
browser.runtime.onMessage.addListener(do_something);
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



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-
-
-
+
+
+
+
+
+
+
+
+
+
+







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

/*
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;

109
110
111
112
113
114
115
116

117
118
119
120







117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135







-
+




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


function handleMessage (oRequest, xSender, sendResponse) {
  console.log(`content script sent a message: ${oRequest.content}`);
  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
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}`);
  console.log(`[Panel] received: ${message.response}`);
}

function handleError(error) {
  console.log(`Error: ${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