Index: lib/crawler.js |
diff --git a/lib/crawler.js b/lib/crawler.js |
index 4a39784f414862cc3aab0f2cea6a46ccc5e69c70..1fc4078484fa6caf775478dd2677df4ca3dca672 100644 |
--- a/lib/crawler.js |
+++ b/lib/crawler.js |
@@ -13,7 +13,6 @@ |
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
const {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); |
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {}); |
-const {Promise} = Cu.import("resource://gre/modules/Promise.jsm", {}); |
function abprequire(module) |
{ |
@@ -149,15 +148,15 @@ LoadListener.prototype = { |
*/ |
waitForLoad: function(tab) |
{ |
- let deferred = Promise.defer(); |
- this._deferred.set(tab.linkedBrowser, deferred); |
- |
- tab.ownerDocument.defaultView.setTimeout(function() |
+ return new Promise((resolve, reject) => |
{ |
- tab.linkedBrowser.stop(); |
- }, this._timeout); |
+ this._deferred.set(tab.linkedBrowser, resolve); |
- return deferred.promise; |
+ tab.ownerDocument.defaultView.setTimeout(function() |
+ { |
+ tab.linkedBrowser.stop(); |
+ }, this._timeout); |
+ }); |
}, |
/** |
@@ -172,8 +171,8 @@ LoadListener.prototype = { |
{ |
if ((flags & Ci.nsIWebProgressListener.STATE_STOP) && (flags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)) |
{ |
- let deferred = this._deferred.get(browser); |
- if (deferred) |
+ let resolve = this._deferred.get(browser); |
+ if (resolve) |
{ |
this._deferred.delete(browser); |
@@ -190,7 +189,7 @@ LoadListener.prototype = { |
// Exceptions are expected here |
} |
} |
- deferred.resolve([status, headers]); |
+ resolve([status, headers]); |
} |
} |
} |