Closed Bug 1826460 Opened 8 months ago Closed 8 months ago

[DNR] Make sure clearRuleManager is called on extension shutdown

Categories

(WebExtensions :: Request Handling, defect)

defect

Tracking

(firefox113 fixed)

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

ExtensionDNR.clearRuleManager is currently being called from the onShutdown lifecycle method defined in the DNR ExtensionAPI subclass, but the onShutdown lifecycle method is only going to be called on extension shutdown if the DNR ExtensionAPI class has been instantiated.

The DNR ExtensionAPI class isn't going to be instantiated unless the extension does either:

  • include a declarative_net_request property in the manifest.json file
  • the extension has called a declarativeNetRequest API method at least once

When an extension has been installed and some DNR rules are being already registered, e.g. through declarativeNetRequest.updateDynamicRules which doesn't need a declarative_net_request to be part of the manifest, the rules will be persisted on disk and on the next extension startup DNR make be initialized even if the extension will never call any other declarativeNetRequest API method anymore, and in that case a RuleManager will be created and registered to ExtensionDNR and then never removed after the extension is shutdown.

We should make sure to register an extension shutdown listener to clear the RuleManager as part of initializing DNR for the same extension, so that it is going to be clearer independently from the declarativeNetRequest ExtensionAPI class being instantiated or not.

Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/cea75783d776
Make sure ExtensionDNR.clearRuleManager is called extension shutdown. r=robwu
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.