Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 AccessControlStatus); | 40 AccessControlStatus); | 
| 41 | 41 | 
| 42 static ModuleScript* CreateForTest( | 42 static ModuleScript* CreateForTest( | 
| 43 Modulator* settings_object, | 43 Modulator* settings_object, | 
| 44 ScriptModule record, | 44 ScriptModule record, | 
| 45 const KURL& base_url, | 45 const KURL& base_url, | 
| 46 const String& nonce, | 46 const String& nonce, | 
| 47 ParserDisposition parser_state, | 47 ParserDisposition parser_state, | 
| 48 WebURLRequest::FetchCredentialsMode credentials_mode) { | 48 WebURLRequest::FetchCredentialsMode credentials_mode) { | 
| 49 return new ModuleScript(settings_object, record, base_url, nonce, | 49 return new ModuleScript(settings_object, record, base_url, nonce, | 
| 50 parser_state, credentials_mode); | 50 parser_state, credentials_mode, ""); | 
| 
 
kouhei (in TOK)
2017/04/27 03:47:25
note to self: "" is source_text
 
hiroshige
2017/04/27 21:57:20
Done.
 
 | |
| 51 } | 51 } | 
| 52 ~ModuleScript() override = default; | 52 ~ModuleScript() override = default; | 
| 53 | 53 | 
| 54 const ScriptModule& Record() const { return record_; } | 54 const ScriptModule& Record() const { return record_; } | 
| 55 const KURL& BaseURL() const { return base_url_; } | 55 const KURL& BaseURL() const { return base_url_; } | 
| 56 | 56 | 
| 57 ModuleInstantiationState InstantiationState() const { | 57 ModuleInstantiationState InstantiationState() const { | 
| 58 return instantiation_state_; | 58 return instantiation_state_; | 
| 59 } | 59 } | 
| 60 | 60 | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 77 | 77 | 
| 78 DECLARE_TRACE(); | 78 DECLARE_TRACE(); | 
| 79 DECLARE_TRACE_WRAPPERS(); | 79 DECLARE_TRACE_WRAPPERS(); | 
| 80 | 80 | 
| 81 private: | 81 private: | 
| 82 ModuleScript(Modulator* settings_object, | 82 ModuleScript(Modulator* settings_object, | 
| 83 ScriptModule record, | 83 ScriptModule record, | 
| 84 const KURL& base_url, | 84 const KURL& base_url, | 
| 85 const String& nonce, | 85 const String& nonce, | 
| 86 ParserDisposition parser_state, | 86 ParserDisposition parser_state, | 
| 87 WebURLRequest::FetchCredentialsMode credentials_mode) | 87 WebURLRequest::FetchCredentialsMode credentials_mode, | 
| 88 const String& source_text) | |
| 88 : settings_object_(settings_object), | 89 : settings_object_(settings_object), | 
| 89 record_(record), | 90 record_(record), | 
| 90 base_url_(base_url), | 91 base_url_(base_url), | 
| 91 instantiation_error_(this), | 92 instantiation_error_(this), | 
| 92 nonce_(nonce), | 93 nonce_(nonce), | 
| 93 parser_state_(parser_state), | 94 parser_state_(parser_state), | 
| 94 credentials_mode_(credentials_mode) {} | 95 credentials_mode_(credentials_mode), | 
| 96 source_text_(source_text) {} | |
| 95 | 97 | 
| 96 ScriptType GetScriptType() const override { return ScriptType::kModule; } | 98 ScriptType GetScriptType() const override { return ScriptType::kModule; } | 
| 97 bool IsEmpty() const override; | 99 bool IsEmpty() const override; | 
| 98 bool CheckMIMETypeBeforeRunScript(Document* context_document, | 100 bool CheckMIMETypeBeforeRunScript(Document* context_document, | 
| 99 const SecurityOrigin*) const override; | 101 const SecurityOrigin*) const override; | 
| 100 void RunScript(LocalFrame*, const SecurityOrigin*) const override; | 102 void RunScript(LocalFrame*, const SecurityOrigin*) const override; | 
| 101 String InlineSourceTextForCSP() const override; | 103 String InlineSourceTextForCSP() const override; | 
| 102 | 104 | 
| 103 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object | 105 // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object | 
| 104 Member<Modulator> settings_object_; | 106 Member<Modulator> settings_object_; | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 124 TraceWrapperV8Reference<v8::Value> instantiation_error_; | 126 TraceWrapperV8Reference<v8::Value> instantiation_error_; | 
| 125 | 127 | 
| 126 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce | 128 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-nonce | 
| 127 const String nonce_; | 129 const String nonce_; | 
| 128 | 130 | 
| 129 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser | 131 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-parser | 
| 130 const ParserDisposition parser_state_; | 132 const ParserDisposition parser_state_; | 
| 131 | 133 | 
| 132 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode | 134 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip t-credentials-mode | 
| 133 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 135 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 
| 136 | |
| 137 // For CSP check. | |
| 138 const String source_text_; | |
| 134 }; | 139 }; | 
| 135 | 140 | 
| 136 } // namespace blink | 141 } // namespace blink | 
| 137 | 142 | 
| 138 #endif | 143 #endif | 
| OLD | NEW |