Index: lib/main.js |
diff --git a/lib/main.js b/lib/main.js |
index b25e05d19756f85c6ab928b106250c1b68fd1373..16efd1ec25b738ddba717fad49f23486d3921361 100644 |
--- a/lib/main.js |
+++ b/lib/main.js |
@@ -4,13 +4,13 @@ |
* http://mozilla.org/MPL/2.0/. |
*/ |
+'use strict'; |
+ |
/** |
* @module main |
*/ |
-Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
-Cu.import("resource://gre/modules/Services.jsm"); |
-Cu.import("resource://gre/modules/Promise.jsm"); |
+const {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); |
Wladimir Palant
2016/09/29 10:36:10
Why did you remove Services.jsm? It is being used
|
require("commandLine"); |
let {run} = require("crawler"); |
@@ -23,21 +23,21 @@ let baseURL = null; |
*/ |
let applicationReady = (function() |
{ |
- let deferred = Promise.defer(); |
+ let resolveWindowsRestored; |
let observer = { |
observe: function(subject, topic, data) |
{ |
Services.obs.removeObserver(this, "sessionstore-windows-restored"); |
- deferred.resolve(); |
+ resolveWindowsRestored(); |
}, |
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]) |
}; |
- |
+ let windowsRestored = new Promise((resolve) => resolveWindowsRestored = resolve); |
Services.obs.addObserver(observer, "sessionstore-windows-restored", true); |
onShutdown.add(() => Services.obs.removeObserver(observer, "sessionstore-windows-restored")); |
- return deferred.promise; |
+ return windowsRestored; |
Wladimir Palant
2016/09/29 10:36:10
This is not how the code should be structured - yo
sergei
2016/09/29 12:46:16
Done in https://codereview.adblockplus.org/2935527
|
})(); |
/** |