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

HTML: document.open() event listener removal #10686

Merged
merged 2 commits into from
May 2, 2018

Conversation

annevk
Copy link
Member

@annevk annevk commented Apr 27, 2018

@wpt-pr-bot wpt-pr-bot requested review from ayg, jdm, jgraham and zqzhang April 27, 2018 15:16
@domenic domenic self-requested a review April 30, 2018 17:34
@domenic
Copy link
Member

domenic commented Apr 30, 2018

w3c-test:mirror

Copy link
Member

@domenic domenic left a 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();
Copy link
Member

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());
Copy link
Member

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 => {
Copy link
Member

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.

Copy link
Member Author

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern about close()

annevk added a commit to whatwg/html that referenced this pull request May 2, 2018
Copy link
Member

@domenic domenic left a 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?

@annevk
Copy link
Member Author

annevk commented May 2, 2018

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.)

@annevk annevk merged commit 923d852 into master May 2, 2018
@annevk annevk deleted the annevk/document-open-event-listeners branch May 2, 2018 16:05
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants