[DNR] Replace extension.readJSON with fetch for reading static rules JSON files
Categories
(WebExtensions :: Request Handling, task, P1)
Tracking
(firefox113 fixed)
Tracking | Status | |
---|---|---|
firefox113 | --- | fixed |
People
(Reporter: rpl, Assigned: rpl)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [addons-jira])
Attachments
(2 files)
DNRStore
's #getManifestStaticRulesets
method is currently calling 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 noticeable 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 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.
Assignee | ||
Comment 1•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).
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Pushed by luca.greco@alcacoop.it: https://hg.mozilla.org/integration/autoland/rev/f8ed3816d6f1 Fix typo in assertion message in head_dnr.js. r=robwu https://hg.mozilla.org/integration/autoland/rev/754403851a9d Replace extension.readJSON with fetch to reduce perf impact of loading the DNR ruleset. r=robwu
Comment 4•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f8ed3816d6f1
https://hg.mozilla.org/mozilla-central/rev/754403851a9d
Description
•