#include "third_party/blink/renderer/core/workers/worker_classic_script_loader.h"
#include <memory>
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/loader/resource/script_resource.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/loader/fetch/detachable_use_counter.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/unique_identifier.h"
#include "third_party/blink/renderer/platform/network/content_security_policy_response_headers.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
#include "third_party/blink/renderer/platform/network/network_utils.h"
#include "third_party/blink/renderer/platform/weborigin/referrer.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
namespace blink {
namespace {
String CheckSameOriginEnforcement(const KURL& request_url,
const KURL& response_url) { … }
String CheckSameOriginEnforcement(const KURL& request_url,
const ResourceResponse& response) { … }
}
WorkerClassicScriptLoader::WorkerClassicScriptLoader() { … }
void WorkerClassicScriptLoader::LoadSynchronously(
ExecutionContext& execution_context,
ResourceFetcher* fetch_client_settings_object_fetcher,
const KURL& url,
mojom::blink::RequestContextType request_context,
network::mojom::RequestDestination destination) { … }
void WorkerClassicScriptLoader::LoadTopLevelScriptAsynchronously(
ExecutionContext& execution_context,
ResourceFetcher* fetch_client_settings_object_fetcher,
const KURL& url,
std::unique_ptr<WorkerMainScriptLoadParameters>
worker_main_script_load_params,
mojom::blink::RequestContextType request_context,
network::mojom::RequestDestination destination,
network::mojom::RequestMode request_mode,
network::mojom::CredentialsMode credentials_mode,
base::OnceClosure response_callback,
base::OnceClosure finished_callback,
RejectCoepUnsafeNone reject_coep_unsafe_none,
mojo::PendingRemote<network::mojom::blink::URLLoaderFactory>
blob_url_loader_factory,
std::optional<uint64_t> main_script_identifier) { … }
const KURL& WorkerClassicScriptLoader::ResponseURL() const { … }
void WorkerClassicScriptLoader::DidReceiveResponse(
uint64_t identifier,
const ResourceResponse& response) { … }
void WorkerClassicScriptLoader::DidReceiveData(base::span<const char> data) { … }
void WorkerClassicScriptLoader::DidReceiveCachedMetadata(
mojo_base::BigBuffer data) { … }
void WorkerClassicScriptLoader::DidFinishLoading(uint64_t identifier) { … }
void WorkerClassicScriptLoader::DidFail(uint64_t, const ResourceError& error) { … }
void WorkerClassicScriptLoader::DidFailRedirectCheck(uint64_t) { … }
void WorkerClassicScriptLoader::DidReceiveDataWorkerMainScript(
base::span<const char> span) { … }
void WorkerClassicScriptLoader::OnFinishedLoadingWorkerMainScript() { … }
void WorkerClassicScriptLoader::OnFailedLoadingWorkerMainScript() { … }
void WorkerClassicScriptLoader::Trace(Visitor* visitor) const { … }
void WorkerClassicScriptLoader::Cancel() { … }
String WorkerClassicScriptLoader::SourceText() { … }
void WorkerClassicScriptLoader::NotifyError() { … }
void WorkerClassicScriptLoader::NotifyFinished() { … }
void WorkerClassicScriptLoader::ProcessContentSecurityPolicy(
const ResourceResponse& response) { … }
}