Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index ed5de37321f9b3f1fb8e9066ff04e069cad80004..09521764c84a3247877a5c75708de2e568ce851e 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -16408,3 +16408,58 @@ TEST(PrimaryStubCache) { |
StubCacheHelper(false); |
} |
+ |
+TEST(StaticGetters) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
+ i::Handle<i::Object> undefined_value = FACTORY->undefined_value(); |
+ CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); |
+ CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); |
+ i::Handle<i::Object> null_value = FACTORY->null_value(); |
+ CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); |
+ CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); |
+ i::Handle<i::Object> true_value = FACTORY->true_value(); |
+ CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); |
+ CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); |
+ i::Handle<i::Object> false_value = FACTORY->false_value(); |
+ CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); |
+ CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
+} |
+ |
+ |
+static int fatal_error_callback_counter = 0; |
+static void CountingErrorCallback(const char* location, const char* message) { |
+ printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message); |
+ fatal_error_callback_counter++; |
+} |
+ |
+ |
+TEST(StaticGettersAfterDeath) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
+ CHECK(i::Internals::IsInitialized(isolate)); |
+ CHECK_EQ(0, fatal_error_callback_counter); |
+ v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
+ v8::Utils::ReportApiFailure("StaticGettersAfterDeath()", "Kill V8"); |
+ i::Isolate::Current()->TearDown(); |
+ CHECK(!i::Internals::IsInitialized(isolate)); |
+ CHECK_EQ(1, fatal_error_callback_counter); |
+ CHECK(v8::Undefined().IsEmpty()); |
+ CHECK_EQ(2, fatal_error_callback_counter); |
+ CHECK(v8::Undefined(isolate).IsEmpty()); |
+ CHECK_EQ(3, fatal_error_callback_counter); |
+ CHECK(v8::Null().IsEmpty()); |
+ CHECK_EQ(4, fatal_error_callback_counter); |
+ CHECK(v8::Null(isolate).IsEmpty()); |
+ CHECK_EQ(5, fatal_error_callback_counter); |
+ CHECK(v8::True().IsEmpty()); |
+ CHECK_EQ(6, fatal_error_callback_counter); |
+ CHECK(v8::True(isolate).IsEmpty()); |
+ CHECK_EQ(7, fatal_error_callback_counter); |
+ CHECK(v8::False().IsEmpty()); |
+ CHECK_EQ(8, fatal_error_callback_counter); |
+ CHECK(v8::False(isolate).IsEmpty()); |
+ CHECK_EQ(9, fatal_error_callback_counter); |
+} |