Skip to content

Comments

test: service worker contextBridge leak#45852

Merged
codebytere merged 2 commits intomainfrom
test/sw-bridge-leak
Mar 1, 2025
Merged

test: service worker contextBridge leak#45852
codebytere merged 2 commits intomainfrom
test/sw-bridge-leak

Conversation

@samuelmaddock
Copy link
Member

Description of Change

closes #45188

Adds a test to ensure values passed between service worker contexts do not leak prototypes. This is a reimplementation of a test from the contextBridge spec file.

I decided to add a new test rather than refactor the contextBridge tests for a few reasons:

  1. ServiceWorkerMain has no executeJavaScript method yet. This prevents us from running arbitrary JS in the main world of service workers.
  2. The service worker preload context is more limited than render frame isolated contexts. The Blob global doesn't exist which the contextBridge test depends on.
  3. The complexity involved in porting makeBindingWindow and callWithBindings to work with SWs while keeping the code maintainable didn't seem worth it.

Checklist

Release Notes

Notes: none

@codebytere codebytere merged commit 21ad7cd into main Mar 1, 2025
55 checks passed
@codebytere codebytere deleted the test/sw-bridge-leak branch March 1, 2025 08:56
@release-clerk
Copy link

release-clerk bot commented Mar 1, 2025

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add memory leak tests for contextBridge in service worker preload context

5 participants