mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
parent
f3d348ebd7
commit
f0d6e293a3
2 changed files with 14 additions and 14 deletions
|
|
@ -388,12 +388,12 @@ ScriptLoader::ModuleScriptsEnabled()
|
|||
}
|
||||
|
||||
bool
|
||||
ScriptLoader::ModuleMapContainsModule(ModuleLoadRequest *aRequest) const
|
||||
ScriptLoader::ModuleMapContainsURL(nsIURI* aURL) const
|
||||
{
|
||||
// Returns whether we have fetched, or are currently fetching, a module script
|
||||
// for the request's URL.
|
||||
return mFetchingModules.Contains(aRequest->mURI) ||
|
||||
mFetchedModules.Contains(aRequest->mURI);
|
||||
// for a URL.
|
||||
return mFetchingModules.Contains(aURL) ||
|
||||
mFetchedModules.Contains(aURL);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -410,7 +410,7 @@ ScriptLoader::SetModuleFetchStarted(ModuleLoadRequest *aRequest)
|
|||
// Update the module map to indicate that a module is currently being fetched.
|
||||
|
||||
MOZ_ASSERT(aRequest->IsLoading());
|
||||
MOZ_ASSERT(!ModuleMapContainsModule(aRequest));
|
||||
MOZ_ASSERT(!ModuleMapContainsURL(aRequest->mURI));
|
||||
mFetchingModules.Put(aRequest->mURI, nullptr);
|
||||
}
|
||||
|
||||
|
|
@ -443,21 +443,21 @@ ScriptLoader::SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest *
|
|||
}
|
||||
|
||||
RefPtr<GenericPromise>
|
||||
ScriptLoader::WaitForModuleFetch(ModuleLoadRequest *aRequest)
|
||||
ScriptLoader::WaitForModuleFetch(nsIURI* aURL)
|
||||
{
|
||||
MOZ_ASSERT(ModuleMapContainsModule(aRequest));
|
||||
MOZ_ASSERT(ModuleMapContainsURL(aURL));
|
||||
|
||||
RefPtr<GenericPromise::Private> promise;
|
||||
if (mFetchingModules.Get(aRequest->mURI, getter_AddRefs(promise))) {
|
||||
if (mFetchingModules.Get(aURL, getter_AddRefs(promise))) {
|
||||
if (!promise) {
|
||||
promise = new GenericPromise::Private(__func__);
|
||||
mFetchingModules.Put(aRequest->mURI, promise);
|
||||
mFetchingModules.Put(aURL, promise);
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
RefPtr<ModuleScript> ms;
|
||||
MOZ_ALWAYS_TRUE(mFetchedModules.Get(aRequest->mURI, getter_AddRefs(ms)));
|
||||
MOZ_ALWAYS_TRUE(mFetchedModules.Get(aURL, getter_AddRefs(ms)));
|
||||
if (!ms) {
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
|
@ -984,8 +984,8 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
|
|||
// Check whether the module has been fetched or is currently being fetched,
|
||||
// and if so wait for it.
|
||||
ModuleLoadRequest* request = aRequest->AsModuleRequest();
|
||||
if (ModuleMapContainsModule(request)) {
|
||||
WaitForModuleFetch(request)
|
||||
if (ModuleMapContainsURL(request->mURI)) {
|
||||
WaitForModuleFetch(request->mURI)
|
||||
->Then(AbstractThread::GetCurrent(), __func__, request,
|
||||
&ModuleLoadRequest::ModuleLoaded,
|
||||
&ModuleLoadRequest::LoadFailed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue