1
2
3
4
5
6
7
8
9
|
// 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;
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
|
// HELPERS
/*jslint esversion: 6*/
/*global console,require,exports,XMLHttpRequest*/
"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;
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
} else {
// JS bullshit again… necessary for Thunderbird
let { Cc, Ci } = require("chrome");
xRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
xRequest.QueryInterface(Ci.nsIXMLHttpRequest);
}
xRequest.open('GET', spf, false); // 3rd arg is false for synchronous, sync is acceptable in workers
xRequest.send();
return xRequest.responseText;
}
catch (e) {
this.logerror(e);
return null;
}
|
>
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
} else {
// JS bullshit again… necessary for Thunderbird
let { Cc, Ci } = require("chrome");
xRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
xRequest.QueryInterface(Ci.nsIXMLHttpRequest);
}
xRequest.open('GET', spf, false); // 3rd arg is false for synchronous, sync is acceptable in workers
xRequest.overrideMimeType('text/json');
xRequest.send();
return xRequest.responseText;
}
catch (e) {
this.logerror(e);
return null;
}
|