Bug 1540913 - Part 1: allow ModuleLoaders to return BaseURI without ScriptLoader;r=jonco
This is a required change for dynamic import on workers, as the ScriptLoader is not guaranteed to live long enough. Once the initial script loading is finished, and the script has executed, the scriptloader is cleared and the strong reference to the workerRef is cleared so that shutdown is possible. The workerRef is required in order to access the worker private safely. In order to address this, we move the GetBaseURI method to the module loader itself. In the future, we should remove the script loader interface all together. Differential Revision: https://phabricator.services.mozilla.com/D171682
This commit is contained in:
@@ -204,6 +204,8 @@ class ModuleLoaderBase : public nsISupports {
|
||||
// Called to break cycles during shutdown to prevent memory leaks.
|
||||
void Shutdown();
|
||||
|
||||
virtual nsIURI* GetBaseURI() const { return mLoader->GetBaseURI(); };
|
||||
|
||||
using LoadedScript = JS::loader::LoadedScript;
|
||||
using ScriptFetchOptions = JS::loader::ScriptFetchOptions;
|
||||
using ScriptLoadRequest = JS::loader::ScriptLoadRequest;
|
||||
|
||||
Reference in New Issue
Block a user