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

Add tests for microtask checkpoints and custom element constructors #5208

Merged
merged 2 commits into from
Apr 25, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Mar 23, 2017

Follows whatwg/html#2457 and whatwg/dom#430.

/cc @rniwa


This change is Reviewable

@ghost
Copy link

ghost commented Mar 23, 2017

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision 1c31f4d
Using browser at version BuildID 20170423100233; SourceStamp 070fc3c2f8400c09f1037f5444c3d33b499e7128
Starting 10 test iterations
All results were stable

All results

1 test ran
/custom-elements/microtasks-and-constructors.html
Subtest Results Messages
OK
Microtasks evaluate immediately when the stack is empty inside the parser FAIL assert_array_equals: lengths differ, expected 2 got 0
Microtasks evaluate immediately when the stack is empty inside the parser, causing the checks on no attributes to fail FAIL assert_true: The element must be a HTMLUnknownElement expected true got false
Microtasks evaluate afterward when the stack is not empty using createElement() FAIL assert_array_equals: lengths differ, expected 3 got 1
Microtasks evaluate afterward when the stack is not empty using the constructor FAIL assert_array_equals: property 1, expected "promise microtask" but got "MutationObserver microtask"
Microtasks evaluate afterward when the stack is not empty due to upgrades FAIL assert_array_equals: lengths differ, expected 3 got 1

@ghost
Copy link

ghost commented Mar 23, 2017

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision 1c31f4d
Using browser at version 59.0.3071.15 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/custom-elements/microtasks-and-constructors.html
Subtest Results Messages
OK
Microtasks evaluate immediately when the stack is empty inside the parser PASS
Microtasks evaluate immediately when the stack is empty inside the parser, causing the checks on no attributes to fail PASS
Microtasks evaluate afterward when the stack is not empty using createElement() PASS
Microtasks evaluate afterward when the stack is not empty using the constructor PASS
Microtasks evaluate afterward when the stack is not empty due to upgrades PASS

@wpt-pr-bot
Copy link
Collaborator

@ghost
Copy link

ghost commented Mar 23, 2017

These tests are now available on w3c-test.org

@ghost
Copy link

ghost commented Mar 23, 2017

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision 8db354b
Using browser at version BuildID 20170321110237; SourceStamp ca4ae502156eaea6fffb296bb9c3b3930af8ab58
Starting 10 test iterations
All results were stable

All results

1 test ran
/custom-elements/microtasks-and-constructors.html
Subtest Results Messages
OK
Microtasks evaluate immediately when the stack is empty inside the parser FAIL assert_array_equals: lengths differ, expected 2 got 0
Microtasks evaluate immediately when the stack is empty inside the parser, causing the checks on no attributes to fail FAIL assert_true: The element must be a HTMLUnknownElement expected true got false
Microtasks evaluate afterward when the stack is not empty using createElement() FAIL assert_array_equals: lengths differ, expected 3 got 1
Microtasks evaluate afterward when the stack is not empty using the constructor FAIL assert_array_equals: property 1, expected "promise microtask" but got "MutationObserver microtask"
Microtasks evaluate afterward when the stack is not empty due to upgrades FAIL assert_array_equals: lengths differ, expected 3 got 1

@ghost
Copy link

ghost commented Mar 23, 2017

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision 8db354b
Using browser at version 59.0.3047.0 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/custom-elements/microtasks-and-constructors.html
Subtest Results Messages
OK
Microtasks evaluate immediately when the stack is empty inside the parser PASS
Microtasks evaluate immediately when the stack is empty inside the parser, causing the checks on no attributes to fail PASS
Microtasks evaluate afterward when the stack is not empty using createElement() PASS
Microtasks evaluate afterward when the stack is not empty using the constructor PASS
Microtasks evaluate afterward when the stack is not empty due to upgrades PASS

@annevk annevk mentioned this pull request Mar 23, 2017
domenic added a commit to whatwg/dom that referenced this pull request Mar 28, 2017
domenic added a commit to whatwg/html that referenced this pull request Mar 28, 2017
This fixes part of #2381 (the other part is in DOM's "create an
element"). Note this has two consequences, as discussed there:

* Properly managing the entry and incumbent concepts. This is
  technically unobservable in the current spec landscape.
* Ensuring microtasks are run, if the construct is initiated with an
  empty stack (such as during the parser).

Tests: web-platform-tests/wpt#5208
const xBad = document.querySelector("x-bad");
assert_false(xBad.hasAttribute("attribute"), "The attribute must not be present");
assert_true(xBad instanceof HTMLUnknownElement, "The element must be a HTMLUnknownElement");
}, "Microtasks evaluate immediately when the stack is empty inside the parser, causing the " +
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this description, is it in reference to a check somewhere in https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element?

AFAICT, the test is either asserting that the doMicrotasks bit above hasn't run yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

OK, so the microtask is in fact run, the attribute is added, then there's some "checks on no attributes" that I guess happens as part of the upgrade. I couldn't find an explicit attribute-related check anywhere.

I played a bit with the test and figured out that I don't understand custom elements. The this in in this.setAttribute isn't the same thing as xBad is later. I suppose that's only natural, one can't turn an instance of HTMLUnknownElement into an instance of something else.

Some links to help guide the less familiar reader (me) might be nice, but I'll merge this and that can be an optional follow-up.

@ghost
Copy link

ghost commented Apr 24, 2017

View the complete job log.

Lint

Passed

@foolip foolip merged commit f7008c9 into master Apr 25, 2017
@foolip foolip deleted the custom-elements-construct branch April 25, 2017 08:52
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
This fixes part of whatwg#2381 (the other part is in DOM's "create an
element"). Note this has two consequences, as discussed there:

* Properly managing the entry and incumbent concepts. This is
  technically unobservable in the current spec landscape.
* Ensuring microtasks are run, if the construct is initiated with an
  empty stack (such as during the parser).

Tests: web-platform-tests/wpt#5208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants