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

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

Issue 2782403002: [ES6 modules] Implement #concept-module-script-instantiation-error (Closed)
Patch Set: dep Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ModuleScript.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "bindings/core/v8/TraceWrapperV8Reference.h"
10 #include "core/CoreExport.h" 12 #include "core/CoreExport.h"
11 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
12 #include "platform/loader/fetch/ResourceLoaderOptions.h" 14 #include "platform/loader/fetch/ResourceLoaderOptions.h"
13 #include "platform/weborigin/KURL.h" 15 #include "platform/weborigin/KURL.h"
14 #include "public/platform/WebURLRequest.h" 16 #include "public/platform/WebURLRequest.h"
15 17
16 namespace blink { 18 namespace blink {
17 19
18 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script- instantiation-state 20 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script- instantiation-state
19 enum class ModuleInstantiationState { 21 enum class ModuleInstantiationState {
(...skipping 16 matching lines...) Expand all
36 WebURLRequest::FetchCredentialsMode credentialsMode) { 38 WebURLRequest::FetchCredentialsMode credentialsMode) {
37 return new ModuleScript(record, baseURL, nonce, parserState, 39 return new ModuleScript(record, baseURL, nonce, parserState,
38 credentialsMode); 40 credentialsMode);
39 } 41 }
40 ~ModuleScript() = default; 42 ~ModuleScript() = default;
41 43
42 ScriptModule& record() { return m_record; } 44 ScriptModule& record() { return m_record; }
43 void clearRecord() { m_record = ScriptModule(); } 45 void clearRecord() { m_record = ScriptModule(); }
44 const KURL& baseURL() const { return m_baseURL; } 46 const KURL& baseURL() const { return m_baseURL; }
45 47
48 ModuleInstantiationState instantiationState() const {
49 return m_instantiationState;
50 }
51
52 void setInstantiationSuccess();
53 void setInstantiationError(v8::Isolate*, v8::Local<v8::Value> error);
54
46 ParserDisposition parserState() const { return m_parserState; } 55 ParserDisposition parserState() const { return m_parserState; }
47 WebURLRequest::FetchCredentialsMode credentialsMode() const { 56 WebURLRequest::FetchCredentialsMode credentialsMode() const {
48 return m_credentialsMode; 57 return m_credentialsMode;
49 } 58 }
50 const String& nonce() const { return m_nonce; } 59 const String& nonce() const { return m_nonce; }
51 60
52 ModuleInstantiationState instantiationState() const {
53 return m_instantiationState;
54 }
55
56 DECLARE_TRACE(); 61 DECLARE_TRACE();
62 DECLARE_VIRTUAL_TRACE_WRAPPERS();
57 63
58 private: 64 private:
59 ModuleScript(ScriptModule record, 65 ModuleScript(ScriptModule record,
60 const KURL& baseURL, 66 const KURL& baseURL,
61 const String& nonce, 67 const String& nonce,
62 ParserDisposition parserState, 68 ParserDisposition parserState,
63 WebURLRequest::FetchCredentialsMode credentialsMode) 69 WebURLRequest::FetchCredentialsMode credentialsMode)
64 : m_record(record), 70 : m_record(record),
65 m_baseURL(baseURL), 71 m_baseURL(baseURL),
72 m_instantiationError(this),
domenic 2017/04/05 08:26:11 Why "this"?
kouhei (in TOK) 2017/04/05 09:36:50 TraceWrapperV8Reference c-tor takes m_parent as an
66 m_nonce(nonce), 73 m_nonce(nonce),
67 m_parserState(parserState), 74 m_parserState(parserState),
68 m_credentialsMode(credentialsMode) {} 75 m_credentialsMode(credentialsMode) {}
69 76
70 // Note: A "module script"'s "setttings object" is ommitted, as we currently 77 // Note: A "module script"'s "setttings object" is ommitted, as we currently
71 // always have access to the corresponding Modulator when operating on a 78 // always have access to the corresponding Modulator when operating on a
72 // ModuleScript instance. 79 // ModuleScript instance.
73 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object 80 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object
74 81
75 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-module-record 82 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-module-record
76 ScriptModule m_record; 83 ScriptModule m_record;
77 84
78 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-base-url 85 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-base-url
79 const KURL m_baseURL; 86 const KURL m_baseURL;
80 87
81 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-state 88 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-state
82 ModuleInstantiationState m_instantiationState = 89 ModuleInstantiationState m_instantiationState =
83 ModuleInstantiationState::Uninstantiated; 90 ModuleInstantiationState::Uninstantiated;
84 91
85 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-error 92 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-instantiation-error
86 // TODO(kouhei): Add a corresponding member. 93 TraceWrapperV8Reference<v8::Value> m_instantiationError;
87 94
88 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce 95 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce
89 const String m_nonce; 96 const String m_nonce;
90 97
91 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser 98 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser
92 const ParserDisposition m_parserState; 99 const ParserDisposition m_parserState;
93 100
94 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode 101 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode
95 const WebURLRequest::FetchCredentialsMode m_credentialsMode; 102 const WebURLRequest::FetchCredentialsMode m_credentialsMode;
96 }; 103 };
97 104
98 } // namespace blink 105 } // namespace blink
99 106
100 #endif 107 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ModuleScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698