Bug 1297970 - Prevent updateZoomButton from being triggered when a tab's window has closed after the tab was dragged to a new window r?dao draft
authorKatie Broida[:ktbee] <kbroida@gmail.com>
Thu, 20 Oct 2016 13:57:06 -0400
changeset 431922 57328283ad1a0aea40e4c5c412d911e8d03940ea
parent 431863 1aa20bcbb80e1014e4d01057f7d52269b0c2d908
child 535510 f40c0f7b0e344681afc1515ee634f21bcde9ba91
push id34158
push userbmo:jaws@mozilla.com
push dateTue, 01 Nov 2016 02:10:29 +0000
reviewersdao
bugs1297970
milestone52.0a1
Bug 1297970 - Prevent updateZoomButton from being triggered when a tab's window has closed after the tab was dragged to a new window r?dao Just removing _executeSoon doesn't prevent a "win is null" message from appearing in the browser console when dragging a tab to a new window. Gaurding the notifyObservers function with !window.closed ensures that there isn't an error when dragging and dropping a tab. MozReview-Commit-ID: CFPF8EKP12E
browser/base/content/browser-fullZoom.js
--- a/browser/base/content/browser-fullZoom.js
+++ b/browser/base/content/browser-fullZoom.js
@@ -513,19 +513,19 @@ var FullZoom = {
 
   /**
    * Asynchronously broadcasts "browser-fullZoom:location-change" so that
    * listeners can be notified when the zoom levels on those pages change.
    * The notification is always asynchronous so that observers are guaranteed a
    * consistent behavior.
    */
   _notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
-    this._executeSoon(function () {
+    if(!window.closed) {
       Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
-    });
+    }
   },
 
   _executeSoon: function FullZoom__executeSoon(callback) {
     if (!callback)
       return;
     Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
   },
 };