OLD | NEW |
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/ScriptValue.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 ~ModuleScript() override = default; | 43 ~ModuleScript() override = default; |
44 | 44 |
45 const ScriptModule& Record() const { return record_; } | 45 const ScriptModule& Record() const { return record_; } |
46 const KURL& BaseURL() const { return base_url_; } | 46 const KURL& BaseURL() const { return base_url_; } |
47 | 47 |
48 ModuleInstantiationState InstantiationState() const { | 48 ModuleInstantiationState InstantiationState() const { |
49 return instantiation_state_; | 49 return instantiation_state_; |
50 } | 50 } |
51 | 51 |
52 v8::Local<v8::Value> CreateInstantiationError(v8::Isolate* isolate) const { | |
53 return instantiation_error_.NewLocal(isolate); | |
54 } | |
55 | |
56 // Implements Step 7.1 of: | 52 // Implements Step 7.1 of: |
57 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 53 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
58 void SetInstantiationErrorAndClearRecord(ScriptValue error); | 54 void SetInstantiationErrorAndClearRecord(ScriptValue error); |
59 // Implements Step 7.2 of: | 55 // Implements Step 7.2 of: |
60 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 56 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
61 void SetInstantiationSuccess(); | 57 void SetInstantiationSuccess(); |
62 | 58 |
63 ParserDisposition ParserState() const { return parser_state_; } | 59 ParserDisposition ParserState() const { return parser_state_; } |
64 WebURLRequest::FetchCredentialsMode CredentialsMode() const { | 60 WebURLRequest::FetchCredentialsMode CredentialsMode() const { |
65 return credentials_mode_; | 61 return credentials_mode_; |
(...skipping 18 matching lines...) Expand all Loading... |
84 parser_state_(parser_state), | 80 parser_state_(parser_state), |
85 credentials_mode_(credentials_mode) {} | 81 credentials_mode_(credentials_mode) {} |
86 | 82 |
87 ScriptType GetScriptType() const override { return ScriptType::kModule; } | 83 ScriptType GetScriptType() const override { return ScriptType::kModule; } |
88 bool IsEmpty() const override; | 84 bool IsEmpty() const override; |
89 bool CheckMIMETypeBeforeRunScript(Document* context_document, | 85 bool CheckMIMETypeBeforeRunScript(Document* context_document, |
90 const SecurityOrigin*) const override; | 86 const SecurityOrigin*) const override; |
91 void RunScript(LocalFrame*, const SecurityOrigin*) const override; | 87 void RunScript(LocalFrame*, const SecurityOrigin*) const override; |
92 String InlineSourceTextForCSP() const override; | 88 String InlineSourceTextForCSP() const override; |
93 | 89 |
| 90 friend class ModulatorImpl; |
| 91 friend class ModuleTreeLinkerTestModulator; |
| 92 // Access this func only via ModulatorImpl::GetInstantiationError(), |
| 93 // or via Modulator mocks for unit tests. |
| 94 v8::Local<v8::Value> CreateInstantiationErrorInternal( |
| 95 v8::Isolate* isolate) const { |
| 96 return instantiation_error_.NewLocal(isolate); |
| 97 } |
| 98 |
94 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object | 99 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object |
95 Member<Modulator> settings_object_; | 100 Member<Modulator> settings_object_; |
96 | 101 |
97 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-module-record | 102 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-module-record |
98 ScriptModule record_; | 103 ScriptModule record_; |
99 | 104 |
100 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-base-url | 105 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-base-url |
101 const KURL base_url_; | 106 const KURL base_url_; |
102 | 107 |
103 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-instantiation-state | 108 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-instantiation-state |
(...skipping 16 matching lines...) Expand all Loading... |
120 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser | 125 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser |
121 const ParserDisposition parser_state_; | 126 const ParserDisposition parser_state_; |
122 | 127 |
123 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 128 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
124 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 129 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
125 }; | 130 }; |
126 | 131 |
127 } // namespace blink | 132 } // namespace blink |
128 | 133 |
129 #endif | 134 #endif |
OLD | NEW |