Bug 1391218 - Fix 'getDocShellEnumerator is not a function' exception when closing the last tab in a window. draft
authorLuca Greco <lgreco@mozilla.com>
Mon, 21 Aug 2017 20:14:55 +0200
changeset 650479 1cc739fdf38e294f47569f71e5577ddc56013bb6
parent 650074 a9d372645a32b8d23d44244f351639af9d73b96a
child 727425 9b0da52d43065721e9d5b91efb06fa53e1fe088d
push id75415
push userluca.greco@alcacoop.it
push dateTue, 22 Aug 2017 13:58:52 +0000
bugs1391218
milestone57.0a1
Bug 1391218 - Fix 'getDocShellEnumerator is not a function' exception when closing the last tab in a window. MozReview-Commit-ID: FUcCCljVClI
devtools/server/actors/chrome.js
devtools/server/actors/tab.js
--- a/devtools/server/actors/chrome.js
+++ b/devtools/server/actors/chrome.js
@@ -99,18 +99,20 @@ Object.defineProperty(ChromeActor.protot
   }
 });
 
 ChromeActor.prototype.observe = function (subject, topic, data) {
   TabActor.prototype.observe.call(this, subject, topic, data);
   if (!this.attached) {
     return;
   }
+
+  subject.QueryInterface(Ci.nsIDocShell);
+
   if (topic == "chrome-webnavigation-create") {
-    subject.QueryInterface(Ci.nsIDocShell);
     this._onDocShellCreated(subject);
   } else if (topic == "chrome-webnavigation-destroy") {
     this._onDocShellDestroy(subject);
   }
 };
 
 ChromeActor.prototype._attach = function () {
   if (this.attached) {
--- a/devtools/server/actors/tab.js
+++ b/devtools/server/actors/tab.js
@@ -680,18 +680,20 @@ TabActor.prototype = {
   },
 
   observe(subject, topic, data) {
     // Ignore any event that comes before/after the tab actor is attached
     // That typically happens during firefox shutdown.
     if (!this.attached) {
       return;
     }
+
+    subject.QueryInterface(Ci.nsIDocShell);
+
     if (topic == "webnavigation-create") {
-      subject.QueryInterface(Ci.nsIDocShell);
       this._onDocShellCreated(subject);
     } else if (topic == "webnavigation-destroy") {
       this._onDocShellDestroy(subject);
     }
   },
 
   _onDocShellCreated(docShell) {
     // (chrome-)webnavigation-create is fired very early during docshell