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 24 matching lines...) Expand all Loading... |
35 ScriptModule record, | 35 ScriptModule record, |
36 const KURL& base_url, | 36 const KURL& base_url, |
37 const String& nonce, | 37 const String& nonce, |
38 ParserDisposition parser_state, | 38 ParserDisposition parser_state, |
39 WebURLRequest::FetchCredentialsMode credentials_mode) { | 39 WebURLRequest::FetchCredentialsMode credentials_mode) { |
40 return new ModuleScript(settings_object, record, base_url, nonce, | 40 return new ModuleScript(settings_object, record, base_url, nonce, |
41 parser_state, credentials_mode); | 41 parser_state, credentials_mode); |
42 } | 42 } |
43 ~ModuleScript() override = default; | 43 ~ModuleScript() override = default; |
44 | 44 |
45 ScriptModule& Record() { return record_; } | 45 const ScriptModule& Record() const { return record_; } |
| 46 void ClearRecord() { record_ = ScriptModule(); } |
46 const KURL& BaseURL() const { return base_url_; } | 47 const KURL& BaseURL() const { return base_url_; } |
47 | 48 |
48 ModuleInstantiationState InstantiationState() const { | 49 ModuleInstantiationState InstantiationState() const { |
49 return instantiation_state_; | 50 return instantiation_state_; |
50 } | 51 } |
51 | 52 |
52 v8::Local<v8::Value> CreateInstantiationError(v8::Isolate* isolate) const { | |
53 return instantiation_error_.NewLocal(isolate); | |
54 } | |
55 | |
56 // Implements Step 7.1 of: | 53 // Implements Step 7.1 of: |
57 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 54 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
58 void SetInstantiationErrorAndClearRecord(ScriptValue error); | 55 void SetInstantiationErrorAndClearRecord(ScriptValue error); |
59 // Implements Step 7.2 of: | 56 // Implements Step 7.2 of: |
60 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 57 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
61 void SetInstantiationSuccess(); | 58 void SetInstantiationSuccess(); |
62 | 59 |
| 60 v8::Local<v8::Value> CreateInstantiationError(v8::Isolate* isolate) const { |
| 61 return instantiation_error_.NewLocal(isolate); |
| 62 } |
| 63 |
63 ParserDisposition ParserState() const { return parser_state_; } | 64 ParserDisposition ParserState() const { return parser_state_; } |
64 WebURLRequest::FetchCredentialsMode CredentialsMode() const { | 65 WebURLRequest::FetchCredentialsMode CredentialsMode() const { |
65 return credentials_mode_; | 66 return credentials_mode_; |
66 } | 67 } |
67 const String& Nonce() const { return nonce_; } | 68 const String& Nonce() const { return nonce_; } |
68 | 69 |
69 DECLARE_TRACE(); | 70 DECLARE_TRACE(); |
70 DECLARE_TRACE_WRAPPERS(); | 71 DECLARE_TRACE_WRAPPERS(); |
71 | 72 |
72 private: | 73 private: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser | 121 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser |
121 const ParserDisposition parser_state_; | 122 const ParserDisposition parser_state_; |
122 | 123 |
123 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 124 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
124 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 125 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
125 }; | 126 }; |
126 | 127 |
127 } // namespace blink | 128 } // namespace blink |
128 | 129 |
129 #endif | 130 #endif |
OLD | NEW |