Bug 1073259 - Print more descriptive errors when DOMRequestHelper tries to create a request with an invalid window. r=fabrice

This commit is contained in:
Kyle Machulis 2014-10-17 05:24:00 -04:00
parent bce4938883
commit 5a20b5cf2f

View File

@ -276,6 +276,11 @@ DOMRequestIpcHelper.prototype = {
},
createRequest: function() {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError("DOMRequestHelper trying to create a DOMRequest without a valid window, failing.");
throw Cr.NS_ERROR_FAILURE;
}
return Services.DOMRequest.createRequest(this._window);
},
@ -285,6 +290,11 @@ DOMRequestIpcHelper.prototype = {
* reference to window owned by this DOMRequestIPCHelper.
*/
createPromise: function(aPromiseInit) {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError("DOMRequestHelper trying to create a Promise without a valid window, failing.");
throw Cr.NS_ERROR_FAILURE;
}
return new this._window.Promise(aPromiseInit);
},