Commit c8040888 authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Fix latent race in htmlimports/loading-attempt.html

We are trying to prioritize loading and composting tasks until FCP
and when enabled this test fails. Upon investigation it turned out
the test script was starting before the link tag resources had loaded.

Starting the test in a window.onload handler fixes the issue.

Bug: 971191
Change-Id: I9d4f99a5cac86970606dd6c9b4ab2416ccaac2ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1782814Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695265}
parent f25dafd9
......@@ -22,15 +22,21 @@ function nosuchErrorHandler() { onerrorWasCalledOnFail = true; }
<link rel="import" href="resources/no-such.html" onload="nosuchLoadHandler()" onerror="nosuchErrorHandler()">
<script>
test(function() {
assert_true(onloadWasCalledOnSuccess);
assert_false(onerrorWasCalledOnSuccess);
}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (1)');
var onloadTest = async_test("Testing html import load order");
test(function() {
assert_false(onloadWasCalledOnFail);
assert_true(onerrorWasCalledOnFail);
}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (2)');
window.onload = function () {
test(() => {
assert_true(onloadWasCalledOnSuccess);
assert_false(onerrorWasCalledOnSuccess);
}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (1)');
test(() => {
assert_false(onloadWasCalledOnFail);
assert_true(onerrorWasCalledOnFail);
}, 'The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (2)');
onloadTest.done();
};
t1 = async_test('The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (3)')
t1.step(function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment