Bug 1638333 - BrowserTestUtilsChild.jsm: handleEvent - don't assume the load event target is from a document. r=Yoric
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 27 May 2020 11:06:12 +0000
changeset 532356 02c0de0edc3cfd86e0a96930ed6ed0df0f7d8069
parent 532355 1d049fb23f850080f9cc80f1b59d644234b913f5
child 532357 c4e34b33552169d713d512b0c43582e1948e270b
push id37455
push userapavel@mozilla.com
push dateWed, 27 May 2020 21:33:21 +0000
treeherdermozilla-central@50d550c87f07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1638333
milestone78.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 1638333 - BrowserTestUtilsChild.jsm: handleEvent - don't assume the load event target is from a document. r=Yoric In the case of a <body> location won't be set. Differential Revision: https://phabricator.services.mozilla.com/D76137
testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm
@@ -259,17 +259,19 @@ class BrowserTestUtilsChild extends JSWi
   }
 
   handleEvent(aEvent) {
     switch (aEvent.type) {
       case "DOMContentLoaded":
       case "load": {
         this.sendAsyncMessage(aEvent.type, {
           internalURL: aEvent.target.documentURI,
-          visibleURL: aEvent.target.location.href,
+          visibleURL: aEvent.target.location
+            ? aEvent.target.location.href
+            : null,
         });
         break;
       }
     }
   }
 
   synthesizeMouse(data, window) {
     let target = data.target;