Bug 1383662 - Return early from onZoomChange if the document being referenced by the TextZoomChange event is missing a documentElement since we will not be able to find the related browser for the document in this case. r=florian
authorJared Wein <jwein@mozilla.com>
Mon, 24 Jul 2017 11:16:37 -0400
changeset 419377 d85361c5629931abecdca03c7ff199416da9b3ad
parent 419376 c841226514b4395786e203ee1d048a83874c578a
child 419378 db6d7074529469c138e6f8ec361c54d4f203f45c
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1383662
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383662 - Return early from onZoomChange if the document being referenced by the TextZoomChange event is missing a documentElement since we will not be able to find the related browser for the document in this case. r=florian MozReview-Commit-ID: 34Ium8oqZmb
browser/modules/ZoomUI.jsm
--- a/browser/modules/ZoomUI.jsm
+++ b/browser/modules/ZoomUI.jsm
@@ -39,16 +39,22 @@ function onEndSwapDocShells(event) {
 
 function onZoomChange(event) {
   let browser;
   if (event.target.nodeType == event.target.DOCUMENT_NODE) {
     // In non-e10s, the event is dispatched on the contentDocument
     // so we need to jump through some hoops to get to the <xul:browser>.
     let gBrowser = event.currentTarget.gBrowser;
     let topDoc = event.target.defaultView.top.document;
+    if (!topDoc.documentElement) {
+      // In some events, such as loading synthetic documents, the
+      // documentElement will be null and getBrowserForDocument will
+      // return null.
+      return;
+    }
     browser = gBrowser.getBrowserForDocument(topDoc);
   } else {
     browser = event.originalTarget;
   }
   updateZoomUI(browser, true);
 }
 
 /**