OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "test/cctest/test-api.h" | 7 #include "test/cctest/test-api.h" |
8 | 8 |
9 #include "include/v8-util.h" | 9 #include "include/v8-util.h" |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 | 4331 |
4332 auto interceptor = | 4332 auto interceptor = |
4333 interceptor_templ->NewInstance(context.local()).ToLocalChecked(); | 4333 interceptor_templ->NewInstance(context.local()).ToLocalChecked(); |
4334 context->Global() | 4334 context->Global() |
4335 ->Set(context.local(), v8_str("obj"), interceptor) | 4335 ->Set(context.local(), v8_str("obj"), interceptor) |
4336 .FromJust(); | 4336 .FromJust(); |
4337 | 4337 |
4338 ExpectInt32("obj.whatever", 239); | 4338 ExpectInt32("obj.whatever", 239); |
4339 | 4339 |
4340 CompileRun("obj.whatever = 4;"); | 4340 CompileRun("obj.whatever = 4;"); |
| 4341 |
| 4342 // obj.whatever exists, thus it is not affected by the non-masking |
| 4343 // interceptor. |
4341 ExpectInt32("obj.whatever", 4); | 4344 ExpectInt32("obj.whatever", 4); |
4342 | 4345 |
4343 CompileRun("delete obj.whatever;"); | 4346 CompileRun("delete obj.whatever;"); |
4344 ExpectInt32("obj.whatever", 239); | 4347 ExpectInt32("obj.whatever", 239); |
4345 } | 4348 } |
4346 | 4349 |
4347 | 4350 |
4348 THREADED_TEST(NonMaskingInterceptorPrototypeProperty) { | 4351 THREADED_TEST(NonMaskingInterceptorPrototypeProperty) { |
4349 auto isolate = CcTest::isolate(); | 4352 auto isolate = CcTest::isolate(); |
4350 v8::HandleScope handle_scope(isolate); | 4353 v8::HandleScope handle_scope(isolate); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4534 ->Set(env.local(), v8_str("Fun"), | 4537 ->Set(env.local(), v8_str("Fun"), |
4535 fun_templ->GetFunction(env.local()).ToLocalChecked()) | 4538 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
4536 .FromJust()); | 4539 .FromJust()); |
4537 | 4540 |
4538 CompileRun( | 4541 CompileRun( |
4539 "var f = new Fun();" | 4542 "var f = new Fun();" |
4540 "Number.prototype.__proto__ = f;" | 4543 "Number.prototype.__proto__ = f;" |
4541 "var a = 42;" | 4544 "var a = 42;" |
4542 "for (var i = 0; i<3; i++) { a.foo; }"); | 4545 "for (var i = 0; i<3; i++) { a.foo; }"); |
4543 } | 4546 } |
OLD | NEW |