ckerr

#54731: test: unregister the session content script before registering it again

Merged
Created: Oct 7, 2026, 4:20:21 PM
Merged: Oct 8, 2026, 11:02:39 AM
5 comments
Target: main

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 --js passes.

🤖 Generated with Claude Code

Checklist

Release Notes

Notes: none

Backports

42-x-y
Merged
PR Number
#54769
Merged At
Oct 8, 2026, 2:03:29 PM
Released In
Not yet
Release Date
Not yet
43-x-y
Merged
PR Number
#54768
Merged At
Oct 8, 2026, 2:03:25 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#54771
Merged At
Oct 8, 2026, 2:03:37 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#54770
Merged At
Oct 8, 2026, 2:03:33 PM
Released In
v45.0.0-beta.1
Release 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