Bug 1562821 - Gracefully handle loading browser-child.js in the parent. r=Ehsan, a=RyanVM
authorBarret Rennie <barret@brennie.ca>
Tue, 23 Jul 2019 16:43:37 +0000
changeset 544806 7374e601e0b6624451c0bec4c64a036aaddbba11
parent 544805 146120adc5c87fa572b9a4474346f8690d01891a
child 544807 35e41c495b3cf7e7720d1eb41d87587ccf5b42ef
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, RyanVM
bugs1562821
milestone69.0
Bug 1562821 - Gracefully handle loading browser-child.js in the parent. r=Ehsan, a=RyanVM When in responsive design mode, the `browser-child.js` script will be loaded by the `<xul:browser>` in the parent process, where a `BrowserChild` does not exist. Attempting to retrieve this from the `DocShell` will cause an error, preventing the script from executing correctly. We now gracefully handle the case where browser-child.js is loaded in the parent and no `BrowserChild` exists. Differential Revision: https://phabricator.services.mozilla.com/D38917
toolkit/content/browser-child.js
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -11,20 +11,25 @@ ChromeUtils.defineModuleGetter(
 );
 
 const { WebProgressChild } = ChromeUtils.import(
   "resource://gre/modules/WebProgressChild.jsm"
 );
 
 this.WebProgress = new WebProgressChild(this);
 
-docShell
-  .QueryInterface(Ci.nsIInterfaceRequestor)
-  .getInterface(Ci.nsIBrowserChild)
-  .beginSendingWebProgressEventsToParent();
+try {
+  docShell
+    .QueryInterface(Ci.nsIInterfaceRequestor)
+    .getInterface(Ci.nsIBrowserChild)
+    .beginSendingWebProgressEventsToParent();
+} catch (e) {
+  // In responsive design mode, we do not have a BrowserChild for the in-parent
+  // document.
+}
 
 // This message is used to measure content process startup performance in Talos
 // tests.
 sendAsyncMessage("Content:BrowserChildReady", {
   time: Services.telemetry.msSystemNow(),
 });
 
 addEventListener(