-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[paint-timing] Fix test for non-automated contexts #14109
base: master
Are you sure you want to change the base?
Conversation
@@ -5,21 +5,26 @@ | |||
|
|||
<script> | |||
async_test(function (t) { | |||
window.addEventListener('message', t.step_func(e => { | |||
// This test must take place within an iframe to avoid interference from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change it to not change the DOM at all until the harness is complete?
Can you add a description on the problem? Is it the test harness producing text and making this test flaky? |
@npm1 That's correct. I've extended the inline comment to more completely describe what's going on.
@foolip I assume you mean "complete" informally, as in "done changing the DOM," (versus "transitioned to the If we define this as a single-page test, the harness will not modify the DOM until after the test completes. Even though I'm generally opposed to the imprecision of single-page tests, I think it's preferable to the complexity of deeply nested iframes. As far as I know, this testharness.js behavior is happenstance. There's risk in relying on it here because infrastructure maintainers could make a change that invalidates the test at any moment. It could be useful in other contexts, though, so we might be able to promote it as an explicit feature of the harness. That is to say: we could document it and test it. I'd be happy to do that, but first, do you folks agree that it's the direction we should take? Here are some of the zany things I tried (sharing as a last-ditch attempt to legitimize the effort)We could direct testharness.js to write to a dedicated iframe and then move its contents to the main document after testing is complete: var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
setup({output_document: iframe.contentWindow.document});
add_completion_callback(function() {
var nodes = iframe.contentDocument.querySelectorAll('style, body > *');
for (var idx = 0; idx < nodes.length; ++idx) {
document.body.appendChild(nodes[idx]);
}
iframe.remove();
}); This is a little goofy, though, and it relies on the same semantics that this test is explicitly trying to verify (i.e. that the paint timing events don't propagate up from child windows). We could intentionally trigger a "contentful" paint, capture the time with |
@jugglinmike yes, I didn't have a precise condition in mind when I said this:
Using a single-page test here seems for for the test itself, but it's a bit weird that it changes the outcome. Why does using a single-page test change when the DOM is modified? Could you add a test in infrastructure/ for what the precise thing this would depend on is? Even if we don't change it, that seems valuable to have. |
The motivation for formalizing this behavior comes from an existing test for the paint-timing specification [1], though it is expected that still more tests will benefit from the contract. [1] web-platform-tests#14109
It's because for a single-page test, testharness.js has nothing to report prior to the final results. I think that's largely a vestige of the legacy "implicit opt-in" behavior, where the harness couldn't know whether it was waiting for subtests or already running a single-page test. In
As a single-page test:
Agreed #20254 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but is this problem unique to this test or do we also need to do this for any other test that checks FCP? If it is the latter then I'd say we want the testharness to stop meddling into the DOM of the test page before the test has finished running :)
No description provided.