Extensions: declarativeNetRequest rules not applied when Brave opens

Description of the issue:
I have created an extension which uses a single static rule from the declarativeNetRequest API (the Blocking Rule). I would expect the Blocking Rule to be applied when Brave is launched, but it is not applied until I reload the extension(1). When I install the same extension in Chrome it functions as I would expect.

I discovered this issue whilst developing an extension which uses a dynamic ruleset from that same API. The static ruleset is also affected and allows a minimal reproducible case to be provided.

(1) For an extension loaded unpacked, the Blocking Rule is applied after the extension has been reloaded. For an extension installed as a CRX, the Blocking Rule is applied after the extension has been disabled and re-enabled.

How can this issue be reproduced?
The extension code is as follows:

---- manifest.json ----
“name”: “Basic declarativeNetRequest ruleset”,
“description”: “Basic declarativeNetRequest ruleset”,
“version”: “1.0”,
“manifest_version”: 3,

“declarative_net_request” : {
“rule_resources” : [{
“id”: “ruleset_1”,
“enabled”: true,
“path”: “rules.json”

“permissions”: [
---- end ----

---- rules.json ----
“id”: 1,
“priority”: 1,
“action”: {
“type” : “block”
“condition”: {
“urlFilter”: “||example.com”,
“resourceTypes”: [“main_frame”]
---- end ----

  1. Install the extension (unpacked or CRX, it’s the same either way)
  2. Close Brave (all profiles)
  3. Open Brave
  4. In a tab, navigate to https://example.com

Expected result:
The extension should block access to the site “example.com”.

Brave Version( check About Brave):
Version 1.61.101 Chromium: 120.0.6099.71 (Official Build) (64-bit)

It works in Chrome:
Version 120.0.6099.71 (Official Build) (64-bit)

Additional Information:
Could you make it less difficult to copy the Brave Version information please?

Since the error is not present in Chrome I don’t suppose this matters, but I am running Fedora Silverblue 39 with both browsers installed in a container based on Fedora 38.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.