Bug 937172 - Change DebuggerProgressListener to use correct WebProgressListener (r=ochameau,past)
authorBill McCloskey <wmccloskey@mozilla.com>
Mon, 10 Mar 2014 09:34:41 -0700
changeset 190009 11209dad5892f7702a42c1104f551ed6900f6340
parent 190008 affa309bdf7a1dd86fbbdc083b216e9f0fb106c0
child 190010 7d9a9a8d653bf1512df368428d1bd4c8fd1d0ee6
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau, past
bugs937172
milestone30.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 937172 - Change DebuggerProgressListener to use correct WebProgressListener (r=ochameau,past)
browser/devtools/framework/target.js
toolkit/devtools/server/actors/webbrowser.js
--- a/browser/devtools/framework/target.js
+++ b/browser/devtools/framework/target.js
@@ -557,17 +557,21 @@ TabWebProgressListener.prototype = {
     }
   },
 
   /**
    * Destroy the progress listener instance.
    */
   destroy: function TWPL_destroy() {
     if (this.target.tab) {
-      this.target.tab.linkedBrowser.removeProgressListener(this);
+      try {
+        this.target.tab.linkedBrowser.removeProgressListener(this);
+      } catch (ex) {
+        // This can throw when a tab crashes in e10s.
+      }
     }
     this.target._webProgressListener = null;
     this.target._navRequest = null;
     this.target._navWindow = null;
     this.target = null;
   }
 };
 
--- a/toolkit/devtools/server/actors/webbrowser.js
+++ b/toolkit/devtools/server/actors/webbrowser.js
@@ -633,19 +633,17 @@ BrowserTabActor.prototype = {
     this.conn.addActorPool(this._tabPool);
 
     // ... and a pool for context-lifetime actors.
     this._pushContext();
 
     // Watch for globals being created in this tab.
     this.browser.addEventListener("DOMWindowCreated", this._onWindowCreated, true);
     this.browser.addEventListener("pageshow", this._onWindowCreated, true);
-    if (this._tabbrowser) {
-      this._progressListener = new DebuggerProgressListener(this);
-    }
+    this._progressListener = new DebuggerProgressListener(this);
 
     this._attached = true;
   },
 
   /**
    * Creates a thread actor and a pool for context-lifetime actors. It then sets
    * up the content window for debugging.
    */
@@ -1108,22 +1106,28 @@ BrowserAddonActor.prototype.requestTypes
  * navigate away from a paused page, the listener makes sure that the debuggee
  * is resumed before the navigation begins.
  *
  * @param BrowserTabActor aBrowserTabActor
  *        The tab actor associated with this listener.
  */
 function DebuggerProgressListener(aBrowserTabActor) {
   this._tabActor = aBrowserTabActor;
-  this._tabActor._tabbrowser.addProgressListener(this);
+  this._tabActor.webProgress.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_ALL);
   let EventEmitter = devtools.require("devtools/toolkit/event-emitter");
   EventEmitter.decorate(this);
 }
 
 DebuggerProgressListener.prototype = {
+  QueryInterface: XPCOMUtils.generateQI([
+    Ci.nsIWebProgressListener,
+    Ci.nsISupportsWeakReference,
+    Ci.nsISupports,
+  ]),
+
   onStateChange:
   DevToolsUtils.makeInfallible(function DPL_onStateChange(aProgress, aRequest, aFlag, aStatus) {
     let isStart = aFlag & Ci.nsIWebProgressListener.STATE_START;
     let isStop = aFlag & Ci.nsIWebProgressListener.STATE_STOP;
     let isDocument = aFlag & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
     let isNetwork = aFlag & Ci.nsIWebProgressListener.STATE_IS_NETWORK;
     let isRequest = aFlag & Ci.nsIWebProgressListener.STATE_IS_REQUEST;
     let isWindow = aFlag & Ci.nsIWebProgressListener.STATE_IS_WINDOW;
@@ -1171,19 +1175,18 @@ DebuggerProgressListener.prototype = {
       this.emit("navigate", packet);
     }
   }, "DebuggerProgressListener.prototype.onStateChange"),
 
   /**
    * Destroy the progress listener instance.
    */
   destroy: function DPL_destroy() {
-    if (this._tabActor._tabbrowser.removeProgressListener) {
-      try {
-        this._tabActor._tabbrowser.removeProgressListener(this);
-      } catch (ex) {
-        // This can throw during browser shutdown.
-      }
+    try {
+      this._tabActor.webProgress.removeProgressListener(this);
+    } catch (ex) {
+      // This can throw during browser shutdown.
     }
+
     this._tabActor._progressListener = null;
     this._tabActor = null;
   }
 };