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 427664 17732b9722d8bfb5b33ed7f5d46afde4899a7848
parent 426483 01ab78dd98805e150b0311cce2351d5b408f3001
child 534529 74030efdb9c1a0b6c2716c54efeee83f8d064f3e
push id33084
push userbmo:kbroida@gmail.com
push dateThu, 20 Oct 2016 18:03:44 +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
@@ -514,17 +514,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 () {
-      Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
+      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);
   },