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 3870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3881 "var obj = intercepted_1;" | 3881 "var obj = intercepted_1;" |
3882 "obj.x = 4;" | 3882 "obj.x = 4;" |
3883 "eval('obj.x');" | 3883 "eval('obj.x');" |
3884 "eval('obj.x');" | 3884 "eval('obj.x');" |
3885 "eval('obj.x');" | 3885 "eval('obj.x');" |
3886 "obj = intercepted_2;" | 3886 "obj = intercepted_2;" |
3887 "obj.x = 9;" | 3887 "obj.x = 9;" |
3888 "eval('obj.x');", | 3888 "eval('obj.x');", |
3889 9); | 3889 9); |
3890 } | 3890 } |
| 3891 |
| 3892 static void CheckReceiver(Local<Name> name, |
| 3893 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 3894 CHECK(info.This()->IsObject()); |
| 3895 } |
| 3896 |
| 3897 TEST(Regress609134Interceptor) { |
| 3898 LocalContext env; |
| 3899 v8::Isolate* isolate = env->GetIsolate(); |
| 3900 v8::HandleScope scope(isolate); |
| 3901 auto fun_templ = v8::FunctionTemplate::New(isolate); |
| 3902 fun_templ->InstanceTemplate()->SetHandler( |
| 3903 v8::NamedPropertyHandlerConfiguration(CheckReceiver)); |
| 3904 |
| 3905 CHECK(env->Global() |
| 3906 ->Set(env.local(), v8_str("Fun"), |
| 3907 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
| 3908 .FromJust()); |
| 3909 |
| 3910 CompileRun( |
| 3911 "var f = new Fun();" |
| 3912 "Number.prototype.__proto__ = f;" |
| 3913 "var a = 42;" |
| 3914 "for (var i = 0; i<3; i++) { a.foo; }"); |
| 3915 } |
OLD | NEW |