Bug 1432901 - Part 12: Break cycles manually during shutdown r=yulia

Since mozJSComponentLoader is destroyed after the cycle collector, we need to
break cycles manually before the final cycle collection otherwise we get a
memory leak. Unload() is called at an appropriate earlier point in shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D145567
This commit is contained in:
Jon Coppeard
2022-05-10 12:58:10 +00:00
parent 68b9ee3b1a
commit 0231a4116a
3 changed files with 16 additions and 0 deletions

View File

@@ -180,6 +180,9 @@ class ModuleLoaderBase : public nsISupports {
nsISerialEventTarget* aEventTarget =
mozilla::GetMainThreadSerialEventTarget());
// Called to break cycles during shutdown to prevent memory leaks.
void Shutdown();
using LoadedScript = JS::loader::LoadedScript;
using ScriptFetchOptions = JS::loader::ScriptFetchOptions;
using ScriptLoadRequest = JS::loader::ScriptLoadRequest;