Index: test/cctest/test-heap.cc |
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
index 2bb3af624dbedf8909c38ca247d0150683fe7174..27fa4b104aa65319ad16d1e5f2af168258245a0a 100644 |
--- a/test/cctest/test-heap.cc |
+++ b/test/cctest/test-heap.cc |
@@ -2410,19 +2410,13 @@ class SourceResource: public v8::String::ExternalAsciiStringResource { |
}; |
-TEST(ReleaseStackTraceData) { |
+void ReleaseStackTraceDataTest(const char* source) { |
// Test that the data retained by the Error.stack accessor is released |
// after the first time the accessor is fired. We use external string |
// to check whether the data is being released since the external string |
// resource's callback is fired when the external string is GC'ed. |
InitializeVM(); |
v8::HandleScope scope; |
- static const char* source = "var error = 1; " |
- "try { " |
- " throw new Error(); " |
- "} catch (e) { " |
- " error = e; " |
- "} "; |
SourceResource* resource = new SourceResource(i::StrDup(source)); |
{ |
v8::HandleScope scope; |
@@ -2434,15 +2428,32 @@ TEST(ReleaseStackTraceData) { |
// External source is being retained by the stack trace. |
CHECK(!resource->IsDisposed()); |
- CompileRun("error.stack; error.stack;"); |
+ CompileRun("error.stack;"); |
HEAP->CollectAllAvailableGarbage(); |
// External source has been released. |
CHECK(resource->IsDisposed()); |
- |
delete resource; |
} |
+TEST(ReleaseStackTraceData) { |
+ static const char* source1 = "var error = null; " |
+ /* Normal Error */ "try { " |
+ " throw new Error(); " |
+ "} catch (e) { " |
+ " error = e; " |
+ "} "; |
+ static const char* source2 = "var error = null; " |
+ /* Stack overflow */ "try { " |
+ " (function f() { f(); })(); " |
+ "} catch (e) { " |
+ " error = e; " |
+ "} "; |
+ ReleaseStackTraceDataTest(source1); |
+ ReleaseStackTraceDataTest(source2); |
+} |
+ |
+ |
TEST(Regression144230) { |
InitializeVM(); |
v8::HandleScope scope; |