Index: test/cctest/test-object-observe.cc |
diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc |
index 81edf3f40feee4dc69a5e07f0bc8ca8fb5468e3d..6019199bb39634bd4857a1c4ce15e6f7b6461b4d 100644 |
--- a/test/cctest/test-object-observe.cc |
+++ b/test/cctest/test-object-observe.cc |
@@ -752,8 +752,15 @@ static int GetGlobalObjectsCount() { |
int count = 0; |
i::HeapIterator it(CcTest::heap()); |
for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
- if (object->IsJSGlobalObject()) count++; |
- return count; |
+ if (object->IsJSGlobalObject()) { |
+ i::JSGlobalObject* g = i::JSGlobalObject::cast(object); |
+ // Skip dummy global object. |
+ if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) { |
+ count++; |
+ } |
+ } |
+ // Subtract one to compensate for the code stub context that is always present |
+ return count - 1; |
} |
@@ -794,7 +801,7 @@ TEST(DontLeakContextOnObserve) { |
} |
CcTest::isolate()->ContextDisposedNotification(); |
- CheckSurvivingGlobalObjectsCount(2); |
+ CheckSurvivingGlobalObjectsCount(1); |
} |
@@ -817,7 +824,7 @@ TEST(DontLeakContextOnGetNotifier) { |
} |
CcTest::isolate()->ContextDisposedNotification(); |
- CheckSurvivingGlobalObjectsCount(2); |
+ CheckSurvivingGlobalObjectsCount(1); |
} |
@@ -848,7 +855,7 @@ TEST(DontLeakContextOnNotifierPerformChange) { |
} |
CcTest::isolate()->ContextDisposedNotification(); |
- CheckSurvivingGlobalObjectsCount(2); |
+ CheckSurvivingGlobalObjectsCount(1); |
} |