Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/crawler.js

Issue 29355276: Noissue - Remove usage of the deprecated Promises.jsm module. (Closed)
Patch Set: address comments Created Sept. 29, 2016, 8:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
}
}
}
« no previous file with comments | « no previous file | lib/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld