Bug 1451115 Part 1: 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 776832 b2a22a2d01d696cc6c3be3b45954a70dc80ab26f
parent 776748 5ec55f7a95f94cf39d57cdf36abecab914ea48eb
child 776833 17483aa36672ec0f35fe9bd14ec3767cdcd2c726
push id105016
push userbwerth@mozilla.com
push dateTue, 03 Apr 2018 20:48:57 +0000
bugs1451115
milestone61.0a1
Bug 1451115 Part 1: 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);