Commit a42aa07d authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Wait for html to load before selecting node.

TestRunner.loadHTML() does not wait for the document to load or even
fully parse before returning. When the html contains a parser blocking
stylesheet in a link element, the parsing is typically not finished when
loadHTML returns.

When BlockHTMLParserOnStyleSheets is enabled, this test started failing
because we were trying to find a node which were not yet parsed.

Bug: 891767
Change-Id: I4d6012a732143baf93c67a5e6cc01a78da617d4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023892
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735974}
parent bdc4c4a7
......@@ -58,6 +58,17 @@ body.mainpage {
}
}
await (() => {
// TODO(crbug.com/1046354): This is a workaround for loadHTML() resolving
// before parsing is finished. In this case the stylesheet is blocking html
// parsing with BlockHTMLParsingOnStyleSheets enabled and mainBody is not
// found by selectNodeWithId below.
let resolve;
const promise = new Promise(r => resolve = r);
TestRunner.waitForPageLoad(() => resolve());
return promise;
})();
ElementsTestRunner.selectNodeWithId('mainBody', step1);
async function step1(node) {
......
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