script: Start a performance timeline entry for iframe documents#42270
script: Start a performance timeline entry for iframe documents#42270mrobinson merged 4 commits intoservo:mainfrom
Conversation
|
|
||
| // TODO 2-4 Mark resource timing. | ||
| // Mark resource timing. | ||
| let document = match ScriptThread::find_document(loaded_pipeline) { |
There was a problem hiding this comment.
Step 4.1 says to use the iframe's node document, which is self.owner_document(). Right now we're getting the equivalent of child document from the specification.
There was a problem hiding this comment.
I noticed Chrome, Brave and Firefox do not have the iframe PerformanceResourceTiming entries and thought I might have misunderstood the task
There was a problem hiding this comment.
Are other browsers also supposed to record the entry like on the tests?
There was a problem hiding this comment.
I would expect all browsers to do it. We can verify that the tests are passing in other browsers on wpt.fyi.
There was a problem hiding this comment.
Huh, whatwg/html#12122 (comment) means that I haven't correctly understood the algorithm we're completing. I'll try to take a look at this tonight to figure out what we're missing.
There was a problem hiding this comment.
Ok, I see how the pieces are supposed to fit together now. There is:
- https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching (step 10.3) which sets an initiator type for the iframe navigation request
- https://fetch.spec.whatwg.org/#fetch-finale (step 4.2.8) when the request has an initiator type
However, there is also the Timing Allow Origin (TAO) check, which controls how much data the containing document is allowed to see about the request:
- https://fetch.spec.whatwg.org/#concept-tao-check
- https://fetch.spec.whatwg.org/#ref-for-concept-tao-check
The code we're modifying in this PR is a fallback for when the TAO check fails, ensuring there an entry populated with very basic timing information:
- https://html.spec.whatwg.org/multipage/browsing-the-web.html#populating-a-session-history-entry:iframe-pending-resource-timing-start-time
- https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:iframe-pending-resource-timing-start-time
There was a problem hiding this comment.
A quick minimal testcase (the referenced t.html can just be an empty document):
<script>
function dump() {
const resources = performance.getEntriesByType("resource");
resources.forEach((entry) => {
console.log(entry);
});
console.log ("---");
const navs = performance.getEntriesByType("navigation");
navs.forEach((entry) => {
console.log(entry);
});
};
function load() {
setTimeout(dump, 0);
}
</script>
<iframe onload="load()" src="t.html"></iframe>In Firefox this shows a resource timing entry for t.html and a navigation entry for the test page. In Servo right now it just shows the navigation entry.
There was a problem hiding this comment.
I'm going to put my proposal for how to move forward in #41666 so it doesn't get lost here.
6edd750 to
f37dd5b
Compare
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#57468) with upstreamable changes. |
f37dd5b to
e459677
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57468). |
1 similar comment
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57468). |
|
🔨 Triggering try run (#21601045563) for Linux (WPT) |
|
Test results for linux-wpt from try job (#21601045563): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (26)
Stable unexpected results (13)
|
|
|
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#57468) title and body. |
1 similar comment
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#57468) title and body. |
|
Excellent, that's a lot of tests that now run which previously didn't get a chance to run because we never recorded the resource timing entry. We can file followups for fixing the actual timing data and implementing the Timing Allow Origin check correctly. |
|
You can use |
Signed-off-by: Osoro Bironga <[email protected]>
… subit_timing Signed-off-by: Osoro Bironga <[email protected]>
I'll look out for these |
95671fb to
e0b592d
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57468). |
Signed-off-by: Osoro Bironga <[email protected]>
e0b592d to
84ea71d
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57468). |
jdm
left a comment
There was a problem hiding this comment.
Looking good! I've got a few small changes, but it's nice to see this working.
tests/wpt/tests/performance-timeline/timing-entries-iframe.html
Outdated
Show resolved
Hide resolved
components/script/script_thread.rs
Outdated
| // submit_timing will only accept timing that is of type ResourceTimingType::Resource | ||
| let mut resource_timing = timing.clone(); | ||
| resource_timing.timing_type = ResourceTimingType::Resource; |
There was a problem hiding this comment.
Mmmm, interesting. More evidence that some cleanup is needed in how these pieces are integrated in Servo.
Signed-off-by: Osoro Bironga <[email protected]>
|
🤖 This change no longer contains upstreamable changes to WPT; closed existing upstream pull request (web-platform-tests/wpt#57468). |
Added resource timing that was missing for an iframe document.
Testing: Added
Fixes: #41666