Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderTest.cpp

Issue 2903813002: [ES6 modules] Fix context leak. ModuleScript should use TraceWrapperV8Reference to hold onto v8::Mo… (Closed)
Patch Set: testfix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/V8BindingForCore.h" 7 #include "bindings/core/v8/V8BindingForCore.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 RefPtr<SecurityOrigin> security_origin) 57 RefPtr<SecurityOrigin> security_origin)
58 : script_state_(std::move(script_state)), 58 : script_state_(std::move(script_state)),
59 security_origin_(std::move(security_origin)) {} 59 security_origin_(std::move(security_origin)) {}
60 60
61 ~ModuleScriptLoaderTestModulator() override {} 61 ~ModuleScriptLoaderTestModulator() override {}
62 62
63 SecurityOrigin* GetSecurityOrigin() override { 63 SecurityOrigin* GetSecurityOrigin() override {
64 return security_origin_.Get(); 64 return security_origin_.Get();
65 } 65 }
66 66
67 ScriptState* GetScriptState() override { return script_state_.Get(); }
68
67 ScriptModule CompileModule(const String& script, 69 ScriptModule CompileModule(const String& script,
68 const String& url_str, 70 const String& url_str,
69 AccessControlStatus access_control_status, 71 AccessControlStatus access_control_status,
70 const TextPosition& position) override { 72 const TextPosition& position) override {
71 ScriptState::Scope scope(script_state_.Get()); 73 ScriptState::Scope scope(script_state_.Get());
72 return ScriptModule::Compile(script_state_->GetIsolate(), 74 return ScriptModule::Compile(script_state_->GetIsolate(),
73 "export default 'foo';", "", 75 "export default 'foo';", "",
74 access_control_status); 76 access_control_status);
75 } 77 }
76 78
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 EXPECT_FALSE(client->WasNotifyFinished()) 165 EXPECT_FALSE(client->WasNotifyFinished())
164 << "ModuleScriptLoader unexpectedly finished synchronously."; 166 << "ModuleScriptLoader unexpectedly finished synchronously.";
165 platform_->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); 167 platform_->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
166 168
167 EXPECT_TRUE(client->WasNotifyFinished()); 169 EXPECT_TRUE(client->WasNotifyFinished());
168 EXPECT_FALSE(client->GetModuleScript()); 170 EXPECT_FALSE(client->GetModuleScript());
169 } 171 }
170 172
171 } // namespace blink 173 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698