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 22 matching lines...) Expand all Loading... |
33 ScriptModule record, | 33 ScriptModule record, |
34 const KURL& base_url, | 34 const KURL& base_url, |
35 const String& nonce, | 35 const String& nonce, |
36 ParserDisposition parser_state, | 36 ParserDisposition parser_state, |
37 WebURLRequest::FetchCredentialsMode credentials_mode) { | 37 WebURLRequest::FetchCredentialsMode credentials_mode) { |
38 return new ModuleScript(record, base_url, nonce, parser_state, | 38 return new ModuleScript(record, base_url, nonce, parser_state, |
39 credentials_mode); | 39 credentials_mode); |
40 } | 40 } |
41 ~ModuleScript() override = default; | 41 ~ModuleScript() override = default; |
42 | 42 |
43 ScriptModule& Record() { return record_; } | 43 const ScriptModule& Record() const { return record_; } |
44 void ClearRecord() { record_ = ScriptModule(); } | 44 void ClearRecord() { record_ = ScriptModule(); } |
45 const KURL& BaseURL() const { return base_url_; } | 45 const KURL& BaseURL() const { return base_url_; } |
46 | 46 |
47 ModuleInstantiationState InstantiationState() const { | 47 ModuleInstantiationState InstantiationState() const { |
48 return instantiation_state_; | 48 return instantiation_state_; |
49 } | 49 } |
50 | 50 |
51 void SetInstantiationSuccess(); | 51 void SetInstantiationSuccess(); |
52 void SetInstantiationError(v8::Isolate*, v8::Local<v8::Value> error); | 52 void SetInstantiationError(v8::Isolate*, v8::Local<v8::Value> error); |
53 | 53 |
54 ParserDisposition ParserState() const { return parser_state_; } | 54 ParserDisposition ParserState() const { return parser_state_; } |
55 WebURLRequest::FetchCredentialsMode CredentialsMode() const { | 55 WebURLRequest::FetchCredentialsMode CredentialsMode() const { |
56 return credentials_mode_; | 56 return credentials_mode_; |
57 } | 57 } |
58 const String& Nonce() const { return nonce_; } | 58 const String& Nonce() const { return nonce_; } |
59 | 59 |
| 60 v8::Local<v8::Value> CreateInstantiationError(v8::Isolate* isolate) const { |
| 61 return instantiation_error_.NewLocal(isolate); |
| 62 } |
| 63 |
60 DECLARE_TRACE(); | 64 DECLARE_TRACE(); |
61 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | 65 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
62 | 66 |
63 private: | 67 private: |
64 ModuleScript(ScriptModule record, | 68 ModuleScript(ScriptModule record, |
65 const KURL& base_url, | 69 const KURL& base_url, |
66 const String& nonce, | 70 const String& nonce, |
67 ParserDisposition parser_state, | 71 ParserDisposition parser_state, |
68 WebURLRequest::FetchCredentialsMode credentials_mode) | 72 WebURLRequest::FetchCredentialsMode credentials_mode) |
69 : record_(record), | 73 : record_(record), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser | 108 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser |
105 const ParserDisposition parser_state_; | 109 const ParserDisposition parser_state_; |
106 | 110 |
107 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 111 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
108 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 112 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
109 }; | 113 }; |
110 | 114 |
111 } // namespace blink | 115 } // namespace blink |
112 | 116 |
113 #endif | 117 #endif |
OLD | NEW |