Bug 1335807 - JavaScript Error: 'NS_NOINTERFACE: ' {file: 'resource:///modules/ContentWebRTC.jsm' line: 387}, r=felipe.
authorFlorian Quèze <florian@queze.net>
Thu, 16 Feb 2017 00:13:46 +0100
changeset 343222 d686f96840e6393400b06a54635a99f3477d2da8
parent 343221 8479323bb43cc15ecfa4983acdce56875b6d25a8
child 343223 4ea36a9c2dfdaa7dcc110de361cd20d22efb231f
push id31372
push usercbook@mozilla.com
push dateThu, 16 Feb 2017 12:16:10 +0000
treeherdermozilla-central@2737f66ad6ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1335807
milestone54.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 1335807 - JavaScript Error: 'NS_NOINTERFACE: ' {file: 'resource:///modules/ContentWebRTC.jsm' line: 387}, r=felipe.
browser/modules/ContentWebRTC.jsm
--- a/browser/modules/ContentWebRTC.jsm
+++ b/browser/modules/ContentWebRTC.jsm
@@ -380,22 +380,33 @@ function getTabStateForContentWindow(aCo
 
 function getInnerWindowIDForWindow(aContentWindow) {
   return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIDOMWindowUtils)
                        .currentInnerWindowID;
 }
 
 function getMessageManagerForWindow(aContentWindow) {
-  let ir = aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                         .getInterface(Ci.nsIDocShell)
-                         .sameTypeRootTreeItem
-                         .QueryInterface(Ci.nsIInterfaceRequestor);
+  aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor);
+
+  let docShell;
   try {
-    // If e10s is disabled, this throws NS_NOINTERFACE for closed tabs.
+    // This throws NS_NOINTERFACE for closed tabs.
+    docShell = aContentWindow.getInterface(Ci.nsIDocShell);
+  } catch (e) {
+    if (e.result == Cr.NS_NOINTERFACE) {
+      return null;
+    }
+    throw e;
+  }
+
+  let ir = docShell.sameTypeRootTreeItem
+                   .QueryInterface(Ci.nsIInterfaceRequestor);
+  try {
+    // This throws NS_NOINTERFACE for closed tabs (only with e10s enabled).
     return ir.getInterface(Ci.nsIContentFrameMessageManager);
   } catch (e) {
     if (e.result == Cr.NS_NOINTERFACE) {
       return null;
     }
     throw e;
   }
 }