Open Bug 1888520 Opened 8 months ago Updated 8 months ago

load and error fired in different order on iframes in Firefox vs Chrome/Safari (failure in WPT dom/events/event-global-is-still-set-when-reporting-exception-onerror.html)

Categories

(Core :: DOM: Events, defect)

defect

Tracking

()

People

(Reporter: twisniewski, Unassigned)

References

(Blocks 1 open bug, )

Details

See https://wpt.fyi/results/dom/events/event-global-extra.window.html

We seem to be sending the wrong type of error:
assert_equals: expected object "[object Event]" but got object "[object ErrorEvent]"

Here's a reduced test-case:

<iframe srcdoc=""></iframe>
<iframe srcdoc=""></iframe>
<script>
  window.onload = l => {
    frames[0].onerror = new frames[1].Function(`
      console.log("frame onerror sees event of type", top.window.event.type);
    `);
    window.onerror = new frames[0].Function(`
      console.log("top window.error sees event of type", top.window.event.type);
      foo;
    `);
    const myEvent = new ErrorEvent("error", { error: new Error("myError") });
    window.dispatchEvent(myEvent);
  };      
</script>

Output in Firefox:

top window.error sees event of type error
frame onerror sees event of type error
Uncaught ReferenceError: foo is not defined

Output in Chrome and Safari:

top window.error sees event of type load
frame onerror sees event of type load
Uncaught ReferenceError: foo is not defined

So it looks like the order of events is just completely different, where Chrome and Safari fire load before error, but Firefox vice-versa.

Perhaps this is related to bug 1440212?

Summary: load and error fired in different order on iframes in Firefox vs Chrome/Safari (failure in WPT event-global-is-still-set-when-reporting-exception-onerror.html) → load and error fired in different order on iframes in Firefox vs Chrome/Safari (failure in WPT dom/events/event-global-is-still-set-when-reporting-exception-onerror.html)
You need to log in before you can comment on or make changes to this bug.