Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeify committed Jan 9, 2024
1 parent b71c104 commit 593ead7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions WebExtensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# WebExtensions

## Manifest v3

## declarativeNetRequest

Instead of procedurally blocking or modifying requests and responses, requires developers to implement a "rules" DSL on how requests should be blocked by the browser:
Consists of four properties, one of which is optional:

* `id`
* `priority` (optional). If left off, `priority`=1
* `condition`, an object containing predicate(s) the browser will evaluate.
* `action`, the response to take if the condition yields true, an object where the `type` property is either `block` or `modifyHeaders`.

### [`updateStaticRules`](https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#method-updateStaticRules)

Supposedly implemented in Chrome 111 (associated GitHub ticket), with [chromium tests here](https://chromium.googlesource.com/chromium/src/+/86cf9e194ae801b3bfde08c253a7a12dae6b0cb7/chrome/test/data/extensions/api_test/declarative_net_request/update_static_rules/background.js).
However, doesn't actually appear to work in the real-world—static rules that are disabled via this method call continue to be registered with the `declarativeNetRequest` API and continue work.
Programmatically though, the API seems to function correctly to the point where the unit tests implemented in Chromium obviously pass.

Not implemented in Safari ([WebKit ticket](https://bugs.webkit.org/show_bug.cgi?id=261039)) or Firefox.

### `updateEnabledRulesets`

A workaround is instead of updating rules, just have one rule per ruleset and use the actually functional (in Chrome) at least `updateEnabledRulesets`.

0 comments on commit 593ead7

Please sign in to comment.