Closed Bug 1674254 Opened 4 years ago Closed 4 years ago

Inside a WebWorker context, calling performance.addEventListener throws a generic NS_ERROR_FAILURE

Categories

(Core :: Performance, defect)

Firefox 82
defect

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: todd, Assigned: smaug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

Start a WebWorker with a script, and listen for errors

var worker = new Worker("worker.js");
worker.onerror = function(error) {
  console.log(error);
}

Worker.js attempts to listen to an event on the performance:

performance.addEventListener("resourcetimingbufferfull", function(evt) {
  console.log("called");
});

Actual results:

error {
​ bubbles: false
cancelBubble: false
​ cancelable: true
​ colno: 0
​ composed: false
​ currentTarget: null
​ defaultPrevented: false
error: null
​ eventPhase: 0
explicitOriginalTarget: ...
​ filename: "http://localhost:3000/worker.js"
​ isTrusted: true
​ lineno: 8
​ message: "NS_ERROR_FAILURE: "
​ originalTarget: Worker { onmessage: null, onmessageerror: null, onerror: null }
​ returnValue: true
​ srcElement: Worker { onmessage: null, onmessageerror: null, onerror: null }
​ target: Worker { onmessage: null, onmessageerror: null, onerror: null }
​ timeStamp: 149
​ type: "error"
​}

Expected results:

No error should have been recorded, event listener should have been attached.

It does not matter if the event is defined like "resourcetimingbufferfull" or generic like "foobar", they both throw.

Hi Todd,

Thank you for your report.

Could you give us more specific steps so we can reproduce this issue on our end? Do we need to create a js file or can we post the script on the webconsole? If a js file is required, would you mind attaching it to this ticket and add further instructions?

Thanks in advance,
Virginia

Flags: needinfo?(todd)

Hi @Virgina, sure thing. Here is the recreation steps:

  1. Create an empty HTML document and host it with a dev webserver
  2. HTML document contains:

<script>
var worker = new Worker("worker.js");
</script>

  1. Create a "worker.js" file, hosted with the same webserver. Worker.js contains:

performance.addEventListener("resourcetimingbufferfull", function(evt) {});

  1. Load the page in Firefox 82.0.2 64bit on MacOS and see it throw unhandled NS_ERROR_FAILURE.
Flags: needinfo?(todd)

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Performance
Product: Firefox → Core
Component: Performance → DOM: Core & HTML

Performance component deals with performance APIs too.

Component: DOM: Core & HTML → Performance

I think Performance object in worker doesn't ever bind to the global and then
https://searchfox.org/mozilla-central/rev/2efcda6dc74c63863fd8f04a6d9d7ac6b09c7eca/dom/events/DOMEventTargetHelper.cpp#303 fails.

Assignee: nobody → bugs
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4a4b3955d7aa
Inside a WebWorker context, calling performance.addEventListener throws a generic NS_ERROR_FAILURE, r=barret
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/26605 for changes under testing/web-platform/tests
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: