diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-03-21 10:16:54 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-03-25 09:44:10 +0100 |
commit | c459d8ea5d402c702948c860d9497b2230ff7e8a (patch) | |
tree | 56c282fc4d40e5cb613b47cf7be3ea0526ed5b6f /deps/v8/test/cctest/test-api-accessors.cc | |
parent | e0bc5a7361b1d29c3ed034155fd779ce6f44fb13 (diff) | |
download | node-new-c459d8ea5d402c702948c860d9497b2230ff7e8a.tar.gz |
deps: update V8 to 5.7.492.69
PR-URL: https://github.com/nodejs/node/pull/11752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/test-api-accessors.cc')
-rw-r--r-- | deps/v8/test/cctest/test-api-accessors.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc index e9773e918d..cc0c7efb5f 100644 --- a/deps/v8/test/cctest/test-api-accessors.cc +++ b/deps/v8/test/cctest/test-api-accessors.cc @@ -7,6 +7,7 @@ #include "include/v8-experimental.h" #include "include/v8.h" #include "src/api.h" +#include "src/objects-inl.h" namespace i = v8::internal; @@ -247,3 +248,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()); +} |