Bug 1593533 - Catch all exceptions thrown when testing if a window is top level, r=ochameau.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 05 Nov 2019 12:24:42 +0000
changeset 500569 cf5e611e9d21dd33e1be27da7ec68e057801ebc5
parent 500568 bed1d14f0ef889f2d2e7c29c4123ef1b2eec5b92
child 500570 df564ab5211ef20fd1a1dafc4bc2ff9d292c1645
push id99696
push userbhackett@mozilla.com
push dateTue, 05 Nov 2019 12:25:54 +0000
treeherderautoland@cf5e611e9d21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1593533
milestone72.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 1593533 - Catch all exceptions thrown when testing if a window is top level, r=ochameau. Differential Revision: https://phabricator.services.mozilla.com/D51533
devtools/server/actors/utils/event-loop.js
--- a/devtools/server/actors/utils/event-loop.js
+++ b/devtools/server/actors/utils/event-loop.js
@@ -127,17 +127,28 @@ EventLoop.prototype = {
           return debuggee.class == "Window";
         })
         .map(debuggee => {
           // Retrieve the JS reference for these windows
           return debuggee.unsafeDereference();
         })
         // Ignore iframes as they will be paused automatically when pausing their
         // owner top level document
-        .filter(window => !Cu.isDeadWrapper(window) && window.top === window)
+        .filter(window => {
+          try {
+            return window.top === window;
+          } catch (e) {
+            // Warn if this is throwing for an unknown reason, but suppress the
+            // exception regardless so that we can enter the nested event loop.
+            if (!Cu.isDeadWrapper(window) && !/not initialized/.test(e)) {
+              console.warn(`Exception in getAllWindowDebuggees: ${e}`);
+            }
+            return false;
+          }
+        })
     );
   },
 
   /**
    * Prepare to enter a nested event loop by disabling debuggee events.
    */
   preNest() {
     const windows = [];