Skip to content

script: Make URL.revokeObjectURL work for sandboxed iframe - #45417

Merged
yezhizhen merged 3 commits into
servo:mainfrom
yezhizhen:revoke-fetch
Jun 6, 2026
Merged

yezhizhen merged 3 commits into
servo:mainfrom
yezhizhen:revoke-fetch

Conversation

@yezhizhen

Copy link
Copy Markdown
Member

Spec never said anything about if the origin should match.
We remove this check. We were failing tests\wpt\tests\FileAPI\url\sandboxed-iframe.html as the sandboxed iframe
has opaque origin and we never successfully revoke the blob.

Testing: Existing tests passing for sandboxed iframe.
Revoke blob URL after creating Request, will fetch now fails correctly. It was wrongly passing,
as we didn't revoke the URL.
Spec says "Requests that were started before the url was revoked should still succeed.",
which we never implemented correctly.
Part of #10778

yezhizhen added 2 commits June 5, 2026 12:54
.
Signed-off-by: Euclid Ye <[email protected]>
@yezhizhen
yezhizhen requested review from jdm and xiaochengh June 5, 2026 13:21
@yezhizhen
yezhizhen requested a review from gterzian as a code owner June 5, 2026 13:21
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 5, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jun 5, 2026
@TimvdLippe
TimvdLippe added this pull request to the merge queue Jun 5, 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 Jun 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 5, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jun 5, 2026
@yezhizhen

yezhizhen commented Jun 5, 2026 •

Copy link
Copy Markdown
Member Author

I removed one extra line url.fragment().is_none() which resulted in these failures.
But I feel test is not aligned with spec:

promise_test(t => {
const url = URL.createObjectURL(blob);
URL.revokeObjectURL(url + '#fragment');
return fetch_should_succeed(t, url).then(text => {
assert_equals(text, blob_contents);
});
}, 'Only exact matches should revoke URLs, using ' + fetch_method);


Per spec:

  1. Let urlRecord be the result of parsing url.

parsing then says:
...
Set url’s blob URL entry to the result of resolving the blob URL url, ...
which goes back to FileAPI.

resolving the blob URL step 3:
Let url string be the result of serializing url with the exclude fragment flag set. (back to whatwg again)

But with "exclude fragment flag set", we should not care about fragment?

@yezhizhen

Copy link
Copy Markdown
Member Author

The revokeObjectURL(url) static method must run these steps
1. Let urlRecord be the result of parsing url.
2. If urlRecord’s scheme is not "blob", return.
3. Let entry be urlRecord’s blob URL entry.
4. If entry is null, then return.
5. Let isAuthorized be the result of checking for same-partition blob URL usage with entry and the current settings object.
6. If isAuthorized is false, then return.
7. Remove an entry from the Blob URL Store for url.

Seems the problem is, step 7 is still using the url with fragment. But what is the point of getting entry without fragment in step 3-6? (exclude fragment flag set)

Signed-off-by: Euclid Ye <[email protected]>
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jun 6, 2026
@yezhizhen
yezhizhen enabled auto-merge June 6, 2026 02:38
@yezhizhen
yezhizhen added this pull request to the merge queue Jun 6, 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 Jun 6, 2026
Merged via the queue into servo:main with commit 1fe73cb Jun 6, 2026
33 checks passed
@yezhizhen
yezhizhen deleted the revoke-fetch branch June 6, 2026 03:19
@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 Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants