Bug 1107969 - don't take content screenshots when the message manager has shut down. r?mconley
MozReview-Commit-ID: 4n6EQ9tCu25
--- a/toolkit/components/thumbnails/PageThumbs.jsm
+++ b/toolkit/components/thumbnails/PageThumbs.jsm
@@ -250,17 +250,24 @@ this.PageThumbs = {
}
if (aBrowser.isRemoteBrowser) {
let mm = aBrowser.messageManager;
let resultFunc = function(aMsg) {
mm.removeMessageListener("Browser:Thumbnail:CheckState:Response", resultFunc);
aCallback(aMsg.data.result);
}
mm.addMessageListener("Browser:Thumbnail:CheckState:Response", resultFunc);
- mm.sendAsyncMessage("Browser:Thumbnail:CheckState");
+ try {
+ mm.sendAsyncMessage("Browser:Thumbnail:CheckState");
+ } catch (ex) {
+ Cu.reportError(ex);
+ // If the message manager is not able send our message, taking a content
+ // screenshot is also not going to work: return false.
+ resultFunc({ data: { result: false } });
+ }
} else {
aCallback(PageThumbUtils.shouldStoreContentThumbnail(aBrowser.contentDocument,
aBrowser.docShell));
}
},
// The background thumbnail service captures to canvas but doesn't want to
// participate in this service's telemetry, which is why this method exists.