perf(extensions): clean sandbox lifecycle handles#550
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ExtensionViewlifecycle scope that gives extension bundles scopedwindowanddocumentobjects during evaluation.window.setInterval,window.setTimeout,window.requestAnimationFrame,window.addEventListener, and matching document listener APIs through the existing cleanup registry.window.*leak and verifies cleanup on unmount and re-evaluation.Why
Extension bundles could bypass the existing bare timer registry by calling
window.*APIs from module scope or effects. No-view/background runs and remounted menu-bar extensions could then leave renderer DOM timers/listeners alive after theExtensionViewinstance was gone.Compatibility impact
window.document,window.navigator,window.location, andwindow.electron.window,self,global, andglobalThisresolve to the same scoped object inside the extension wrapper.Lifecycle evidence
node --test scripts/test-extension-lifecycle-sandbox.mjs:intervals=1,windowListeners=1,documentListeners=1,total=3.total=3, registry seesintervals=1andeventListeners=2, cleanup ends attotal=0.3 -> 0 -> 3 -> 0across prior evaluation cleanup and final unmount.How tested
node --test scripts/test-extension-lifecycle-sandbox.mjs./node_modules/.bin/vite buildsrc/renderer/src/ExtensionView.tsx: no errors./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmitwas run and still fails on existing unrelatedorigin/mainrenderer type errors, includingApp.tsx,CameraExtension.tsx,raycast-api, settings, and quicklink icon typings.Stack validation
origin/main; no stacked integration commits included.