Skip to content

[html] Test unhandled rejection during parse#20329

Merged
zcorpan merged 3 commits intoweb-platform-tests:masterfrom
bocoup:html-rejection-during-parse
Jan 8, 2021
Merged

[html] Test unhandled rejection during parse#20329
zcorpan merged 3 commits intoweb-platform-tests:masterfrom
bocoup:html-rejection-during-parse

Conversation

@jugglinmike
Copy link
Copy Markdown
Contributor

Chrome and Safari both fail this test:

browser event sequence
Chrome 80 readystatechange, readystatechange, load, unhandledrejection
Firefox 70 readystatechange, unhandledrejection, readystatechange, load
Safari 13 readystatechange, readystatechange, load, unhandledrejection

Copy link
Copy Markdown
Member

@gsnedders gsnedders left a comment

Choose a reason for hiding this comment

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

Pretty certain this is right, but would rather also get review from someone who's more up-to-date with this.

@zcorpan
Copy link
Copy Markdown
Member

zcorpan commented Nov 21, 2019

I nominate @domenic :)

Copy link
Copy Markdown
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 test would be greatly improved by testing the values that document.readyState transitions through (e.g. by adding them to the array).

It's worth noting (e.g. in the <p>) that this is only testable because both promise rejections and readystate change tasks use the DOM manipulation task source.

The fact that Chrome fails this is very believable to me; I believe there is a known bug (likely inherited from WebKit) with not doing the readyState transitions properly. /cc @domfarolino

@jugglinmike
Copy link
Copy Markdown
Contributor Author

This test would be greatly improved by testing the values that document.readyState transitions through

I have greatly improved the test :)

It's worth noting (e.g. in the <p>) that this is only testable because both promise rejections and readystate change tasks use the DOM manipulation task source.

Sounds good to me

The fact that Chrome fails this is very believable to me; I believe there is a known bug (likely inherited from WebKit) with not doing the readyState transitions properly. /cc @domfarolino

I couldn't find anything, so I created some bug reports:

https://bugs.chromium.org/p/chromium/issues/detail?id=1027230
https://bugs.webkit.org/show_bug.cgi?id=204465

I'll give this a day in case anyone finds my modifications objectionable

@rniwa
Copy link
Copy Markdown
Contributor

rniwa commented Nov 22, 2019

Given the combined market share of Chrome & WebKit, I'm not certain changing the behaviors of Blink & WebKit make much sense here. It's probable that some web content out there is relying on the current behaviors of Blink and WebKit.

@domenic
Copy link
Copy Markdown
Member

domenic commented Nov 23, 2019

I believe we're planning to fix this in Blink.

@jugglinmike
Copy link
Copy Markdown
Contributor Author

It's starting to look like the behavior is dependent on network latency. Reviewers for both bug reports experienced a different (although also non-compliant) sequence of events.

For me, when I run this test over the web, I mostly see Chromium report all three events in the wrong sequence (unhandledrejection is first).

http://wptpr.live/20329/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html

Though sometimes it fails by reporting, "assert_array_equals: lengths differ, expected 3 got 2" (because the unhandledrejection event didn't fire until after the load event).

However, if I use this URL:

http://wptpr.live/20329/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html?pipe=trickle(147:d0.1)

...I see the second failure much more frequently. (That's using wptserve's "trickle" feature to delay the delivery of the document, inserting a 0.1-second pause after the 147th byte--immediately after the <script> tag for testharness.js.)

Both behaviors are incorrect according to the specification, and the inconsistency makes an argument about web compatibility less convincing.

@rniwa
Copy link
Copy Markdown
Contributor

rniwa commented Nov 23, 2019

I would remain skeptical and not supportive of this behavior change in WebKit until Chrome successfully ships. Even then I don't think we can commit to changing our behavior depending on how our compatibility story goes.

Copy link
Copy Markdown
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

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

I believe we're planning to fix this in Blink.

Yes that is my understanding. Though there is not an immediate plan or timeline for this

setup({ allow_uncaught_exception: true });

async_test(function(t) {
var events = [];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: const

@zcorpan zcorpan force-pushed the html-rejection-during-parse branch from 81a2753 to 552b10f Compare January 8, 2021 12:20
@zcorpan
Copy link
Copy Markdown
Member

zcorpan commented Jan 8, 2021

@domfarolino fixed the nit. Apologies for the delay, but I think this can be merged if it's green in CI.

@zcorpan zcorpan merged commit d6c156f into web-platform-tests:master Jan 8, 2021
@zcorpan zcorpan deleted the html-rejection-during-parse branch January 8, 2021 13:08
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.

8 participants