Bug 1432901 - Part 7: Add a load context for use by the new module loader r=yulia

This will be used to hold compilation results before they are passed to the base class.

Differential Revision: https://phabricator.services.mozilla.com/D145561
This commit is contained in:
Jon Coppeard
2022-05-10 12:58:08 +00:00
parent 24c19a18f2
commit 76d2b6c960
6 changed files with 52 additions and 8 deletions

View File

@@ -123,11 +123,21 @@ void ScriptLoadRequest::DropBytecodeCacheReferences() {
DropJSObjects(this);
}
bool ScriptLoadRequest::HasScriptLoadContext() const {
return HasLoadContext() && mLoadContext->IsWindowContext();
}
mozilla::dom::ScriptLoadContext* ScriptLoadRequest::GetScriptLoadContext() {
MOZ_ASSERT(mLoadContext);
return mLoadContext->AsWindowContext();
}
mozilla::loader::ComponentLoadContext*
ScriptLoadRequest::GetComponentLoadContext() {
MOZ_ASSERT(mLoadContext);
return mLoadContext->AsComponentContext();
}
ModuleLoadRequest* ScriptLoadRequest::AsModuleRequest() {
MOZ_ASSERT(IsModuleRequest());
return static_cast<ModuleLoadRequest*>(this);