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

Unified Diff: Source/bindings/core/v8/ScriptPromisePropertyTest.cpp

Issue 1306083008: Fix ScriptState leak in ScriptPromiseProperty unittests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
diff --git a/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
index 58b81c37d03539ee1aa85ef8a512c606adb2b835..0d6f95941e77e5147e5ab221ec08ebbc80ce7ed7 100644
--- a/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
+++ b/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -126,14 +126,12 @@ public:
: m_page(DummyPageHolder::create(IntSize(1, 1)))
{
v8::HandleScope handleScope(isolate());
- m_otherScriptState = ScriptStateForTesting::create(v8::Context::New(isolate()), DOMWrapperWorld::create(isolate(), 1));
+ m_otherScriptState = ScriptStateForTesting::create(v8::Context::New(isolate()), DOMWrapperWorld::ensureIsolatedWorld(isolate(), 1, -1));
}
virtual ~ScriptPromisePropertyTestBase()
{
- m_page.clear();
- gc();
- Heap::collectAllGarbage();
+ ScriptPromisePropertyTestBase::destroyContext();
}
Document& document() { return m_page->document(); }
@@ -147,9 +145,12 @@ public:
virtual void destroyContext()
{
m_page.clear();
- m_otherScriptState.clear();
+ if (m_otherScriptState) {
+ m_otherScriptState->disposePerContextData();
+ m_otherScriptState = nullptr;
+ }
gc();
- Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSweep, Heap::ForcedGC);
+ Heap::collectAllGarbage();
sof 2015/08/31 06:44:40 Incidental to this CL, but having the name of this
haraken 2015/08/31 06:46:42 Yeah, a better idea would be to call V8GCControlle
sof 2015/08/31 06:50:22 You have to supply the "force" flag in V8GCControl
haraken 2015/08/31 06:55:52 V8GCController::collectGarbage calls window.gc() a
sof 2015/08/31 06:58:34 This is a unit test -- isn't "gc()" mapping to wha
sof 2015/08/31 07:03:46 Which maps to v8/src/extensions/gc-extension.* i.
yhirano 2015/08/31 07:10:43 Once I was told that relying on the conservative G
}
void gc() { V8GCController::collectGarbage(v8::Isolate::GetCurrent()); }
@@ -361,7 +362,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reject_RejectsScriptPromise)
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DeadContext)
{
- Property* property = this->property();
+ Persistent<Property> property = this->property();
property->resolve(new GarbageCollectedScriptWrappable("value"));
EXPECT_EQ(Property::Resolved, property->state());
@@ -372,7 +373,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DeadContext)
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_DeadContext)
{
- Property* property = this->property();
+ Persistent<Property> property = this->property();
{
ScriptState::Scope scope(mainScriptState());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698