Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: test/cctest/test-api-interceptors.cc

Issue 1993633002: Version 5.1.281.41 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-accessors.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « test/cctest/test-accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698