Bug 1562821 - Gracefully handle loading browser-child.js in the parent r=Ehsan
authorBarret Rennie <barret@brennie.ca>
Tue, 23 Jul 2019 16:43:37 +0000
changeset 484064 f55a0b430239f6e38225bf7f486f3391a12b88be
parent 484063 ef785c1b1871b33e4743ea2f62f5f47ee4bce565
child 484065 ef5b5e589da3b9a4df5056c2ed0c28dd6327f2e9
push id36339
push userdvarga@mozilla.com
push dateThu, 25 Jul 2019 03:53:31 +0000
treeherdermozilla-central@922be4adb708 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1562821
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1562821 - Gracefully handle loading browser-child.js in the parent r=Ehsan 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(