Bug 1747059 - Add ShadowRealm module loader support to ScriptLoader r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D147465
This commit is contained in:
@@ -172,7 +172,7 @@ NS_IMPL_CYCLE_COLLECTION(ScriptLoader, mNonAsyncExternalScriptInsertedRequests,
|
||||
mXSLTRequests, mParserBlockingRequest,
|
||||
mBytecodeEncodingQueue, mPreloads,
|
||||
mPendingChildLoaders, mModuleLoader,
|
||||
mWebExtModuleLoaders)
|
||||
mWebExtModuleLoaders, mShadowRealmModuleLoaders)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptLoader)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptLoader)
|
||||
@@ -279,6 +279,13 @@ void ScriptLoader::RegisterContentScriptModuleLoader(ModuleLoader* aLoader) {
|
||||
mWebExtModuleLoaders.AppendElement(aLoader);
|
||||
}
|
||||
|
||||
void ScriptLoader::RegisterShadowRealmModuleLoader(ModuleLoader* aLoader) {
|
||||
MOZ_ASSERT(aLoader);
|
||||
MOZ_ASSERT(aLoader->GetScriptLoader() == this);
|
||||
|
||||
mShadowRealmModuleLoaders.AppendElement(aLoader);
|
||||
}
|
||||
|
||||
// Collect telemtry data about the cache information, and the kind of source
|
||||
// which are being loaded, and where it is being loaded from.
|
||||
static void CollectScriptTelemetry(ScriptLoadRequest* aRequest) {
|
||||
@@ -2684,6 +2691,12 @@ bool ScriptLoader::HasPendingDynamicImports() const {
|
||||
}
|
||||
}
|
||||
|
||||
for (ModuleLoader* loader : mShadowRealmModuleLoaders) {
|
||||
if (loader->HasPendingDynamicImports()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3522,6 +3535,10 @@ void ScriptLoader::ParsingComplete(bool aTerminated) {
|
||||
loader->CancelAndClearDynamicImports();
|
||||
}
|
||||
|
||||
for (ModuleLoader* loader : mShadowRealmModuleLoaders) {
|
||||
loader->CancelAndClearDynamicImports();
|
||||
}
|
||||
|
||||
if (mParserBlockingRequest) {
|
||||
mParserBlockingRequest->Cancel();
|
||||
mParserBlockingRequest = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user