Script-blocking style sheet tests#14899
Merged
domfarolino merged 5 commits intomasterfrom Jan 17, 2019
Merged
Conversation
domenic
pushed a commit
to whatwg/html
that referenced
this pull request
Jan 17, 2019
* Introduce new link loading infrastructure, specifically algorithms to fetch and process linked resources that are overridable by the individual link types. This replaces the previous "obtain the resource" algorithms with something more structured and rigorous. * Specify the order in which style sheets are removed, created/added, their corresponding load/error events are fired, and scripting is unblocked from a loading style sheet. * Replace "style sheet done" flag with Document's "script-blocking style sheet counter", which works in tandem with the "contributes a script-blocking style sheet" conditions, which replaces the definition of "a style sheet that is blocking scripts". * Change <link> load/fire events to be fired from tasks queued on the networking task source, instead of the DOM manipulation task source. * Handle much of what #3544 set out to do, minus defining and explicitly fetching a style sheet's critical subresources. Fixes #3610. Tests: web-platform-tests/wpt#14899
domenic
approved these changes
Jan 17, 2019
| </script> | ||
| <link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test" | ||
| onload="t.step(function() { saw_link_onload = true; });" | ||
| onerror="t.step(function() { assert_unreached('Sheet should load OK'); });"></link> |
Member
There was a problem hiding this comment.
You can use t.unreached_func('Sheet should load OK') if you want
| t.step(function() { | ||
| assert_true(document.styleSheets.length === 1 && | ||
| document.styleSheets[0].href.includes("style.css"), | ||
| "The style sheet 'style.css' is not available to scripts"); |
Member
There was a problem hiding this comment.
Generally, the assertion messages should be stated as things that should happen (like in your other tests), not as things that should not happen. This is inconsistent across WPT but especially for code readers I think it's the right thing to do.
| <script src="/resources/testharness.js"></script> | ||
| <script src="/resources/testharnessreport.js"></script> | ||
| <script> | ||
| var t = async_test("Check that the style sheet loaded by an <link> element " + |
Member
There was a problem hiding this comment.
It's unclear why this is an async_test.
Member
Author
There was a problem hiding this comment.
Good point; mostly that was copy paste
| <link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test" | ||
| onerror="t.step(function() { assert_unreached('Sheet should load OK'); });"></link> | ||
| <script> | ||
| t.step(function() { |
Member
There was a problem hiding this comment.
You might as well join these all into one t.step()
mustaqahmed
pushed a commit
to mustaqahmed/html
that referenced
this pull request
Feb 15, 2019
* Introduce new link loading infrastructure, specifically algorithms to fetch and process linked resources that are overridable by the individual link types. This replaces the previous "obtain the resource" algorithms with something more structured and rigorous. * Specify the order in which style sheets are removed, created/added, their corresponding load/error events are fired, and scripting is unblocked from a loading style sheet. * Replace "style sheet done" flag with Document's "script-blocking style sheet counter", which works in tandem with the "contributes a script-blocking style sheet" conditions, which replaces the definition of "a style sheet that is blocking scripts". * Change <link> load/fire events to be fired from tasks queued on the networking task source, instead of the DOM manipulation task source. * Handle much of what whatwg#3544 set out to do, minus defining and explicitly fetching a style sheet's critical subresources. Fixes whatwg#3610. Tests: web-platform-tests/wpt#14899
mustaqahmed
pushed a commit
to mustaqahmed/html
that referenced
this pull request
Feb 15, 2019
* Introduce new link loading infrastructure, specifically algorithms to fetch and process linked resources that are overridable by the individual link types. This replaces the previous "obtain the resource" algorithms with something more structured and rigorous. * Specify the order in which style sheets are removed, created/added, their corresponding load/error events are fired, and scripting is unblocked from a loading style sheet. * Replace "style sheet done" flag with Document's "script-blocking style sheet counter", which works in tandem with the "contributes a script-blocking style sheet" conditions, which replaces the definition of "a style sheet that is blocking scripts". * Change <link> load/fire events to be fired from tasks queued on the networking task source, instead of the DOM manipulation task source. * Handle much of what whatwg#3544 set out to do, minus defining and explicitly fetching a style sheet's critical subresources. Fixes whatwg#3610. Tests: web-platform-tests/wpt#14899
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests for whatwg/html#4031.
Explanation of the tests: