Closed Bug 1746852 Opened 5 months ago Closed 5 months ago

user scripts aren't unregistered when context is getting closed

Categories

(WebExtensions :: General, defect, P1)

defect

Tracking

(firefox97 fixed)

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: willdurand, Assigned: willdurand)

References

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

We call unregisterContentScripts() when the context is getting closed here: https://searchfox.org/mozilla-central/source/toolkit/components/extensions/parent/ext-userScripts.js#95-99 but the problem is that registeredScriptIds is an empty set because we don't add any scriptId when we register a user script (in userScripts.register() a few lines below).

We should add the scriptId of a newly registered user script to the registeredScriptIds set so that we unregister all of them when the context is being closed.

Assignee: nobody → wdurand

We register a function that is called when the context is getting closed
but this function relies on a set of script IDs that is always empty,
because we don't add any IDs to it when we register a user script. This
patch adds script IDs of registered user scripts to this set.

Pushed by wdurand@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5eb78be7a83c
Add `scriptId` to `registeredScriptIds` to be able to unregister all user scripts when context is being closed. r=rpl
Severity: -- → S3
Priority: -- → P1
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Whiteboard: [addons-jira]
You need to log in before you can comment on or make changes to this bug.