aboutsummaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2019-07-19 15:54:34 +0200
committerAlessio Vanni <vannilla@firemail.cc>2019-07-19 15:54:34 +0200
commit8c05a1711951f3cc9179eec2c086b0e88d42e5f0 (patch)
tree26b4f24bb2a16f9fe8f912d80635e0911d0ca0ca /js
parent34a61bb50143a88c885542274d25f2a7e35218c4 (diff)
downloadematrix-8c05a1711951f3cc9179eec2c086b0e88d42e5f0.tar.lz
ematrix-8c05a1711951f3cc9179eec2c086b0e88d42e5f0.tar.xz
ematrix-8c05a1711951f3cc9179eec2c086b0e88d42e5f0.zip
Make vAPI definitely global for non-background pages too
Diffstat (limited to 'js')
-rw-r--r--js/vapi-client.js23
-rw-r--r--js/vapi-common.js11
-rw-r--r--js/vapi-core.js2
3 files changed, 6 insertions, 30 deletions
diff --git a/js/vapi-client.js b/js/vapi-client.js
index 8ef7805..e45cc4d 100644
--- a/js/vapi-client.js
+++ b/js/vapi-client.js
@@ -26,34 +26,19 @@
'use strict';
(function (self) {
- // https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10
- // eMatrix: does this apply to us?
- // In the meantime, let's remove the useless `eMatrix' property from vAPI
- if (self.vAPI === undefined) {
- self.vAPI = {};
- }
-
- let vAPI = self.vAPI; // This is also used when vapi-core is not available
-
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
Math.random().toString(36).slice(2);
- vAPI.setTimeout = vAPI.setTimeout || function (callback, delay) {
- return setTimeout(function () {
- callback();
- }, delay);
- };
-
vAPI.shutdown = (function () {
- var jobs = [];
+ let jobs = [];
- var add = function (job) {
+ let add = function (job) {
jobs.push(job);
};
- var exec = function () {
+ let exec = function () {
//console.debug('Shutting down...');
- var job;
+ let job;
while ((job = jobs.pop())) {
job();
}
diff --git a/js/vapi-common.js b/js/vapi-common.js
index 46225b1..473ad89 100644
--- a/js/vapi-common.js
+++ b/js/vapi-common.js
@@ -25,19 +25,12 @@
'use strict';
+let vAPI = {};
+
(function (self) {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
- // https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10
- // eMatrix: does this apply to us?
- // In the meantime, let's remove the useless `eMatrix' property from vAPI
- if (self.vAPI === undefined) {
- self.vAPI = {};
- }
-
- let vAPI = self.vAPI; // This is used also when vapi-core is not available
-
vAPI.setTimeout = vAPI.setTimeout || function (callback, delay, extra) {
return setTimeout(function (a) {
callback(a);
diff --git a/js/vapi-core.js b/js/vapi-core.js
index e2afa4f..620faf2 100644
--- a/js/vapi-core.js
+++ b/js/vapi-core.js
@@ -23,8 +23,6 @@
'use strict';
-var vAPI = {};
-
/******************************************************************************/
(function (self) {