#54731: test: unregister the session content script before registering it again
Merged
Description of Change
The chrome.scripting registerContentScripts spec registers a content script with the fixed id 'session-script', in a session that persists across retries.
On a retry, the earlier attempt's script is still registered.
registerContentScripts() then rejects with "Duplicate script ID 'session-script'", the background page never responds, and the retry times out.
This change makes the fixture's background page unregister that id first if it's already registered.
Only test code changes.
Validation
Ran on a local Linux testing build of main under Xvfb:
e test --files spec/extensions.spec.ts -g chrome.scripting: 5 passed.- As a control, I made the test throw once on its first attempt and ran it with CI retries (
CI=1). With the old fixture, the retry logged "Duplicate script ID 'session-script'" and failed. With this change, the retry passed. script/lint.js --jspasses.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: none
Backports
45-x-y
MergedPR Number
#54770Merged At
Oct 8, 2026, 2:03:33 PM
Released In
v45.0.0-beta.1Release Date
Oct 8, 2026, 7:07:44 PM
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron