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

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

Issue 6694021: Merge revision 6179 to trunk (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/version.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 5641 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 } 5652 }
5653 5653
5654 5654
5655 TEST(AccessControlES5) { 5655 TEST(AccessControlES5) {
5656 v8::HandleScope handle_scope; 5656 v8::HandleScope handle_scope;
5657 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); 5657 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
5658 5658
5659 global_template->SetAccessCheckCallbacks(NamedAccessBlocker, 5659 global_template->SetAccessCheckCallbacks(NamedAccessBlocker,
5660 IndexedAccessBlocker); 5660 IndexedAccessBlocker);
5661 5661
5662 // Add accessible accessor.
5663 global_template->SetAccessor(
5664 v8_str("accessible_prop"),
5665 EchoGetter, EchoSetter,
5666 v8::Handle<Value>(),
5667 v8::AccessControl(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE));
5668
5669
5662 // Add an accessor that is not accessible by cross-domain JS code. 5670 // Add an accessor that is not accessible by cross-domain JS code.
5663 global_template->SetAccessor(v8_str("blocked_prop"), 5671 global_template->SetAccessor(v8_str("blocked_prop"),
5664 UnreachableGetter, UnreachableSetter, 5672 UnreachableGetter, UnreachableSetter,
5665 v8::Handle<Value>(), 5673 v8::Handle<Value>(),
5666 v8::DEFAULT); 5674 v8::DEFAULT);
5667 5675
5668 // Create an environment 5676 // Create an environment
5669 v8::Persistent<Context> context0 = Context::New(NULL, global_template); 5677 v8::Persistent<Context> context0 = Context::New(NULL, global_template);
5670 context0->Enter(); 5678 context0->Enter();
5671 5679
(...skipping 20 matching lines...) Expand all
5692 ExpectTrue("Object.isExtensible(other)"); 5700 ExpectTrue("Object.isExtensible(other)");
5693 CompileRun("Object.preventExtensions(other)"); 5701 CompileRun("Object.preventExtensions(other)");
5694 ExpectTrue("Object.isExtensible(other)"); 5702 ExpectTrue("Object.isExtensible(other)");
5695 5703
5696 // Object.seal and Object.freeze. 5704 // Object.seal and Object.freeze.
5697 CompileRun("Object.freeze(other)"); 5705 CompileRun("Object.freeze(other)");
5698 ExpectTrue("Object.isExtensible(other)"); 5706 ExpectTrue("Object.isExtensible(other)");
5699 5707
5700 CompileRun("Object.seal(other)"); 5708 CompileRun("Object.seal(other)");
5701 ExpectTrue("Object.isExtensible(other)"); 5709 ExpectTrue("Object.isExtensible(other)");
5710
5711 // Regression test for issue 1250.
5712 // Make sure that we can set the accessible accessors value using normal
5713 // assignment.
5714 CompileRun("other.accessible_prop = 42");
5715 CHECK_EQ(42, g_echo_value);
5716
5717 v8::Handle<Value> value;
5718 // We follow Safari in ignoring assignments to host object accessors.
5719 CompileRun("Object.defineProperty(other, 'accessible_prop', {value: -1})");
5720 value = CompileRun("other.accessible_prop == 42");
5721 CHECK(value->IsTrue());
5702 } 5722 }
5703 5723
5704 5724
5705 static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global, 5725 static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global,
5706 Local<Value> name, 5726 Local<Value> name,
5707 v8::AccessType type, 5727 v8::AccessType type,
5708 Local<Value> data) { 5728 Local<Value> data) {
5709 return false; 5729 return false;
5710 } 5730 }
5711 5731
(...skipping 7196 matching lines...) Expand 10 before | Expand all | Expand 10 after
12908 v8::Handle<v8::Function> define_property = 12928 v8::Handle<v8::Function> define_property =
12909 CompileRun("(function() {" 12929 CompileRun("(function() {"
12910 " Object.defineProperty(" 12930 " Object.defineProperty("
12911 " this," 12931 " this,"
12912 " 1," 12932 " 1,"
12913 " { configurable: true, enumerable: true, value: 3 });" 12933 " { configurable: true, enumerable: true, value: 3 });"
12914 "})").As<Function>(); 12934 "})").As<Function>();
12915 context->DetachGlobal(); 12935 context->DetachGlobal();
12916 define_property->Call(proxy, 0, NULL); 12936 define_property->Call(proxy, 0, NULL);
12917 } 12937 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698