Bug 916458 - Ignore failures to get the lastPausedUrl when a tab is closing. r=fitzgen, a=akeybl
authorPanos Astithas <past@mozilla.com>
Mon, 14 Oct 2013 18:13:18 +0300
changeset 154231 55180425e52247259212fa75fdabb3df70285d53
parent 154230 88dbb710851f47af8032262acfaee99bb163c2af
child 154232 7aa981fdbc964755a840a9fc5b40f4c7f243daee
push id2933
push userryanvm@gmail.com
push dateWed, 16 Oct 2013 14:24:16 +0000
treeherdermozilla-beta@7aa981fdbc96 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen, akeybl
bugs916458
milestone25.0
Bug 916458 - Ignore failures to get the lastPausedUrl when a tab is closing. r=fitzgen, a=akeybl
toolkit/devtools/server/actors/script.js
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -283,19 +283,27 @@ EventLoopStack.prototype = {
   get size() {
     return this._inspector.eventLoopNestLevel;
   },
 
   /**
    * The URL of the debuggee who pushed the event loop on top of the stack.
    */
   get lastPausedUrl() {
-    return this.size > 0
-      ? this._inspector.lastNestRequestor.url
-      : null;
+    let url = null;
+    if (this.size > 0) {
+      try {
+        url = this._inspector.lastNestRequestor.url
+      } catch (e) {
+        // The tab's URL getter may throw if the tab is destroyed by the time
+        // this code runs, but we don't really care at this point.
+        dumpn(e);
+      }
+    }
+    return url;
   },
 
   /**
    * Push a new nested event loop onto the stack.
    *
    * @returns EventLoop
    */
   push: function () {
@@ -726,17 +734,17 @@ ThreadActor.prototype = {
         message: "Can't resume when debuggee isn't paused. Current state is '"
           + this._state + "'"
       };
     }
 
     // In case of multiple nested event loops (due to multiple debuggers open in
     // different tabs or multiple debugger clients connected to the same tab)
     // only allow resumption in a LIFO order.
-    if (this._nestedEventLoops.size
+    if (this._nestedEventLoops.size && this._nestedEventLoops.lastPausedUrl
         && this._nestedEventLoops.lastPausedUrl !== this._hooks.url) {
       return {
         error: "wrongOrder",
         message: "trying to resume in the wrong order.",
         lastPausedUrl: this._nestedEventLoops.lastPausedUrl
       };
     }