diff options
Diffstat (limited to 'dom/workers/ScriptLoader.cpp')
-rw-r--r-- | dom/workers/ScriptLoader.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 73997b2725..9dcb1d0c9a 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -517,9 +517,7 @@ already_AddRefed<WorkerScriptLoader> WorkerScriptLoader::Create( } // Set up the module loader, if it has not been initialzied yet. - if (!aWorkerPrivate->IsServiceWorker()) { - self->InitModuleLoader(); - } + self->InitModuleLoader(); return self.forget(); } @@ -1065,8 +1063,8 @@ nsresult WorkerScriptLoader::LoadScript( // This flag reflects the fact that if the worker is created under a // third-party context. nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo(); - loadInfo->SetIsThirdPartyContextToTopWindow( - mWorkerRef->Private()->IsThirdPartyContextToTopWindow()); + loadInfo->SetIsInThirdPartyContext( + mWorkerRef->Private()->IsThirdPartyContext()); Maybe<ClientInfo> clientInfo; clientInfo.emplace(loadContext->mClientInfo.ref()); @@ -1856,12 +1854,6 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult, NS_ConvertUTF16toUTF8(aScriptURL).get()); switch (aLoadResult) { - case NS_ERROR_FILE_NOT_FOUND: - case NS_ERROR_NOT_AVAILABLE: - case NS_ERROR_CORRUPTED_CONTENT: - aRv.Throw(NS_ERROR_DOM_NETWORK_ERR); - break; - case NS_ERROR_MALFORMED_URI: case NS_ERROR_DOM_SYNTAX_ERR: aRv.ThrowSyntaxError(err); @@ -1877,7 +1869,7 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult, // make it impossible for consumers to realize that our error was // NS_BINDING_ABORTED. aRv.Throw(aLoadResult); - return; + break; case NS_ERROR_DOM_BAD_URI: // This is actually a security error. @@ -1885,15 +1877,16 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult, aRv.ThrowSecurityError(err); break; + case NS_ERROR_FILE_NOT_FOUND: + case NS_ERROR_NOT_AVAILABLE: + case NS_ERROR_CORRUPTED_CONTENT: + case NS_ERROR_DOM_NETWORK_ERR: + // For lack of anything better, go ahead and throw a NetworkError here. + // We don't want to throw a JS exception, because for toplevel script + // loads that would get squelched. default: - // For lack of anything better, go ahead and throw a NetworkError here. - // We don't want to throw a JS exception, because for toplevel script - // loads that would get squelched. - aRv.ThrowNetworkError(nsPrintfCString( - "Failed to load worker script at %s (nsresult = 0x%" PRIx32 ")", - NS_ConvertUTF16toUTF8(aScriptURL).get(), - static_cast<uint32_t>(aLoadResult))); - return; + aRv.Throw(NS_ERROR_DOM_NETWORK_ERR); + break; } } |