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 void ClearRecord() { record_ = ScriptModule(); } |
47 const KURL& BaseURL() const { return base_url_; } | 47 const KURL& BaseURL() const { return base_url_; } |
48 | 48 |
49 ModuleInstantiationState InstantiationState() const { | 49 ModuleInstantiationState InstantiationState() const { |
50 return instantiation_state_; | 50 return instantiation_state_; |
51 } | 51 } |
52 | 52 |
53 void SetInstantiationSuccess(); | 53 void SetInstantiationSuccess(); |
54 void SetInstantiationError(v8::Isolate*, v8::Local<v8::Value> error); | 54 void SetInstantiationError(v8::Isolate*, v8::Local<v8::Value> error); |
55 | 55 |
56 ParserDisposition ParserState() const { return parser_state_; } | 56 ParserDisposition ParserState() const { return parser_state_; } |
57 WebURLRequest::FetchCredentialsMode CredentialsMode() const { | 57 WebURLRequest::FetchCredentialsMode CredentialsMode() const { |
58 return credentials_mode_; | 58 return credentials_mode_; |
59 } | 59 } |
60 const String& Nonce() const { return nonce_; } | 60 const String& Nonce() const { return nonce_; } |
61 | 61 |
| 62 v8::Local<v8::Value> CreateInstantiationError(v8::Isolate* isolate) const { |
| 63 return instantiation_error_.NewLocal(isolate); |
| 64 } |
| 65 |
62 DECLARE_TRACE(); | 66 DECLARE_TRACE(); |
63 DECLARE_TRACE_WRAPPERS(); | 67 DECLARE_TRACE_WRAPPERS(); |
64 | 68 |
65 private: | 69 private: |
66 ModuleScript(Modulator* settings_object, | 70 ModuleScript(Modulator* settings_object, |
67 ScriptModule record, | 71 ScriptModule record, |
68 const KURL& base_url, | 72 const KURL& base_url, |
69 const String& nonce, | 73 const String& nonce, |
70 ParserDisposition parser_state, | 74 ParserDisposition parser_state, |
71 WebURLRequest::FetchCredentialsMode credentials_mode) | 75 WebURLRequest::FetchCredentialsMode credentials_mode) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser | 117 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser |
114 const ParserDisposition parser_state_; | 118 const ParserDisposition parser_state_; |
115 | 119 |
116 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 120 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
117 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 121 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
118 }; | 122 }; |
119 | 123 |
120 } // namespace blink | 124 } // namespace blink |
121 | 125 |
122 #endif | 126 #endif |
OLD | NEW |