Bug 1247641 - When loading a background thumbnail, load about:blank asynchronously when a load fails to avoid endless redirects. r=markh

This commit is contained in:
Drew Willcoxon 2016-02-16 16:34:25 -08:00
parent 22b2841052
commit 4440844edb

View File

@ -108,8 +108,6 @@ const backgroundPageThumbsContent = {
this._startNextCapture();
}
else if (this._state == STATE_CANCELED) {
// A capture request was received while the current capture's page
// was still loading.
delete this._currentCapture;
this._startNextCapture();
}
@ -119,9 +117,20 @@ const backgroundPageThumbsContent = {
// The requested page has loaded. Capture it.
this._state = STATE_CAPTURING;
this._captureCurrentPage();
} else {
}
else if (this._state != STATE_CANCELED) {
// Something went wrong. Cancel the capture. Loading about:blank
// while onStateChange is still on the stack does not actually stop
// the request if it redirects, so do it asyncly.
this._state = STATE_CANCELED;
if (!this._cancelTimer) {
this._cancelTimer =
Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this._cancelTimer.init(() => {
this._loadAboutBlank();
delete this._cancelTimer;
}, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
}
}
},