LoadableClassicScript.h [plain text]
#pragma once
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
#include "CachedScript.h"
#include "LoadableScript.h"
#include <wtf/TypeCasts.h>
namespace WebCore {
class LoadableClassicScript final : public LoadableScript, private CachedResourceClient {
public:
virtual ~LoadableClassicScript();
static Ref<LoadableClassicScript> create(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree);
bool isLoaded() const final;
std::optional<Error> error() const final;
bool wasCanceled() const final;
CachedScript& cachedScript() { return *m_cachedScript; }
bool isClassicScript() const final { return true; }
bool isModuleScript() const final { return false; }
void execute(ScriptElement&) final;
bool load(Document&, const URL&);
private:
LoadableClassicScript(const String& nonce, const String& integrity, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)
: LoadableScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree)
, m_integrity(integrity)
{
}
void notifyFinished(CachedResource&) final;
CachedResourceHandle<CachedScript> m_cachedScript { };
std::optional<Error> m_error { std::nullopt };
String m_integrity;
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::LoadableClassicScript)
static bool isType(const WebCore::LoadableScript& script) { return script.isClassicScript(); }
SPECIALIZE_TYPE_TRAITS_END()