Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure that functions are not retained beyond their context being released #23207

Merged
merged 1 commit into from Apr 22, 2020

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Apr 21, 2020

We were cleaning up the RenderFrameFunctionStore instances when a render frame was destroyed. For same site navigations / reloads the render frame isn't destroyed, it's reused so we were leaking the old context and all the functions. This updates our impl to listen for WillReleaseScriptContext and release our holds on objects in that context once that context is about to be released.

Also adds a test for good measure 😄 Had to update the contextBridge specs to use an actual HTTP server so that same-site rules applied

Notes: fixed memory leak when using contextBridge with sandbox=true

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Apr 21, 2020
@MarshallOfSound MarshallOfSound force-pushed the clean-up-function-store-on-context-release branch from e012274 to 18f7178 Compare April 21, 2020 22:08
@MarshallOfSound MarshallOfSound merged commit 0cbcee6 into master Apr 22, 2020
@release-clerk
Copy link

release-clerk bot commented Apr 22, 2020

Release Notes Persisted

fixed memory leak when using contextBridge with sandbox=true

@MarshallOfSound MarshallOfSound deleted the clean-up-function-store-on-context-release branch April 22, 2020 01:05
@trop
Copy link
Contributor

trop bot commented Apr 22, 2020

I was unable to backport this PR to "7-2-x" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Apr 22, 2020

I was unable to backport this PR to "8-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Apr 22, 2020

I have automatically backported this PR to "9-x-y", please check out #23209

@trop
Copy link
Contributor

trop bot commented Apr 22, 2020

@MarshallOfSound has manually backported this PR to "8-x-y", please check out #23231

@trop
Copy link
Contributor

trop bot commented Apr 22, 2020

@MarshallOfSound has manually backported this PR to "7-2-x", please check out #23232

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Apr 22, 2020
@trop trop bot removed the in-flight/8-x-y label Apr 22, 2020
@trop trop bot added the merged/8-x-y label Apr 22, 2020
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.

None yet

2 participants