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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 DECLARE_TRACE(); | 73 DECLARE_TRACE(); |
74 DECLARE_TRACE_WRAPPERS(); | 74 DECLARE_TRACE_WRAPPERS(); |
75 | 75 |
76 private: | 76 private: |
77 ModuleScript(Modulator* settings_object, | 77 ModuleScript(Modulator* settings_object, |
78 ScriptModule record, | 78 ScriptModule record, |
79 const KURL& base_url, | 79 const KURL& base_url, |
80 const String& nonce, | 80 const String& nonce, |
81 ParserDisposition parser_state, | 81 ParserDisposition parser_state, |
82 WebURLRequest::FetchCredentialsMode credentials_mode) | 82 WebURLRequest::FetchCredentialsMode credentials_mode, |
| 83 const String& source_text) |
83 : settings_object_(settings_object), | 84 : settings_object_(settings_object), |
84 record_(record), | 85 record_(record), |
85 base_url_(base_url), | 86 base_url_(base_url), |
86 instantiation_error_(this), | 87 instantiation_error_(this), |
87 nonce_(nonce), | 88 nonce_(nonce), |
88 parser_state_(parser_state), | 89 parser_state_(parser_state), |
89 credentials_mode_(credentials_mode) {} | 90 credentials_mode_(credentials_mode), |
| 91 source_text_(source_text) {} |
90 | 92 |
91 static ModuleScript* CreateInternal(Modulator*, | 93 static ModuleScript* CreateInternal(const String& source_text, |
| 94 Modulator*, |
92 ScriptModule, | 95 ScriptModule, |
93 const KURL& base_url, | 96 const KURL& base_url, |
94 const String& nonce, | 97 const String& nonce, |
95 ParserDisposition, | 98 ParserDisposition, |
96 WebURLRequest::FetchCredentialsMode); | 99 WebURLRequest::FetchCredentialsMode); |
97 | 100 |
98 ScriptType GetScriptType() const override { return ScriptType::kModule; } | 101 ScriptType GetScriptType() const override { return ScriptType::kModule; } |
99 bool IsEmpty() const override; | 102 bool IsEmpty() const override; |
100 bool CheckMIMETypeBeforeRunScript(Document* context_document, | 103 bool CheckMIMETypeBeforeRunScript(Document* context_document, |
101 const SecurityOrigin*) const override; | 104 const SecurityOrigin*) const override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 TraceWrapperV8Reference<v8::Value> instantiation_error_; | 138 TraceWrapperV8Reference<v8::Value> instantiation_error_; |
136 | 139 |
137 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-nonce | 140 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-nonce |
138 const String nonce_; | 141 const String nonce_; |
139 | 142 |
140 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser | 143 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-parser |
141 const ParserDisposition parser_state_; | 144 const ParserDisposition parser_state_; |
142 | 145 |
143 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 146 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
144 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 147 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
| 148 |
| 149 // For CSP check. |
| 150 const String source_text_; |
145 }; | 151 }; |
146 | 152 |
147 } // namespace blink | 153 } // namespace blink |
148 | 154 |
149 #endif | 155 #endif |
OLD | NEW |