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
--- 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);
},
};