| 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 "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "core/dom/Modulator.h" | 11 #include "core/dom/Modulator.h" |
| 12 #include "core/dom/Script.h" | 12 #include "core/dom/Script.h" |
| 13 #include "platform/bindings/ScriptWrappable.h" | 13 #include "platform/bindings/ScriptWrappable.h" |
| 14 #include "platform/bindings/TraceWrapperV8Reference.h" | 14 #include "platform/bindings/TraceWrapperV8Reference.h" |
| 15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
| 16 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 16 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
| 17 #include "platform/weborigin/KURL.h" | 17 #include "platform/weborigin/KURL.h" |
| 18 #include "platform/wtf/text/TextPosition.h" |
| 18 #include "public/platform/WebURLRequest.h" | 19 #include "public/platform/WebURLRequest.h" |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 | 22 |
| 22 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-
instantiation-state | 23 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-
instantiation-state |
| 23 enum class ModuleInstantiationState { | 24 enum class ModuleInstantiationState { |
| 24 kUninstantiated, | 25 kUninstantiated, |
| 25 kErrored, | 26 kErrored, |
| 26 kInstantiated, | 27 kInstantiated, |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 // ModuleScript is a model object for the "module script" spec concept. | 30 // ModuleScript is a model object for the "module script" spec concept. |
| 30 // https://html.spec.whatwg.org/multipage/webappapis.html#module-script | 31 // https://html.spec.whatwg.org/multipage/webappapis.html#module-script |
| 31 class CORE_EXPORT ModuleScript final : public Script, public TraceWrapperBase { | 32 class CORE_EXPORT ModuleScript final : public Script, public TraceWrapperBase { |
| 32 public: | 33 public: |
| 33 // https://html.spec.whatwg.org/#creating-a-module-script | 34 // https://html.spec.whatwg.org/#creating-a-module-script |
| 34 static ModuleScript* Create(const String& source_text, | 35 static ModuleScript* Create( |
| 35 Modulator*, | 36 const String& source_text, |
| 36 const KURL& base_url, | 37 Modulator*, |
| 37 const String& nonce, | 38 const KURL& base_url, |
| 38 ParserDisposition, | 39 const String& nonce, |
| 39 WebURLRequest::FetchCredentialsMode, | 40 ParserDisposition, |
| 40 AccessControlStatus); | 41 WebURLRequest::FetchCredentialsMode, |
| 42 AccessControlStatus, |
| 43 const TextPosition& start_position = TextPosition::MinimumPosition()); |
| 41 | 44 |
| 42 // Mostly corresponds to Create() but accepts ScriptModule as the argument | 45 // Mostly corresponds to Create() but accepts ScriptModule as the argument |
| 43 // and allows null ScriptModule. | 46 // and allows null ScriptModule. |
| 44 static ModuleScript* CreateForTest(Modulator*, | 47 static ModuleScript* CreateForTest(Modulator*, |
| 45 ScriptModule, | 48 ScriptModule, |
| 46 const KURL& base_url, | 49 const KURL& base_url, |
| 47 const String& nonce, | 50 const String& nonce, |
| 48 ParserDisposition, | 51 ParserDisposition, |
| 49 WebURLRequest::FetchCredentialsMode); | 52 WebURLRequest::FetchCredentialsMode); |
| 50 | 53 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode | 153 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-scrip
t-credentials-mode |
| 151 const WebURLRequest::FetchCredentialsMode credentials_mode_; | 154 const WebURLRequest::FetchCredentialsMode credentials_mode_; |
| 152 | 155 |
| 153 // For CSP check. | 156 // For CSP check. |
| 154 const String source_text_; | 157 const String source_text_; |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 } // namespace blink | 160 } // namespace blink |
| 158 | 161 |
| 159 #endif | 162 #endif |
| OLD | NEW |