Bug 1317347 - Fix exception in network monitor for requests coming from iframes added to the hidden window. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 14 Nov 2016 08:21:50 -0800
changeset 439705 163281db1563a70e3e9c15669c67d478d2223991
parent 439704 d282d9e8232adadbf9664f2aa2cc18ceeb0b35af
child 439706 6b7c1986d7ecc870c32e10b44f1a128b41f44c59
push id36064
push userrthijssen@mozilla.com
push dateWed, 16 Nov 2016 13:38:27 +0000
reviewersjryans
bugs1317347
milestone53.0a1
Bug 1317347 - Fix exception in network monitor for requests coming from iframes added to the hidden window. r=jryans MozReview-Commit-ID: eRVaHTbyx1
devtools/shared/webconsole/network-monitor.js
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -79,19 +79,26 @@ function matchRequest(channel, filters) 
         break;
       }
       win = win.parent;
     }
   }
 
   if (filters.outerWindowID) {
     let topFrame = NetworkHelper.getTopFrameForRequest(channel);
-    if (topFrame && topFrame.outerWindowID &&
-        topFrame.outerWindowID == filters.outerWindowID) {
-      return true;
+    // topFrame is typically null for some chrome requests like favicons
+    if (topFrame) {
+      try {
+        if (topFrame.outerWindowID == filters.outerWindowID) {
+          return true;
+        }
+      } catch (e) {
+        // outerWindowID getter from browser.xml (non-remote <xul:browser>) may
+        // throw when closing a tab while resources are still loading.
+      }
     }
   }
 
   if (filters.appId) {
     let appId = NetworkHelper.getAppIdForRequest(channel);
     if (appId && appId == filters.appId) {
       return true;
     }