-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
Describe the bug
Background page should not be persistent.
To Reproduce
Steps to reproduce the behavior:
- Install extension in Chrome and close all dev tools, including Svelte.
- Open Chrome Task manager (click Shift+ESC).
- See "Extension: Svelte Devtools" in the process list, even though extension is not in use.
Expected behavior
When extension is not in use, it should not consume computer resources (RAM).
Environment
- Browser: Any (Chrome 91)
- Devtools version: Any (built from master)
- Svelte version: Any (3.38.2)
Additional context
If you are interested, I can file a PR to fix this. Right now, only Chrome supports non-persistent pages, but Firefox plans to add support soonTM.
Plan
I will break up this into a few PRs. Here is a tentative plan (no particular order):
WIP (all these are blocked on already opened PRs):
- (TODO) Store and retreive Background context variables from
chrome.storage.local
when needed - (TODO) Optimization: let background open and close persistent ports with DevTools only when needed
- (TODO) Declare background non-persistent in
manifest.json
and test it!
Review:
- Avoid excessive chrome.tabs.onUpdated invocations #62
Optimization: avoidchrome.tabs.onUpdated
because it is triggered for every single other tab.
Frequent callback runs restore background into active state unnecessarily. - Send messages from DevTools to BG via one-time messages #60
Done:
- Avoid persistent ports in content scripts #54 Removes
pagePorts
insrc/background.js
- Store profiler enabled/disabled state in inspected window's sessionStorage #53 Fix: background has two handlers for
'startProfiler'
(one is dead) and no handler for'stopProfiler'
- Store profiler enabled/disabled state in inspected window's sessionStorage #53 Get rid of gloal
profilerEnabledList
insrc/background.js
Value of this variable is set in DevTools tab and is used in content script. It makes sense to store it in either one, but not in background.
Edit: add plan!
Metadata
Metadata
Assignees
Labels
No labels