Bug 1107969 - don't take content screenshots when the message manager has shut down. r=mconley a=gchang
authorMike de Boer <mdeboer@mozilla.com>
Tue, 13 Dec 2016 12:58:09 +0100
changeset 359139 d4d894c1e50ec3588e4b74422a271a8958f9ae51
parent 359138 8f5198636104f839d4f5021590cad684ba4773fa
child 359140 b828b2c86ea9e3ceed2ba667f8a71ee3ebfbebc3
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, gchang
bugs1107969
milestone51.0
Bug 1107969 - don't take content screenshots when the message manager has shut down. r=mconley a=gchang MozReview-Commit-ID: 4n6EQ9tCu25
toolkit/components/thumbnails/PageThumbs.jsm
--- 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.