Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index ee202c2e997216fcf68d285b3450bbfbc4ac60f7..3c81e43313d69d9b16dfbeaecb419dd1ff52a67f 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -25988,3 +25988,44 @@ TEST(InternalFieldsOnGlobalProxy) { |
v8::Local<v8::Object> global = context->Global(); |
CHECK_EQ(v8::Context::kProxyInternalFieldCount, global->InternalFieldCount()); |
} |
+ |
+THREADED_TEST(ImmutableProtoGlobal) { |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
+ global_template->SetImmutableProto(); |
+ v8::Local<Context> context = Context::New(isolate, 0, global_template); |
+ Context::Scope context_scope(context); |
+ v8::Local<Value> result = CompileRun( |
+ "global = this;" |
+ "(function() {" |
+ " try {" |
+ " global.__proto__ = {};" |
+ " return 0;" |
+ " } catch (e) {" |
+ " return 1;" |
+ " }" |
+ "})()"); |
+ CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 1)) |
+ .FromJust()); |
+} |
+ |
+THREADED_TEST(MutableProtoGlobal) { |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
+ v8::Local<Context> context = Context::New(isolate, 0, global_template); |
+ Context::Scope context_scope(context); |
+ v8::Local<Value> result = CompileRun( |
+ "global = this;" |
+ "(function() {" |
+ " try {" |
+ " global.__proto__ = {};" |
+ " return 0;" |
+ " } catch (e) {" |
+ " return 1;" |
+ " }" |
+ "})()"); |
+ CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 0)) |
+ .FromJust()); |
+} |