chromium/third_party/blink/renderer/core/loader/web_bundle/script_web_bundle.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/loader/web_bundle/script_web_bundle.h"

#include "base/metrics/histogram_functions.h"
#include "base/unguessable_token.h"
#include "components/web_package/web_bundle_utils.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/cross_origin_attribute.h"
#include "third_party/blink/renderer/core/html/html_script_element.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/loader/web_bundle/script_web_bundle_rule.h"
#include "third_party/blink/renderer/core/loader/web_bundle/web_bundle_loader.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/loader/cors/cors.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/subresource_web_bundle_list.h"
#include "third_party/blink/renderer/platform/scheduler/public/event_loop.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

// MicroTask which is used to release a webbundle resource.
class ScriptWebBundle::ReleaseResourceTask {};

absl::variant<ScriptWebBundle*, ScriptWebBundleError>
ScriptWebBundle::CreateOrReuseInline(ScriptElementBase& element,
                                     const String& source_text) {}

ScriptWebBundle::ScriptWebBundle(ScriptElementBase& element,
                                 Document& element_document,
                                 const ScriptWebBundleRule& rule)
    :{}

void ScriptWebBundle::Trace(Visitor* visitor) const {}

bool ScriptWebBundle::CanHandleRequest(const KURL& url) const {}

const KURL& ScriptWebBundle::GetBundleUrl() const {}
const base::UnguessableToken& ScriptWebBundle::WebBundleToken() const {}
String ScriptWebBundle::GetCacheIdentifier() const {}

void ScriptWebBundle::OnWebBundleError(const String& message) const {}

// |bundle_loader_| can be null here, if the script element
// is removed from the document and the microtask already
// cleaned up the pointer to the loader.
void ScriptWebBundle::NotifyLoadingFinished() {}

bool ScriptWebBundle::IsScriptWebBundle() const {}

bool ScriptWebBundle::WillBeReleased() const {}

network::mojom::CredentialsMode ScriptWebBundle::GetCredentialsMode() const {}

bool ScriptWebBundle::IsSameOriginBundle() const {}

void ScriptWebBundle::CreateBundleLoaderAndRegister() {}

void ScriptWebBundle::ReleaseBundleLoaderAndUnregister() {}

void ScriptWebBundle::WillReleaseBundleLoaderAndUnregister() {}

// This function updates the WebBundleRule, element_ and cancels the release
// of a reused WebBundle. Also if the reused bundle fired load/error events,
// fire them again as we reuse the bundle.
// TODO(crbug/1263783): Explore corner cases of WebBundle reusing and how
// load/error events should be handled then.
void ScriptWebBundle::ReusedWith(ScriptElementBase& element,
                                 ScriptWebBundleRule rule) {}

}  // namespace blink