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 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 v8::HandleScope scope(context->GetIsolate()); | 3285 v8::HandleScope scope(context->GetIsolate()); |
3286 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); | 3286 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); |
3287 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); | 3287 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); |
3288 context->Global() | 3288 context->Global() |
3289 ->Set(context.local(), v8_str("Bug"), | 3289 ->Set(context.local(), v8_str("Bug"), |
3290 templ->GetFunction(context.local()).ToLocalChecked()) | 3290 templ->GetFunction(context.local()).ToLocalChecked()) |
3291 .FromJust(); | 3291 .FromJust(); |
3292 CompileRun("Number.prototype.__proto__ = new Bug; var x = 0; x.foo();"); | 3292 CompileRun("Number.prototype.__proto__ = new Bug; var x = 0; x.foo();"); |
3293 } | 3293 } |
3294 | 3294 |
| 3295 THREADED_TEST(Regress625155) { |
| 3296 LocalContext context; |
| 3297 v8::HandleScope scope(context->GetIsolate()); |
| 3298 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); |
| 3299 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); |
| 3300 context->Global() |
| 3301 ->Set(context.local(), v8_str("Bug"), |
| 3302 templ->GetFunction(context.local()).ToLocalChecked()) |
| 3303 .FromJust(); |
| 3304 CompileRun( |
| 3305 "Number.prototype.__proto__ = new Bug;" |
| 3306 "var x;" |
| 3307 "x = 0xdead;" |
| 3308 "x.boom = 0;" |
| 3309 "x = 's';" |
| 3310 "x.boom = 0;" |
| 3311 "x = 1.5;" |
| 3312 "x.boom = 0;"); |
| 3313 } |
3295 | 3314 |
3296 THREADED_TEST(Regress125988) { | 3315 THREADED_TEST(Regress125988) { |
3297 v8::HandleScope scope(CcTest::isolate()); | 3316 v8::HandleScope scope(CcTest::isolate()); |
3298 Local<FunctionTemplate> intercept = FunctionTemplate::New(CcTest::isolate()); | 3317 Local<FunctionTemplate> intercept = FunctionTemplate::New(CcTest::isolate()); |
3299 AddInterceptor(intercept, EmptyInterceptorGetter, EmptyInterceptorSetter); | 3318 AddInterceptor(intercept, EmptyInterceptorGetter, EmptyInterceptorSetter); |
3300 LocalContext env; | 3319 LocalContext env; |
3301 env->Global() | 3320 env->Global() |
3302 ->Set(env.local(), v8_str("Intercept"), | 3321 ->Set(env.local(), v8_str("Intercept"), |
3303 intercept->GetFunction(env.local()).ToLocalChecked()) | 3322 intercept->GetFunction(env.local()).ToLocalChecked()) |
3304 .FromJust(); | 3323 .FromJust(); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3953 ->Set(env.local(), v8_str("Fun"), | 3972 ->Set(env.local(), v8_str("Fun"), |
3954 fun_templ->GetFunction(env.local()).ToLocalChecked()) | 3973 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
3955 .FromJust()); | 3974 .FromJust()); |
3956 | 3975 |
3957 CompileRun( | 3976 CompileRun( |
3958 "var f = new Fun();" | 3977 "var f = new Fun();" |
3959 "Number.prototype.__proto__ = f;" | 3978 "Number.prototype.__proto__ = f;" |
3960 "var a = 42;" | 3979 "var a = 42;" |
3961 "for (var i = 0; i<3; i++) { a.foo; }"); | 3980 "for (var i = 0; i<3; i++) { a.foo; }"); |
3962 } | 3981 } |
OLD | NEW |