-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
HTML: document.open() event listener removal #10686
Conversation
w3c-test:mirror |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerned about the extra close()s.
Looks like a great area of non-interop you've discovered.
- Chrome passes
- Safari and Edge fail the second test
- Firefox Nightly fails the first test
- Edge fails the first test with one of its "permission denied" lovely errors.
frame.contentDocument.addEventListener("x", t.unreached_func()); | ||
body.addEventListener("x", t.unreached_func()); | ||
frame.contentDocument.open(); | ||
frame.contentDocument.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "close()" here seems not great since if someone implemented close() as removing the event listeners the test would still pass.
body = frame.contentDocument.body; | ||
t.add_cleanup(() => frame.remove()); | ||
frame.contentDocument.addEventListener("x", t.unreached_func()); | ||
body.addEventListener("x", t.unreached_func()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding descriptions to unreached_funcs makes test failures much easier to diagnose.
assert_true(once); | ||
}, "Event listeners are to be removed with immediate effect"); | ||
|
||
test(t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth gating this behind an if (document.body.attachShadow)
so browsers without shadow DOM don't get failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's bad practice. It makes it less clear what's going on. And have a varying number of tests between browsers, if that's what you're suggesting, seems even worse for tooling.
let once = false; | ||
frame.contentDocument.addEventListener("x", () => { | ||
frame.contentDocument.open(); | ||
frame.contentDocument.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern about close()
Dependency in DOM: whatwg/dom#641. Tests: web-platform-tests/wpt#10686. Fixes #2302.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it fixes my problems with close(), but I still don't understand why you're including close() at all? Does the test fail without it or something?
Depending on the browser the load event might not fire and therefore the harness will timeout. I'm planning on investigating that separately in #10239. (Made progress on some other bits today though.) |
Dependency in DOM: whatwg/dom#641. Tests: web-platform-tests/wpt#10686. Fixes whatwg#2302.
For whatwg/html#3653.