Closed Bug 1745758 Opened 2 years ago Closed 1 year ago

[DNR] Prototype of rule evaluation engine


(WebExtensions :: Request Handling, enhancement, P1)



(firefox108 fixed)

108 Branch
Tracking Status
firefox108 --- fixed


(Reporter: robwu, Assigned: robwu)


(Blocks 3 open bugs)


(Whiteboard: [mv3-m2])


(2 files)

The declarativeNetRequest API specifies a set of rules (conditions + actions) to apply to network requests, but does not prescribe the exact algorithm. In order to enable experimentation of different algorithms, I'll start the patch stack with a non-optimized implementation of a rule evaluation engine and use that to implement the different parts of the DNR API at a functional level. With a functioning API, it will be easier to refactor the algorithm without major changes to unit tests or performance tests.

The evaluation engine takes a registered set of rules, evaluates the conditions and applies the relevant actions.

The matching algorithm of the prototype is not optimized and not final, and merely exists to prepare the other parts of the DNR API.

Flags: needinfo?(mdrahulkhan2021)
Flags: needinfo?(mdrahulkhan2021)
Points: --- → 5
Points: 5 → 8
Depends on: 1780747
Points: 8 → 5
Blocks: 1782685
Blocks: 1786059

This patch provides a rule evaluation engine for the DNR extension API,
using a naive linear API to evaluate rules for a given request.

The main purpose of this is to offer DNR functionality for relatively
simple use cases, as the more complex ones are likely going to use the
blocking webRequest API instead.

And added "TODO bug 1797376" to the hostname format in Schemas.jsm,
because the implementation does not match the name. Because of that,
this patch introduces the new "canonicalDomain" schema format.

Blocks: 1798225
Pushed by
Add DNR rule evaluation engine r=rpl
Add DNR domain condition validation + matching r=rpl

Backed out for causing xpc failures in toolkit/components/extensions/test/xpcshell/test_ext_dnr_testMatchOutcome.js

Backout link:

Push with failures

Failure log

TEST-UNEXPECTED-TIMEOUT | xpcshell-remote.ini:toolkit/components/extensions/test/xpcshell/test_ext_dnr_testMatchOutcome.js | Test timed out
Flags: needinfo?(rob)
Flags: needinfo?(rob)
Pushed by
Add DNR rule evaluation engine r=rpl
Add DNR domain condition validation + matching r=rpl
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.