Grammalecte  Check-in [0053e9898b]

Overview
Comment:[fx] other tests... (sigh)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext
Files: files | file ages | folders
SHA3-256: 0053e9898b640da414fcd88f8dbfa9af03d40ba06fa47dde772cac507dafd53e
User & Date: olr on 2017-07-28 10:17:55
Other Links: branch diff | manifest | tags
Context
2017-07-31
04:55
[fx][core][js] WebExtension: merge with 0053e9898b check-in: a43bd18afb user: olr tags: trunk, fx
2017-07-29
07:54
[core][js] helpers: inspect check-in: 8820c8ab4d user: olr tags: core, webext
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
Changes

Modified gc_core/js/helpers.js from [871413f780] to [4c14caefb4].

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;

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

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

export function logerror (e, bStack=false) {
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
export function loadFile (spf) {
function loadFile (spf) {
    try {
        let xRequest;
        if (typeof XMLHttpRequest !== "undefined") {
            xRequest = new XMLHttpRequest();
        }
        else {
            // JS bullshit again… necessary for Thunderbird
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72

73
74
75
76
77
78











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
89







-
+








-
+






+
+
+
+
+
+
+
+
+
+
+
        logerror(e);
        return null
    }
}


// conversions
export function objectToMap (obj) {
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) {
function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}

if (typeof(exports) !== 'undefined') {
    // Used for Grammalecte library.
    // In content scripts, these variable are directly reachable
    exports.setLogOutput = setLogOutput;
    exports.echo = echo;
    exports.logerror = logerror;
    exports.loadFile = loadFile;
    exports.objectToMap = objectToMap;
    exports.mapToObject = mapToObject;
}

Modified gc_lang/fr/config.ini from [77819114c8] to [102d5ba968].

27
28
29
30
31
32
33


34

35
36
37
38
39
40
41
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44







+
+

+







oxt_version = 6.1
oxt_identifier = French.linguistic.resources.from.Dicollecte.by.OlivierR

# Firefox
fx_identifier = French-GC@grammalecte.net
fx_name = Grammalecte [fr]

fx_standard_path = C:\Program Files\Mozilla Firefox\firefox.exe
fx_beta_path = C:\Program Files\Mozilla Firefox Beta\firefox.exe
fx_nightly_path = C:\Program Files (x86)\Nightly\firefox.exe


# Thunderbird
tb_identifier = French-GC-TB@grammalecte.net
tb_name = Grammalecte [fr]
tb_debug_extension_path = _build/tb-debug.profile/extensions/French-GC-TB@grammalecte.net
# Set Thunderbird folder in your PATH variable
# Create a local profile:

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

1

2
3

4




5



6
7

8

9
10
11




12
13
14
15
16
17
18

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

+

+
+
+
+
-
+
+
+


+

+
-
-
-
+
+
+
+







/*

import { echo } from "mymodule";

/*
try {
    console.log("BEFORE");
    //var myhelpers = require('./grammalecte/helpers.js');
    require(['./grammalecte/helpers.js'], function (foo) {
        console.log("LOADING");
    echo("It works! At last!");
        echo("MODULE LOADED2");
    });
    console.log("AFTER");
}
catch (e) {
    console.log("\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
    console.error(e);
}*/
}
*/
"use strict";

echo("VA TE FAIRE FOUTRE");



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

123
124
125
126
127
128
129
130
131
132

133
134
135
132
133
134
135
136
137
138



139










-
-
-
+
-
-
-
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/manifest.json from [ceb631e8ca] to [53ddc564c6].

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40







-
+







  "browser_action": {
    "default_icon": "img/logo-32.png",
    "default_popup": "panel/main.html",
    "default_title": "Grammalecte [fr]",
    "browser_style": false
  },
  "background": {
    "scripts": ["gce_worker.js"]
    "scripts": ["require.js", "grammalecte/helpers.js", "gce_worker.js"]
  },
  "web_accessible_resources": [
    "beasts/frog.jpg",
    "beasts/turtle.jpg",
    "beasts/snake.jpg"
  ],
  "permissions": [

Modified make.py from [e6482fde8c] to [18d1b24a9f].

350
351
352
353
354
355
356
357

358
359
360
361
362
363
364
350
351
352
353
354
355
356

357
358
359
360
361
362
363
364







-
+







            # Firefox
            if xArgs.firefox:
                with helpers.cd("_build/xpi/"+sLang):
                    os.system("jpm run -b nightly")

            if xArgs.web_ext:
                with helpers.cd("_build/webext/"+sLang):
                    os.system(r'web-ext run --firefox="' + dVars['fx_nightly_path'] + '" --browser-console')            
                    os.system(r'web-ext run --firefox="' + dVars['fx_beta_path'] + '" --browser-console')            

            # Thunderbird
            if xArgs.thunderbird:
                os.system("thunderbird -jsconsole -P debug")
        else:
            print("Folder not found: gc_lang/"+sLang)