Bug 1294509 - Enable browser_thumbnails_bg_crash_during_capture.js on e10s. r?markh
MozReview-Commit-ID: 6cVbhXWdS0X
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -224,18 +224,31 @@ const BackgroundPageThumbs = {
this._destroyBrowser();
let curCapture = this._captureQueue.length ? this._captureQueue[0] : null;
// we could retry the pending capture, but it's possible the crash
// was due directly to it, so trying again might just crash again.
// We could keep a flag to indicate if it previously crashed, but
// "resetting" the capture requires more work - so for now, we just
// discard it.
if (curCapture && curCapture.pending) {
- curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
- // _done automatically continues queue processing.
+ // Continue queue processing by calling curCapture._done(). Do it after
+ // this crashed listener returns, though. A new browser will be created
+ // immediately (on the same stack as the _done call stack) if there are
+ // any more queued-up captures, and that seems to mess up the new
+ // browser's message manager if it happens on the same stack as the
+ // listener. Trying to send a message to the manager in that case
+ // throws NS_ERROR_NOT_INITIALIZED.
+ let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ timer.initWithCallback(() => {
+ delete this._crashRecoverTimer;
+ curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
+ }, 0, Ci.nsITimer.TYPE_ONE_SHOT);
+ // Keep a strong reference to the timer so that it isn't immediately
+ // collected when this function returns.
+ this._crashRecoverTimer = timer;
}
// else: we must have been idle and not currently doing a capture (eg,
// maybe a GC or similar crashed) - so there's no need to attempt a
// queue restart - the next capture request will set everything up.
});
browser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);
this._thumbBrowser = browser;
--- a/toolkit/components/thumbnails/test/browser.ini
+++ b/toolkit/components/thumbnails/test/browser.ini
@@ -7,17 +7,17 @@ support-files =
head.js
privacy_cache_control.sjs
thumbnails_background.sjs
thumbnails_crash_content_helper.js
thumbnails_update.sjs
[browser_thumbnails_bg_bad_url.js]
[browser_thumbnails_bg_crash_during_capture.js]
-skip-if = buildapp == 'mulet' || !crashreporter || e10s # crashing the remote thumbnailer crashes the remote test tab
+skip-if = buildapp == 'mulet' || !crashreporter
[browser_thumbnails_bg_crash_while_idle.js]
skip-if = buildapp == 'mulet' || !crashreporter
[browser_thumbnails_bg_basic.js]
[browser_thumbnails_bg_queueing.js]
[browser_thumbnails_bg_timeout.js]
[browser_thumbnails_bg_redirect.js]
[browser_thumbnails_bg_destroy_browser.js]
[browser_thumbnails_bg_no_cookies_sent.js]