diff options
author | Alessio Vanni <vannilla@firemail.cc> | 2019-07-04 18:41:18 +0200 |
---|---|---|
committer | Alessio Vanni <vannilla@firemail.cc> | 2019-07-04 18:41:18 +0200 |
commit | 6908a6c89f9f44380faa1831ec13cff4042b671a (patch) | |
tree | 075f1c34a991f1c545645dc20aa04f8a118d9bca /js | |
parent | 29943a00d915abd025dc93f7f52b3b03aabf149f (diff) | |
download | ematrix-6908a6c89f9f44380faa1831ec13cff4042b671a.tar.lz ematrix-6908a6c89f9f44380faa1831ec13cff4042b671a.tar.xz ematrix-6908a6c89f9f44380faa1831ec13cff4042b671a.zip |
Make vAPI definitely global
At least for background.html, it can be defined once at the start of
vapi-core and then populated.
Diffstat (limited to 'js')
-rw-r--r-- | js/vapi-background.js | 2 | ||||
-rw-r--r-- | js/vapi-browser.js | 2 | ||||
-rw-r--r-- | js/vapi-client.js | 2 | ||||
-rw-r--r-- | js/vapi-cloud.js | 2 | ||||
-rw-r--r-- | js/vapi-common.js | 2 | ||||
-rw-r--r-- | js/vapi-contextmenu.js | 2 | ||||
-rw-r--r-- | js/vapi-cookies.js | 2 | ||||
-rw-r--r-- | js/vapi-core.js | 8 | ||||
-rw-r--r-- | js/vapi-messaging.js | 2 | ||||
-rw-r--r-- | js/vapi-net.js | 2 | ||||
-rw-r--r-- | js/vapi-storage.js | 2 | ||||
-rw-r--r-- | js/vapi-tabs.js | 2 | ||||
-rw-r--r-- | js/vapi-window.js | 2 |
13 files changed, 6 insertions, 26 deletions
diff --git a/js/vapi-background.js b/js/vapi-background.js index 067707c..ed70fe2 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -35,8 +35,6 @@ Cu.import('resource://gre/modules/Services.jsm'); Cu.import('chrome://ematrix/content/HttpRequestHeaders.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-core.js - // Icon-related stuff vAPI.setIcon = function (tabId, iconId, badge) { // If badge is undefined, then setIcon was called from the diff --git a/js/vapi-browser.js b/js/vapi-browser.js index 07d954b..6b8a846 100644 --- a/js/vapi-browser.js +++ b/js/vapi-browser.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.browser = {}; vAPI.browser.getTabBrowser = function (win) { diff --git a/js/vapi-client.js b/js/vapi-client.js index 6f46e96..337762d 100644 --- a/js/vapi-client.js +++ b/js/vapi-client.js @@ -41,7 +41,7 @@ if (self.vAPI === undefined) { self.vAPI = {}; } -var vAPI = self.vAPI; +var 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); diff --git a/js/vapi-cloud.js b/js/vapi-cloud.js index b3d1b80..f7c47a2 100644 --- a/js/vapi-cloud.js +++ b/js/vapi-cloud.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.cloud = (function () { let extensionBranchPath = 'extensions.' + location.host; let cloudBranchPath = extensionBranchPath + '.cloudStorage'; diff --git a/js/vapi-common.js b/js/vapi-common.js index 1bc20bc..9a322ec 100644 --- a/js/vapi-common.js +++ b/js/vapi-common.js @@ -42,7 +42,7 @@ if (self.vAPI === undefined) { self.vAPI = {}; } -var vAPI = self.vAPI; +var vAPI = self.vAPI; // This is used also when vapi-core is not available /******************************************************************************/ diff --git a/js/vapi-contextmenu.js b/js/vapi-contextmenu.js index 34c4263..5815d78 100644 --- a/js/vapi-contextmenu.js +++ b/js/vapi-contextmenu.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.contextMenu = { contextMap: { frame: 'inFrame', diff --git a/js/vapi-cookies.js b/js/vapi-cookies.js index 1f19c49..21f5d2e 100644 --- a/js/vapi-cookies.js +++ b/js/vapi-cookies.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.cookies = {}; vAPI.cookies.CookieEntry = function (ffCookie) { diff --git a/js/vapi-core.js b/js/vapi-core.js index c904ff2..e2afa4f 100644 --- a/js/vapi-core.js +++ b/js/vapi-core.js @@ -23,14 +23,14 @@ 'use strict'; +var vAPI = {}; + /******************************************************************************/ -(function () { +(function (self) { const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI = self.vAPI || {}; - vAPI.modernFirefox = Services.appinfo.ID === '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}' && Services.vc.compare(Services.appinfo.version, '44') > 0; @@ -133,4 +133,4 @@ vAPI.lastError = function () { return null; }; -})(); +})(this); diff --git a/js/vapi-messaging.js b/js/vapi-messaging.js index 170e85d..b320a27 100644 --- a/js/vapi-messaging.js +++ b/js/vapi-messaging.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); Cu.import('chrome://ematrix/content/CallbackWrapper.jsm'); - - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js vAPI.messaging = { get globalMessageManager() { diff --git a/js/vapi-net.js b/js/vapi-net.js index 25de1cb..ee52945 100644 --- a/js/vapi-net.js +++ b/js/vapi-net.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.net = {}; vAPI.net.registerListeners = function () { diff --git a/js/vapi-storage.js b/js/vapi-storage.js index 6a6cb3b..ce4ab72 100644 --- a/js/vapi-storage.js +++ b/js/vapi-storage.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - // API matches that of chrome.storage.local: // https://developer.chrome.com/extensions/storage vAPI.storage = (function () { diff --git a/js/vapi-tabs.js b/js/vapi-tabs.js index 54b09d0..d36800a 100644 --- a/js/vapi-tabs.js +++ b/js/vapi-tabs.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js - vAPI.tabs = {}; vAPI.tabs.registerListeners = function() { diff --git a/js/vapi-window.js b/js/vapi-window.js index 07fb80c..e7e5e50 100644 --- a/js/vapi-window.js +++ b/js/vapi-window.js @@ -29,8 +29,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import('resource://gre/modules/Services.jsm'); - let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-core.js - vAPI.window = (function () { let windowToIdMap = new Map(); let windowIdGenerator = 1; |