Skip to content

script: Use create_a_potential_cors_request_with_claim in htmltrackelement.rs - #49203

Merged
jdm merged 1 commit into
servo:mainfrom
rogerkorantenng:htmltrackelement-blob-claim
Nov 4, 2026
Merged

jdm merged 1 commit into
servo:mainfrom
rogerkorantenng:htmltrackelement-blob-claim

Conversation

@rogerkorantenng

@rogerkorantenng rogerkorantenng commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Use ensure_blob_referenced_by_url_is_kept_alive to get a UrlWithBlobClaim for the <track> element's source URL, then pass it to create_a_potential_cors_request_with_claim instead of the temporary create_a_potential_cors_request.

Testing: Added tests/wpt/tests/html/semantics/embedded-content/media-elements/track/track-element/track-blob-url-revoked.window.js. It loads a <track> from a blob URL holding a small WebVTT file, and has three subtests.

The main one revokes the URL in a microtask after the fetch has started and checks that the track still loads. The other two check that a blob URL that is never revoked loads normally, and that revoking it before loading starts gives an error event.
./mach test-tidy is clean.

Try run: https://github.com/rogerkorantenng/servo/actions/runs/39970828531

Fixes: Part of #48892

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#64118) with upstreamable changes.

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#64118) title and body.

@rogerkorantenng

Copy link
Copy Markdown
Contributor Author

@jdm Would appreciate your review and input on this when you have a moment.

Comment on lines +506 to +507
let url_with_blob_claim =
ensure_blob_referenced_by_url_is_kept_alive(&global, url.clone());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid intermittent failures in the new test, we need to claim this URL right after computing it in https://github.com/rogerkorantenng/servo/blob/f12b05e0733d7d14effecbd4fe7e4ec06c9b3c8f/components/script/dom/html/embedded_content/htmltrackelement.rs#L337-L338 . We should change the type of track_url to Option<UrlWithBlobClaim> and store the claimed URL there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! i changed track_url to Option and the url now gets claimed as soon as its parsed in attribute_mutated. The processing model just passes the stored claim straight to create_a_potential_cors_request_with_claim so nothing gets claimed later in the microtask anymore. i also had to adjust the test to match since the claim now happens when src is set, revoking the url any time after that doesnt affect the load. So the second subtest now revokes the url right after setting src instead of in a queueMicrotask and checks that the track still loads, no more timing dependence. and the third subtest now revokes the url before setting src and checks for an error

@jdm

@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 30, 2026
@rogerkorantenng
rogerkorantenng force-pushed the htmltrackelement-blob-claim branch from f12b05e to aad5833 Compare November 4, 2026 00:03
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 4, 2026
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#64118).

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thanks for your care with the tests!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 4, 2026
@jdm
jdm added this pull request to the merge queue Nov 4, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 4, 2026
Merged via the queue into servo:main with commit b64e1d0 Nov 4, 2026
38 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants