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 #include "core/loader/modulescript/ModuleScriptLoader.h" | 5 #include "core/loader/modulescript/ModuleScriptLoader.h" |
6 | 6 |
7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Modulator.h" | 9 #include "core/dom/Modulator.h" |
10 #include "core/dom/ModuleScript.h" | 10 #include "core/dom/ModuleScript.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ModuleScriptLoaderTestModulator(RefPtr<ScriptState> scriptState, | 56 ModuleScriptLoaderTestModulator(RefPtr<ScriptState> scriptState, |
57 RefPtr<SecurityOrigin> securityOrigin) | 57 RefPtr<SecurityOrigin> securityOrigin) |
58 : m_scriptState(std::move(scriptState)), | 58 : m_scriptState(std::move(scriptState)), |
59 m_securityOrigin(std::move(securityOrigin)) {} | 59 m_securityOrigin(std::move(securityOrigin)) {} |
60 | 60 |
61 ~ModuleScriptLoaderTestModulator() override {} | 61 ~ModuleScriptLoaderTestModulator() override {} |
62 | 62 |
63 SecurityOrigin* securityOrigin() override { return m_securityOrigin.get(); } | 63 SecurityOrigin* securityOrigin() override { return m_securityOrigin.get(); } |
64 | 64 |
65 ScriptModule compileModule(const String& script, | 65 ScriptModule compileModule(const String& script, |
66 const String& urlStr) override { | 66 const String& urlStr, |
| 67 AccessControlStatus accessControlStatus) override { |
67 ScriptState::Scope scope(m_scriptState.get()); | 68 ScriptState::Scope scope(m_scriptState.get()); |
68 return ScriptModule::compile(m_scriptState->isolate(), | 69 return ScriptModule::compile(m_scriptState->isolate(), |
69 "export default 'foo';", ""); | 70 "export default 'foo';", "", |
| 71 accessControlStatus); |
70 } | 72 } |
71 | 73 |
72 DECLARE_TRACE(); | 74 DECLARE_TRACE(); |
73 | 75 |
74 private: | 76 private: |
75 RefPtr<ScriptState> m_scriptState; | 77 RefPtr<ScriptState> m_scriptState; |
76 RefPtr<SecurityOrigin> m_securityOrigin; | 78 RefPtr<SecurityOrigin> m_securityOrigin; |
77 }; | 79 }; |
78 | 80 |
79 DEFINE_TRACE(ModuleScriptLoaderTestModulator) { | 81 DEFINE_TRACE(ModuleScriptLoaderTestModulator) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 158 |
157 EXPECT_FALSE(client->wasNotifyFinished()) | 159 EXPECT_FALSE(client->wasNotifyFinished()) |
158 << "ModuleScriptLoader unexpectedly finished synchronously."; | 160 << "ModuleScriptLoader unexpectedly finished synchronously."; |
159 m_platform->getURLLoaderMockFactory()->serveAsynchronousRequests(); | 161 m_platform->getURLLoaderMockFactory()->serveAsynchronousRequests(); |
160 | 162 |
161 EXPECT_TRUE(client->wasNotifyFinished()); | 163 EXPECT_TRUE(client->wasNotifyFinished()); |
162 EXPECT_FALSE(client->moduleScript()); | 164 EXPECT_FALSE(client->moduleScript()); |
163 } | 165 } |
164 | 166 |
165 } // namespace blink | 167 } // namespace blink |
OLD | NEW |