Repository navigation
Register blocking header rewrites only on manifest v2 - #1122
PeterDaveHello wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
PR Summary by QodoSkip ineffective header rewrite listeners on Manifest V3
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
[High impact] The PR appears safe to merge; no actionable issues were found. SummaryMoves Bing and Claude header listeners into a shared module and registers them only on Manifest V2.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — extracted the Manifest V2-only Bing/Claude blocking header-rewrite listeners into a testable module and gated their registration on the manifest version.
src/background/index.mjs— the two inlineonBeforeSendHeadersregistrations are replaced by oneregisterBlockingHeaderListeners(Browser.webRequest, Browser.runtime.getManifest().manifest_version)call, still inside the existingtry { … } catchfor webRequest setup.src/background/webrequest-listeners.mjs— new module exporting the rewrite value maps andregisterBlockingHeaderListeners; it returns early on MV3+ and registers both listeners with['requestHeaders', 'blocking']on MV2. Unknown/missingrequestHeadersand thrown rewrites now fail closed (undefined) instead of returning a partially mutated array, and error logs carry only the URL.tests/unit/background/webrequest-listeners.test.mjs— covers registration gating, rewrites, fail-closed behavior, log sanitization, and keepsrules.jsonand the manifest expectations in sync with the listener filters.
The MV3 removal is provably a no-op reduction: the old listeners already ran non-blocking there ('blocking' was gated on manifest_version < 3), so their return values were discarded, and rules.json rules 1/3 remain the MV3 mechanism. MV2 registration and rewrite behavior are unchanged. I verified the suite (npm test, 1122 passing, including the 15 new tests), eslint/prettier on the changed files, and a production build — all green.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The manifest gating is correct, preserves existing rewrite behavior, and is comprehensively tested.
0 open findings
What changed in this PR
Limits blocking header rewrites to Manifest V2 while preserving Manifest V3 DNR behavior.
Changes:
- Extracts Bing and Claude header rewriting into a tested module.
- Removes unnecessary Manifest V3 listeners and sensitive failure logging.
- Adds coverage for registration, rewrites, failure handling, and DNR consistency.
| File | Description |
|---|---|
src/background/index.mjs |
Uses the manifest-aware registration helper. |
src/background/webrequest-listeners.mjs |
Implements gated, defensive header rewrites. |
tests/unit/background/webrequest-listeners.test.mjs |
Tests listeners and DNR parity. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d0e7869 to
c9f5f90
Compare
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Re-trigger cubic
|
Code review by qodo was updated up to the latest commit c9f5f90 |
Skip ineffective Bing and Claude listeners on manifest v3, where the existing DNR rules handle header rewrites. Preserve manifest v2 rewrites, remove per-request debug logging, and handle rewrite failures consistently. Add tests for listener registration, rewrites, and DNR rule consistency.
c9f5f90 to
bdee8a5
Compare
|
Code review by qodo was updated up to the latest commit bdee8a5 |

Register Bing and Claude blocking header rewrites only on this project's Manifest V2 builds. Its Manifest V3 build uses existing DNR rules and does not need the non-blocking JavaScript listeners.
Extract the listeners into a testable module, remove unconditional request logging, and discard partial rewrites on failure. Add tests for registration, rewrites, logging, and DNR rule consistency.
Summary by CodeRabbit