| Index: third_party/WebKit/Source/core/dom/ModuleScript.h
|
| diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.h b/third_party/WebKit/Source/core/dom/ModuleScript.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2ab708a55ea95eb317990a51fcc7b033add52c8f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/dom/ModuleScript.h
|
| @@ -0,0 +1,73 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef ModuleScript_h
|
| +#define ModuleScript_h
|
| +
|
| +#include "bindings/core/v8/ScriptModule.h"
|
| +#include "bindings/core/v8/ScriptValue.h"
|
| +#include "platform/heap/Handle.h"
|
| +#include "platform/weborigin/KURL.h"
|
| +#include "public/platform/WebURLRequest.h"
|
| +
|
| +namespace blink {
|
| +
|
| +// https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-state
|
| +enum class InstantiationState {
|
| + Uninstantiated,
|
| + Errored,
|
| + Instantiated,
|
| +};
|
| +
|
| +// ModuleScript is a model object for the "module script" spec concept.
|
| +// https://html.spec.whatwg.org/multipage/webappapis.html#module-script
|
| +class ModuleScript final : public GarbageCollectedFinalized<ModuleScript> {
|
| + public:
|
| + static ModuleScript* create(ScriptModule record, const KURL& baseURL) {
|
| + return new ModuleScript(record, baseURL);
|
| + }
|
| + ~ModuleScript() = default;
|
| +
|
| + ScriptModule record() { return m_record; }
|
| + const KURL& baseURL() { return m_baseURL; }
|
| +
|
| + InstantiationState instantiationState() const { return m_instantiationState; }
|
| + void updateStateAfterInstantiation(ScriptValue maybeError);
|
| +
|
| + void propagateUpstreamError(ScriptValue error);
|
| + void propagateUpstreamSuccess();
|
| +
|
| + ScriptValue instantiationError() const { return m_instantiationError; }
|
| +
|
| + DEFINE_INLINE_TRACE() {}
|
| +
|
| + private:
|
| + ModuleScript(ScriptModule record, const KURL& baseURL)
|
| + : m_record(record), m_baseURL(baseURL) {}
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-module-record
|
| + ScriptModule m_record;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-base-url
|
| + const KURL m_baseURL;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-state
|
| + InstantiationState m_instantiationState = InstantiationState::Uninstantiated;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-error
|
| + ScriptValue m_instantiationError;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-credentials-mode
|
| + // const WebURLRequest::FetchCredentialsMode m_credentialsMode;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-nonce
|
| + // const String m_nonce;
|
| +
|
| + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-parser
|
| + // const ParserDisposition m_parserState;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif
|
|
|