aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2019-07-04 17:33:06 +0200
committerAlessio Vanni <vannilla@firemail.cc>2019-07-04 17:33:06 +0200
commit9d87f8f864b28d182af9659a3095433adb4b0126 (patch)
treed0c1f6c22ea84802d0741fc66f31e84eebf092af
parente48dfcaa6bfd70c9d5eb075eeae164d230ee539b (diff)
downloadematrix-9d87f8f864b28d182af9659a3095433adb4b0126.tar.lz
ematrix-9d87f8f864b28d182af9659a3095433adb4b0126.tar.xz
ematrix-9d87f8f864b28d182af9659a3095433adb4b0126.zip
Change how modules are imported
I can't really find a reason why the returned value is preferred over the normal importing process. Additionally, there's a good chance importing Services.jsm can be done only once at the start of everything, instead of binding each object to a separate closure.
-rw-r--r--js/vapi-background.js5
-rw-r--r--js/vapi-browser.js2
-rw-r--r--js/vapi-common.js5
-rw-r--r--js/vapi-contextmenu.js2
-rw-r--r--js/vapi-cookies.js2
-rw-r--r--js/vapi-core.js2
-rw-r--r--js/vapi-messaging.js5
-rw-r--r--js/vapi-net.js2
-rw-r--r--js/vapi-storage.js2
-rw-r--r--js/vapi-tabs.js2
-rw-r--r--js/vapi-window.js2
11 files changed, 13 insertions, 18 deletions
diff --git a/js/vapi-background.js b/js/vapi-background.js
index 0c14992..3f73af7 100644
--- a/js/vapi-background.js
+++ b/js/vapi-background.js
@@ -32,9 +32,8 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
- const {HTTPRequestHeaders} =
- Cu.import('chrome://ematrix/content/HttpRequestHeaders.jsm', null);
+ 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
diff --git a/js/vapi-browser.js b/js/vapi-browser.js
index 27e5e9c..07d954b 100644
--- a/js/vapi-browser.js
+++ b/js/vapi-browser.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-common.js b/js/vapi-common.js
index f1bc2ca..1bc20bc 100644
--- a/js/vapi-common.js
+++ b/js/vapi-common.js
@@ -33,10 +33,7 @@
/******************************************************************************/
-const {Services} = Components.utils.import(
- 'resource://gre/modules/Services.jsm',
- null
-);
+Components.utils.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?
diff --git a/js/vapi-contextmenu.js b/js/vapi-contextmenu.js
index 28715a8..70229da 100644
--- a/js/vapi-contextmenu.js
+++ b/js/vapi-contextmenu.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-cookies.js b/js/vapi-cookies.js
index 500d27b..1f19c49 100644
--- a/js/vapi-cookies.js
+++ b/js/vapi-cookies.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-core.js b/js/vapi-core.js
index 419955b..c904ff2 100644
--- a/js/vapi-core.js
+++ b/js/vapi-core.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI = self.vAPI || {};
diff --git a/js/vapi-messaging.js b/js/vapi-messaging.js
index e7d1985..170e85d 100644
--- a/js/vapi-messaging.js
+++ b/js/vapi-messaging.js
@@ -27,9 +27,8 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
- const {CallbackWrapper} =
- Cu.import('chrome://ematrix/content/CallbackWrapper.jsm', null);
+ 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
diff --git a/js/vapi-net.js b/js/vapi-net.js
index 3d5b27b..25de1cb 100644
--- a/js/vapi-net.js
+++ b/js/vapi-net.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-storage.js b/js/vapi-storage.js
index 75ed6ff..6a6cb3b 100644
--- a/js/vapi-storage.js
+++ b/js/vapi-storage.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-tabs.js b/js/vapi-tabs.js
index fa0fe3b..390f449 100644
--- a/js/vapi-tabs.js
+++ b/js/vapi-tabs.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-background.js
diff --git a/js/vapi-window.js b/js/vapi-window.js
index 3a59cb9..07fb80c 100644
--- a/js/vapi-window.js
+++ b/js/vapi-window.js
@@ -27,7 +27,7 @@
(function () {
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
- const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
+ Cu.import('resource://gre/modules/Services.jsm');
let vAPI = self.vAPI; // Guaranteed to be initialized by vapi-core.js