-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 MediaQueryList tests #28108
Comments
This took me a while... The combination of step 2.10 of https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke and https://heycam.github.io/webidl/#call-a-user-objects-operation should have the relevant information for I think the main thing that is unclear here is what global should get the exception. It's not clear to me what global (whatwg/dom#624 seems somewhat related.) |
report an exception is a bit vague with "using the global object specified by the relevant script's settings object" prose. This reads to me as "lexical global object", which makes sense: it attempts to reach the user, either via |
See also whatwg/html#958. |
Isn't the global of MediaQueryList clear? It is the global of the document. |
For this example Chrome does seem to agree with that (though Safari does not), i.e., it alerts "Uncaught 1", not "hmmm". <iframe></iframe>
<script>
onerror = e => alert(e)
onload = () => {
frames[0].document.body.addEventListener("x", () => { throw 1 });
frames[0].onerror = e => alert("hmmm");
frames[0].document.body.dispatchEvent(new Event("x"));
}
</script> Not clear why Chrome does it differently for the (https://drafts.csswg.org/cssom-view/#dom-window-matchmedia doesn't say what the global should be, but it does seem reasonable that it matches that of the document (and the object on which the factory method was invoked). Hopefully that'll get fixed one day.) |
This looks fishy to me:
wpt/css/cssom-view/MediaQueryList-addListener-handleEvent.html
Line 75 in d704ab5
const eventWatcher = new EventWatcher(t, window, "error", waitForChangesReported);
It's watching for an error event targeting the top-level window, but the MediaQueryList object comes from the iframe's window:
const mql = iframe.contentWindow.matchMedia(...);
... so I would expect any error events to target iframe.contentWindow rather than the top-level window. Shouldn't it be:
const eventWatcher = new EventWatcher(t, getWindow(mql), "error", waitForChangesReported);
?
Also -- and maybe I'm just showing my ignorance here -- where is it specified that when listener.handleEvent is non-callable, then an error event should be fired on the window? For chromium, at least, that is non-standard behavior.
The text was updated successfully, but these errors were encountered: