Skip to content

script: Keep blob URLs alive when creating CORS requests in EventSource - #48920

Open
brelmah wants to merge 1 commit into
servo:mainfrom
brelmah:eventsource-blob-claim
Open

brelmah wants to merge 1 commit into
servo:mainfrom
brelmah:eventsource-blob-claim

Conversation

@brelmah

@brelmah brelmah commented Oct 14, 2026

Copy link
Copy Markdown

Use ensure_blob_referenced_by_url_is_kept_alive to claim the blob URL in EventSource, and switch from create_a_potential_cors_request to create_a_potential_cors_request_with_claim. Without the claim, a page that revokes a blob URL right after creating an EventSource could have a fetch fail because the blob entry would already be gone.

Testing: A full WPT run on my fork showed no changes in the test results here

Part of #48892

@brelmah
brelmah requested a review from gterzian as a code owner October 14, 2026 21:04
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 14, 2026
@jdm

jdm commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

We should be able to write a test that exercises this. Starting in an unmodified main branch, you can make a new test in tests/wpt/tests/eventsource/ that's based on eventsource-reconnect.window.js and uses createObjectURL to create a blob URL and revoke the blob URL from inside the onopen event handler. I would expect the test to fail when it attempts to reconnect to the URL since it would no longer be valid; this PR should allow it to pass.

@jdm jdm closed this Oct 15, 2026
@jdm jdm reopened this Oct 15, 2026
Comment thread components/script/dom/eventsource.rs Resolved
@jdm

jdm commented Oct 15, 2026

Copy link
Copy Markdown
Member

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

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

@brelmah

brelmah commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

@jdm I've completed the EventSource fix and added a WPT test file (tests/wpt/tests/eventsource/eventsource-blob-url.js) that covers:

Basic blob URL functionality with EventSource
Multiple messages from blob URLs
Error handling when blob URLs are revoked
The test ensures that blob URLs are properly kept alive during EventSource connections. Ready for review!

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

🛠 These changes could not be applied onto the latest upstream WPT. Servo's copy of the Web Platform Tests may be out of sync.

@jdm

jdm commented Oct 20, 2026

Copy link
Copy Markdown
Member

You will need to rebase this branch to strip out the merge commit, since it prevents our automated syncing with the upstream WPT repository.

Comment thread components/script/dom/eventsource.rs Resolved
@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 20, 2026
@brelmah
brelmah force-pushed the eventsource-blob-claim branch from e2758ea to 699694f Compare October 20, 2026 17:35
@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 Oct 20, 2026
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

🛠 These changes could not be applied onto the latest upstream WPT. Servo's copy of the Web Platform Tests may be out of sync.

@jdm jdm added S-needs-rebase There are merge conflict errors. S-fails-tidy `./mach test-tidy` reported errors. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 21, 2026
@brelmah
brelmah force-pushed the eventsource-blob-claim branch from 699694f to f9c725c Compare October 26, 2026 18:34
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-rebase There are merge conflict errors. labels Oct 26, 2026
@brelmah
brelmah force-pushed the eventsource-blob-claim branch from f9c725c to ca64c9d Compare October 26, 2026 18:39
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

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

@Rafina98

Copy link
Copy Markdown

Also rebased to a single clean commit with no merge commit

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

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

@Rafina98

Copy link
Copy Markdown

Fixed the WPT test: URL.revokeObjectURL(url) now happens immediately after creating the EventSource, before any events fire. This is the correct test for the fix , the blob claim keeps the URL alive even after it's been revoked.

@@ -0,0 +1,15 @@
// META: title=EventSource: blob URL

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.

We're missing changes to MANIFEST.json. Make sure you've run ./mach update-manifest.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Updated , added the MANIFEST.json changes. Single clean commit with no merge commits, ready for re-review.

@brelmah
brelmah force-pushed the eventsource-blob-claim branch from ca64c9d to 6ace984 Compare October 30, 2026 07:09
@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Oct 30, 2026
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

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

@jdm

jdm commented Oct 30, 2026

Copy link
Copy Markdown
Member

Something went very wrong, unfortunately:
Screenshot 2026-10-30 at 11 40 41 AM

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. S-fails-tidy `./mach test-tidy` reported errors. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants