Skip to content

Commit

Permalink
Address review for style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino committed Jan 17, 2019
1 parent 8704b7a commit 32ee744
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"pending parsing-blocking script is unblocked");
</script>
<link href="nonexistent.css" rel="stylesheet" id="style_test"
onload="t.step(function() { assert_unreached('Sheet should fail to load'); });"
onerror="t.step(function() { saw_link_onerror = true; });">
onload="t.unreached_func('Sheet should fail to load')"
onerror="t.step(function() { saw_link_onerror = true; })">
<script>
t.step(function() {
assert_true(saw_link_onerror, "The pending parsing-blocking script should " +
"only run after the last element that " +
"contributes a script-blocking style " +
"sheet's error event is fired if the sheet " +
"fails to load.");
"only run after the last element that " +
"contributes a script-blocking style " +
"sheet's error event is fired if the sheet " +
"fails to load.");
});
t.done();
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}));
</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>
onload="t.step(function() { saw_link_onload = true; })"
onerror="t.step(function() { assert_unreached('Sheet should load OK'); })">

This comment has been minimized.

Copy link
@domenic

domenic Jan 17, 2019

Member

Missed an unreached_func opportunity

</head>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"pending parsing-blocking script is unblocked");
</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>
onload="t.step(function() { saw_link_onload = true; })"
onerror="t.unreached_func('Sheet should load OK')">
<script>
t.step(function() {
assert_true(saw_link_onload, "The pending parsing-blocking script should " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet">
<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 " +
"is available to scripts until its successor is completely loaded");
</script>
<link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test"
onerror="t.step(function() { assert_unreached('Sheet should load OK'); });"></link>
onerror="t.unreached_func('Sheet should load OK')">

This comment has been minimized.

Copy link
@domenic

domenic Jan 17, 2019

Member

t no longer exists here, which is bad.

This comment has been minimized.

Copy link
@domfarolino

domfarolino Jan 17, 2019

Author Member

Ah, yep. Getting rid of the onerror anyways, since the first assert_true would fail if the style sheet failed to load.

<script>
t.step(function() {
test(function() {
assert_true(document.styleSheets.length === 1 &&
document.styleSheets[0].href.includes("style.css"),
"The style sheet 'style.css' is not available to scripts");
});
"The style sheet 'style.css' must be available to scripts");

style_test.href = "resources/neutral.css?pipe=trickle(d3)";

style_test.href = "resources/neutral.css?pipe=trickle(d3)";
t.step(function() {
assert_true(document.styleSheets.length === 1 &&
document.styleSheets[0].href.includes("style.css"),
"The style sheet 'style.css' was removed from " +
"document.styleSheets before the next style sheet to replace " +
"it has finished loading");
t.done();
});
"The style sheet 'style.css' must remain accessible to " +
"scripts until its replacement has finished loading");
}, "Check that a style sheet loaded by a <link> is available until its successor is loaded");
</script>
</head>
</html>

0 comments on commit 32ee744

Please sign in to comment.