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

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: snapshot Created 3 years, 10 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ModuleScript_h 5 #ifndef ModuleScript_h
6 #define ModuleScript_h 6 #define ModuleScript_h
7 7
8 #include "bindings/core/v8/ScriptModule.h" 8 #include "bindings/core/v8/ScriptModule.h"
9 #include "bindings/core/v8/ScriptValue.h"
9 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "platform/loader/fetch/ResourceLoaderOptions.h" 12 #include "platform/loader/fetch/ResourceLoaderOptions.h"
12 #include "platform/weborigin/KURL.h" 13 #include "platform/weborigin/KURL.h"
13 #include "public/platform/WebURLRequest.h" 14 #include "public/platform/WebURLRequest.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script- instantiation-state 18 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script- instantiation-state
18 enum class ModuleInstantiationState { 19 enum class ModuleInstantiationState {
(...skipping 15 matching lines...) Expand all
34 WebURLRequest::FetchCredentialsMode credentialsMode) { 35 WebURLRequest::FetchCredentialsMode credentialsMode) {
35 return new ModuleScript(record, baseURL, nonce, parserState, 36 return new ModuleScript(record, baseURL, nonce, parserState,
36 credentialsMode); 37 credentialsMode);
37 } 38 }
38 ~ModuleScript() = default; 39 ~ModuleScript() = default;
39 40
40 ScriptModule& record() { return m_record; } 41 ScriptModule& record() { return m_record; }
41 void clearRecord() { m_record = ScriptModule(); } 42 void clearRecord() { m_record = ScriptModule(); }
42 const KURL& baseURL() const { return m_baseURL; } 43 const KURL& baseURL() const { return m_baseURL; }
43 44
45 ModuleInstantiationState instantiationState() const {
46 return m_instantiationState;
47 }
48
49 void setInstantiationSuccess();
50 void setInstantiationError(ScriptValue);
51
44 ParserDisposition parserState() const { return m_parserState; } 52 ParserDisposition parserState() const { return m_parserState; }
45 WebURLRequest::FetchCredentialsMode credentialsMode() const { 53 WebURLRequest::FetchCredentialsMode credentialsMode() const {
46 return m_credentialsMode; 54 return m_credentialsMode;
47 } 55 }
48 const String& nonce() const { return m_nonce; } 56 const String& nonce() const { return m_nonce; }
49 57
50 ModuleInstantiationState instantiationState() const {
51 return m_instantiationState;
52 }
53
54 DECLARE_TRACE(); 58 DECLARE_TRACE();
55 59
56 private: 60 private:
57 ModuleScript(ScriptModule record, 61 ModuleScript(ScriptModule record,
58 const KURL& baseURL, 62 const KURL& baseURL,
59 const String& nonce, 63 const String& nonce,
60 ParserDisposition parserState, 64 ParserDisposition parserState,
61 WebURLRequest::FetchCredentialsMode credentialsMode) 65 WebURLRequest::FetchCredentialsMode credentialsMode)
62 : m_record(record), 66 : m_record(record),
63 m_baseURL(baseURL), 67 m_baseURL(baseURL),
(...skipping 10 matching lines...) Expand all
74 ScriptModule m_record; 78 ScriptModule m_record;
75 79
76 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-base-url 80 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-base-url
77 const KURL m_baseURL; 81 const KURL m_baseURL;
78 82
79 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-state 83 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-state
80 ModuleInstantiationState m_instantiationState = 84 ModuleInstantiationState m_instantiationState =
81 ModuleInstantiationState::Uninstantiated; 85 ModuleInstantiationState::Uninstantiated;
82 86
83 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-error 87 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-error
84 // TODO(kouhei): Add a corresponding member. 88 ScriptValue m_instantiationError;
85 89
86 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce 90 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce
87 const String m_nonce; 91 const String m_nonce;
88 92
89 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser 93 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser
90 const ParserDisposition m_parserState; 94 const ParserDisposition m_parserState;
91 95
92 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode 96 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode
93 const WebURLRequest::FetchCredentialsMode m_credentialsMode; 97 const WebURLRequest::FetchCredentialsMode m_credentialsMode;
94 }; 98 };
95 99
96 } // namespace blink 100 } // namespace blink
97 101
98 #endif 102 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleMapTest.cpp ('k') | third_party/WebKit/Source/core/dom/ModuleScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698