Closed Bug 1638333 Opened 11 months ago Closed 11 months ago

JavaScript error: resource://testing-common/BrowserTestUtilsChild.jsm, line 267: TypeError: can't access property "href", aEvent.target.location is undefined

Categories

(Testing :: Mochitest, defect, P3)

defect

Tracking

(firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: ishikawa, Assigned: mkmelin)

Details

Attachments

(2 files)

During local mochitest execution with FULL DEBUG version of TB under Debian
GNU/Linux 64-bit, I saw the following error four times.

JavaScript error: resource://testing-common/BrowserTestUtilsChild.jsm, line 267: TypeError: can't access property "href", aEvent.target.location is undefined

I think the error is architecture neutral and so I set it to ALL.

The error happens in the following test.

comm/mail/test/browser/composition/browser_imageInsertionDialog.js

The source code in question ( BrowserTestUtilsChild.jsm, line 267) is as follows:

  handleEvent(aEvent) {
    switch (aEvent.type) {
      case "DOMContentLoaded":
      case "load": {
        this.sendAsyncMessage(aEvent.type, {
          internalURL: aEvent.target.documentURI,
          visibleURL: aEvent.target.location.href, <=== This
        });
        break;
      }
    }
  }

I have no idea how to fix the bug.
To begin with, is it OK to have undefined aEvent.target.location ?
Hasn't something strange happened during the execution path that
reached this code?

I am attaching the excerpt from my local log.

What irks me is that mochitest framework did not fail this test even
though this TypeError happened. We really need to fail a test that
produces TypeError(s).

It's a bug (though harmless). For our case we get the load for a <body> which do not (and should not) have a location property.

Component: Message Compose Window → Mochitest
Product: Thunderbird → Testing
Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/integration/autoland/rev/02c0de0edc3c
BrowserTestUtilsChild.jsm: handleEvent - don't assume the load event target is from a document. r=Yoric
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.