Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/dom/ModuleScript.h

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: address haraken/yhirano comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ModuleScript_h
6 #define ModuleScript_h
7
8 #include "bindings/core/v8/ScriptModule.h"
9 #include "bindings/core/v8/ScriptValue.h"
10 #include "platform/heap/Handle.h"
11 #include "platform/weborigin/KURL.h"
12 #include "public/platform/WebURLRequest.h"
13
14 namespace blink {
15
16 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script- instantiation-state
17 enum class InstantiationState {
18 Uninstantiated,
19 Errored,
20 Instantiated,
21 };
22
23 // ModuleScript is a model object for the "module script" spec concept.
24 // https://html.spec.whatwg.org/multipage/webappapis.html#module-script
25 class ModuleScript final : public GarbageCollectedFinalized<ModuleScript> {
26 public:
27 static ModuleScript* create(ScriptModule record, const KURL& baseURL) {
28 return new ModuleScript(record, baseURL);
29 }
30 ~ModuleScript() = default;
31
32 ScriptModule record() { return m_record; }
33 const KURL& baseURL() { return m_baseURL; }
34
35 InstantiationState instantiationState() const { return m_instantiationState; }
36 void updateStateAfterInstantiation(ScriptValue maybeError);
37
38 void propagateUpstreamError(ScriptValue error);
39 void propagateUpstreamSuccess();
40
41 ScriptValue instantiationError() const { return m_instantiationError; }
42
43 DEFINE_INLINE_TRACE() {}
44
45 private:
46 ModuleScript(ScriptModule record, const KURL& baseURL)
47 : m_record(record), m_baseURL(baseURL) {}
48
49 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-module-record
50 ScriptModule m_record;
51
52 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-base-url
53 const KURL m_baseURL;
54
55 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-state
56 InstantiationState m_instantiationState = InstantiationState::Uninstantiated;
57
58 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-error
59 ScriptValue m_instantiationError;
60
61 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode
62 // const WebURLRequest::FetchCredentialsMode m_credentialsMode;
63
64 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce
65 // const String m_nonce;
66
67 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser
68 // const ParserDisposition m_parserState;
69 };
70
71 } // namespace blink
72
73 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698