Register blocking header rewrites only on manifest v2

PE
7d ago
+551-65

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

  • Compatibility
    • Bing and Claude request headers continue to be updated on extension manifest versions below 3. Manifest version 3 and later do not use blocking header listeners.
  • Reliability
    • Header updates handle capitalization differences and leave requests unchanged when headers cannot be safely updated.
    • Errors are logged without exposing header values; Bing header names are logged when updates occur.