Really fix missing HandleScope to prevent local handles to DOMWindow leaking.

A follow-up to r9994.

R=vitalyr@chromium.org
BUG=102895
TEST=cctests/test-heap-profiler/NoHandleLeaks

Review URL: http://codereview.chromium.org/8468016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10030 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bbab5326
......@@ -2470,10 +2470,10 @@ class GlobalObjectsEnumerator : public ObjectVisitor {
// Modifies heap. Must not be run during heap traversal.
void V8HeapExplorer::TagGlobalObjects() {
HandleScope scope;
Isolate* isolate = Isolate::Current();
GlobalObjectsEnumerator enumerator;
isolate->global_handles()->IterateAllRoots(&enumerator);
HandleScope scope;
Handle<String> document_string =
isolate->factory()->NewStringFromAscii(CStrVector("document"));
Handle<String> url_string =
......
......@@ -895,6 +895,20 @@ TEST(DocumentURLWithException) {
}
TEST(NoHandleLeaks) {
v8::HandleScope scope;
LocalContext env;
CompileRun("document = { URL:\"abcdefgh\" };");
v8::Handle<v8::String> name(v8_str("leakz"));
int count_before = i::HandleScope::NumberOfHandles();
v8::HeapProfiler::TakeSnapshot(name);
int count_after = i::HandleScope::NumberOfHandles();
CHECK_EQ(count_before, count_after);
}
TEST(NodesIteration) {
v8::HandleScope scope;
LocalContext env;
......@@ -1024,6 +1038,7 @@ TEST(GetConstructorName) {
"Object", i::V8HeapExplorer::GetConstructorName(*js_obj6)));
}
TEST(FastCaseGetter) {
v8::HandleScope scope;
LocalContext env;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment