Line data Source code
1 : // Copyright 2017 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "include/v8.h"
6 : #include "test/unittests/test-utils.h"
7 : #include "testing/gtest/include/gtest/gtest.h"
8 :
9 : namespace v8 {
10 : namespace {
11 :
12 : using InterceptorTest = TestWithContext;
13 :
14 0 : void NamedGetter(Local<Name> property,
15 0 : const PropertyCallbackInfo<Value>& info) {}
16 :
17 13159 : TEST_F(InterceptorTest, FreezeApiObjectWithInterceptor) {
18 1 : TryCatch try_catch(isolate());
19 :
20 1 : Local<FunctionTemplate> tmpl = FunctionTemplate::New(isolate());
21 : tmpl->InstanceTemplate()->SetHandler(
22 2 : NamedPropertyHandlerConfiguration(NamedGetter));
23 :
24 1 : Local<Function> ctor = tmpl->GetFunction(context()).ToLocalChecked();
25 : Local<Object> obj = ctor->NewInstance(context()).ToLocalChecked();
26 2 : ASSERT_TRUE(
27 : obj->SetIntegrityLevel(context(), IntegrityLevel::kFrozen).IsNothing());
28 3 : ASSERT_TRUE(try_catch.HasCaught());
29 : }
30 :
31 : } // namespace
32 7893 : } // namespace v8
|