[DNR] Consider adding a startupCache file for the DNR store rules
Categories
(WebExtensions :: Request Handling, task, P2)
Tracking
(firefox113 fixed)
Tracking | Status | |
---|---|---|
firefox113 | --- | fixed |
People
(Reporter: rpl, Assigned: rpl)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [addons-jira])
Attachments
(1 file, 2 obsolete files)
(deleted),
text/x-phabricator-request
|
Details |
As a followup to Bug 1745763 we are going to consider introducing a startupCache file for the DNR rules store, as some additional context:
- for the static rules, the extension can enable and disable an entire static ruleset (and not single rules as for dynamic or session rules), and so the DNR store will only be tracking the list of static ruleset ids that are currently enabled, while the actual rules associated to each static ruleset is already in a static json file packaged with the extension
- on the next browser startup, DNR internals will load the DNR store data and to convert the list of ruleset ids into the sets of actual rules, all the static rulesets json files packaged with the extension will have to be loaded again and also validate and normalize each of the rules being loaded
And so, to minimize the amount of work needed to initialize the DNR store and be ready to process intercepted network requests near after the browser startup, we are considering to store into a startupCache file the last status of the DNR store, included all the enbled rules already normalized and validated.
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
This draft patch adds a per-extension startupCache file for the DNR data store,
I decided to split it out from the other patch because we may consider a
different strategy (e.g. one startup cache file for all extensions) and to
move this part in its own followup bugzilla issue.
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
DNRStore
's #getManifestStaticRulesets
method is currently using extension.readJSON
to load the JSON files
for the DNR static rulesets enabled, but internally extension.readJSON
calls String.prototype.replace
with
a regular expression to remove inline comments from the JSON files data retrieved and that have a noticebeable
impact due to the size that the DNR rulesets size may likely have (especially compared to the usual size of
manifest.json and locale files may have).
Given that Chrome doesn't support inline comments in DNR rulesets, we can consider replacing the call to
extension.readJSON
with fetch
, which wouldn't allow inline comments in the rulesets JSON files but
it would have a smaller impact due to not going through a call to String.prototype.replace
and through
the js RegExp evaluations.
Alternatively we may consider keeping the call to extension.readJSON
but tweak it to make sure we opt
out from the call to String.prototype.replace
for this particular call (by also tweaking readJSON
method to allow that).
Depends on D162402
Comment 4•2 years ago
|
||
Comment on attachment 9323100 [details]
Bug 1803365 - Replace extension.readJSON with fetch to reduce perf impact of loading the DNR ruleset. r?robwu!
Revision D172604 was moved to bug 1823390. Setting attachment 9323100 [details] to obsolete.
Comment 5•2 years ago
|
||
Comment on attachment 9323099 [details]
Bug 1803365 - Fix typo in assertion message in head_dnr.js. r?robwu!
Revision D172603 was moved to bug 1823390. Setting attachment 9323099 [details] to obsolete.
Comment 7•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•