Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reporting in HostEnqueuePromiseJob is not specified nor interoperable #10526

Open
jeremyroman opened this issue Jul 30, 2024 · 1 comment
Labels
interop Implementations are not interoperable with each other topic: error reporting topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@jeremyroman
Copy link
Collaborator

What is the issue with the HTML Standard?

There is a fringe case (#10404 (comment)) that is underspecified -- which global, if any, receives an error event the job passed to the HostEnqueuePromiseJob hook completes abruptly, but the realm is null.

This can be achieved (in the NewPromiseReactionJob case) by subclassing Promise to inject a custom resolve function which succeeds the first time (allowing a promise of this type to be created) and then throws the next time, inside then(null), which leads to such an abrupt completion with no realm. If these odd things are spread across realms (e.g., with same-origin frames) then it's not clear which global the error event ought to go to.

Major browsers to different things in this extreme edge case. It's unlikely to affect web content in the wild, but would be nice to nail down anyhow.

@jeremyroman
Copy link
Collaborator Author

@domenic domenic added topic: shadow Relates to shadow trees (as defined in DOM) interop Implementations are not interoperable with each other topic: error reporting labels Jul 30, 2024
domenic pushed a commit that referenced this issue Jul 30, 2024
This carries out the first portion of the plan in #958 (comment), by creating a new "report an exception" algorithm that replaces the previous "report an error" and "report the exception".

The new algorithm directly includes the error propagation and fallback behavior, and requires callers to supply the global object to be used, rather than magically inferring it. It no longer takes a script, since in most cases the script was not rigorously determined. Follow-up work on determining the correct muting behavior (which the script argument was used for) is tracked in #10514.

All call sites within HTML are updated. #10516 tracks updating call sites in other specifications. In most cases the global used for HTML is now specified rigorously and matching implementations. #10526 and #10527 track the remaining cases with interop issues.

Closes #958, with the rest of the plan there tracked via the issues mentioned above, whatwg/webidl#1423, and the https://github.com/whatwg/html/labels/topic%3A%20error%20reporting label.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: error reporting topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

2 participants