| Index: test/cctest/test-api-accessors.cc
|
| diff --git a/test/cctest/test-api-accessors.cc b/test/cctest/test-api-accessors.cc
|
| index e9773e918df6284be78e0473b585617bd46aa2f1..cbe0692455a3f87dbbb1dcf184c332313be04268 100644
|
| --- a/test/cctest/test-api-accessors.cc
|
| +++ b/test/cctest/test-api-accessors.cc
|
| @@ -247,3 +247,33 @@ TEST(CachedAccessorCrankshaft) {
|
|
|
| ExpectInt32("g()", 789);
|
| }
|
| +
|
| +namespace {
|
| +
|
| +static void Setter(v8::Local<v8::String> name, v8::Local<v8::Value> value,
|
| + const v8::PropertyCallbackInfo<void>& info) {}
|
| +}
|
| +
|
| +// Re-declaration of non-configurable accessors should throw.
|
| +TEST(RedeclareAccessor) {
|
| + v8::HandleScope scope(CcTest::isolate());
|
| + LocalContext env;
|
| +
|
| + v8::Local<v8::FunctionTemplate> templ =
|
| + v8::FunctionTemplate::New(CcTest::isolate());
|
| +
|
| + v8::Local<v8::ObjectTemplate> object_template = templ->InstanceTemplate();
|
| + object_template->SetAccessor(
|
| + v8_str("foo"), NULL, Setter, v8::Local<v8::Value>(),
|
| + v8::AccessControl::DEFAULT, v8::PropertyAttribute::DontDelete);
|
| +
|
| + v8::Local<v8::Context> ctx =
|
| + v8::Context::New(CcTest::isolate(), nullptr, object_template);
|
| +
|
| + // Declare function.
|
| + v8::Local<v8::String> code = v8_str("function foo() {};");
|
| +
|
| + v8::TryCatch try_catch(CcTest::isolate());
|
| + v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).IsEmpty();
|
| + CHECK(try_catch.HasCaught());
|
| +}
|
|
|