Bug 1451115: Make UpdateZoomUI not throw an exception if gBrowser is not set on window. draft
authorBrad Werth <bwerth@mozilla.com>
Tue, 03 Apr 2018 13:36:24 -0700
changeset 776830 4f8557c62518390f08446307d520731e9895784f
parent 776748 5ec55f7a95f94cf39d57cdf36abecab914ea48eb
push id105014
push userbwerth@mozilla.com
push dateTue, 03 Apr 2018 20:38:38 +0000
bugs1451115
milestone61.0a1
Bug 1451115: Make UpdateZoomUI not throw an exception if gBrowser is not set on window. MozReview-Commit-ID: 6N51Dqxt3jk
browser/modules/ZoomUI.jsm
--- a/browser/modules/ZoomUI.jsm
+++ b/browser/modules/ZoomUI.jsm
@@ -61,17 +61,17 @@ function onZoomChange(event) {
  * Updates zoom controls.
  *
  * @param {object} aBrowser The browser that the zoomed content resides in.
  * @param {boolean} aAnimate Should be True for all cases unless the zoom
  *   change is related to tab switching. Optional
  */
 function updateZoomUI(aBrowser, aAnimate = false) {
   let win = aBrowser.ownerGlobal;
-  if (aBrowser != win.gBrowser.selectedBrowser) {
+  if (!win.gBrowser || win.gBrowser.selectedBrowser != aBrowser) {
     return;
   }
 
   let appMenuZoomReset = win.document.getElementById("appMenu-zoomReset-button");
   let customizableZoomControls = win.document.getElementById("zoom-controls");
   let customizableZoomReset = win.document.getElementById("zoom-reset-button");
   let urlbarZoomButton = win.document.getElementById("urlbar-zoom-button");
   let zoomFactor = Math.round(win.ZoomManager.zoom * 100);