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

Side by Side Diff: test/cctest/test-accessors.cc

Issue 1431473003: Mark GetCallingContext as soon-to-be deprecated (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate); 528 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
529 obj->SetHandler(v8::NamedPropertyHandlerConfiguration( 529 obj->SetHandler(v8::NamedPropertyHandlerConfiguration(
530 JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator)); 530 JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator));
531 env->Global()->Set(v8_str("obj"), obj->NewInstance()); 531 env->Global()->Set(v8_str("obj"), obj->NewInstance());
532 v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}"); 532 v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}");
533 CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected)); 533 CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected));
534 } 534 }
535 535
536 536
537 static v8::Local<v8::Context> expected_current_context; 537 static v8::Local<v8::Context> expected_current_context;
538 static v8::Local<v8::Context> expected_calling_context;
539 538
540 539
541 static void check_contexts(const v8::FunctionCallbackInfo<v8::Value>& info) { 540 static void check_contexts(const v8::FunctionCallbackInfo<v8::Value>& info) {
542 ApiTestFuzzer::Fuzz(); 541 ApiTestFuzzer::Fuzz();
543 CHECK(expected_current_context == info.GetIsolate()->GetCurrentContext()); 542 CHECK(expected_current_context == info.GetIsolate()->GetCurrentContext());
544 CHECK(expected_calling_context == info.GetIsolate()->GetCallingContext());
545 } 543 }
546 544
547 545
548 THREADED_TEST(AccessorPropertyCrossContext) { 546 THREADED_TEST(AccessorPropertyCrossContext) {
549 LocalContext env; 547 LocalContext env;
550 v8::Isolate* isolate = env->GetIsolate(); 548 v8::Isolate* isolate = env->GetIsolate();
551 v8::HandleScope scope(isolate); 549 v8::HandleScope scope(isolate);
552 v8::Handle<v8::Function> fun = v8::Function::New(isolate, check_contexts); 550 v8::Handle<v8::Function> fun = v8::Function::New(isolate, check_contexts);
553 LocalContext switch_context; 551 LocalContext switch_context;
554 switch_context->Global()->Set(v8_str("fun"), fun); 552 switch_context->Global()->Set(v8_str("fun"), fun);
555 v8::TryCatch try_catch(isolate); 553 v8::TryCatch try_catch(isolate);
556 expected_current_context = env.local(); 554 expected_current_context = env.local();
557 expected_calling_context = switch_context.local();
558 CompileRun( 555 CompileRun(
559 "var o = Object.create(null, { n: { get:fun } });" 556 "var o = Object.create(null, { n: { get:fun } });"
560 "for (var i = 0; i < 10; i++) o.n;"); 557 "for (var i = 0; i < 10; i++) o.n;");
561 CHECK(!try_catch.HasCaught()); 558 CHECK(!try_catch.HasCaught());
562 } 559 }
563 560
564 561
565 THREADED_TEST(GlobalObjectAccessor) { 562 THREADED_TEST(GlobalObjectAccessor) {
566 LocalContext env; 563 LocalContext env;
567 v8::Isolate* isolate = env->GetIsolate(); 564 v8::Isolate* isolate = env->GetIsolate();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 678
682 security_check_value = true; 679 security_check_value = true;
683 ExpectInt32("f()", 907); 680 ExpectInt32("f()", 907);
684 security_check_value = false; 681 security_check_value = false;
685 { 682 {
686 v8::TryCatch try_catch(isolate); 683 v8::TryCatch try_catch(isolate);
687 CompileRun("f();"); 684 CompileRun("f();");
688 CHECK(try_catch.HasCaught()); 685 CHECK(try_catch.HasCaught());
689 } 686 }
690 } 687 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698