OLD | NEW |
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 8670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8681 value = CompileRun("Object.getOwnPropertyNames(object).length == 0"); | 8681 value = CompileRun("Object.getOwnPropertyNames(object).length == 0"); |
8682 CHECK(value.IsEmpty()); | 8682 CHECK(value.IsEmpty()); |
8683 | 8683 |
8684 context1->Exit(); | 8684 context1->Exit(); |
8685 context0->Exit(); | 8685 context0->Exit(); |
8686 } | 8686 } |
8687 | 8687 |
8688 | 8688 |
8689 TEST(SuperAccessControl) { | 8689 TEST(SuperAccessControl) { |
8690 i::FLAG_allow_natives_syntax = true; | 8690 i::FLAG_allow_natives_syntax = true; |
8691 i::FLAG_harmony_classes = true; | |
8692 v8::Isolate* isolate = CcTest::isolate(); | 8691 v8::Isolate* isolate = CcTest::isolate(); |
8693 v8::HandleScope handle_scope(isolate); | 8692 v8::HandleScope handle_scope(isolate); |
8694 v8::Handle<v8::ObjectTemplate> obj_template = | 8693 v8::Handle<v8::ObjectTemplate> obj_template = |
8695 v8::ObjectTemplate::New(isolate); | 8694 v8::ObjectTemplate::New(isolate); |
8696 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); | 8695 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); |
8697 LocalContext env; | 8696 LocalContext env; |
8698 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); | 8697 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); |
8699 | 8698 |
8700 { | 8699 { |
8701 v8::TryCatch try_catch(isolate); | 8700 v8::TryCatch try_catch(isolate); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8735 " }" | 8734 " }" |
8736 "}.m;" | 8735 "}.m;" |
8737 "var m = %ToMethod(f, prohibited);" | 8736 "var m = %ToMethod(f, prohibited);" |
8738 "m();"); | 8737 "m();"); |
8739 CHECK(try_catch.HasCaught()); | 8738 CHECK(try_catch.HasCaught()); |
8740 } | 8739 } |
8741 } | 8740 } |
8742 | 8741 |
8743 | 8742 |
8744 TEST(Regress470113) { | 8743 TEST(Regress470113) { |
8745 i::FLAG_harmony_classes = true; | |
8746 v8::Isolate* isolate = CcTest::isolate(); | 8744 v8::Isolate* isolate = CcTest::isolate(); |
8747 v8::HandleScope handle_scope(isolate); | 8745 v8::HandleScope handle_scope(isolate); |
8748 v8::Handle<v8::ObjectTemplate> obj_template = | 8746 v8::Handle<v8::ObjectTemplate> obj_template = |
8749 v8::ObjectTemplate::New(isolate); | 8747 v8::ObjectTemplate::New(isolate); |
8750 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); | 8748 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); |
8751 LocalContext env; | 8749 LocalContext env; |
8752 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); | 8750 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); |
8753 | 8751 |
8754 { | 8752 { |
8755 v8::TryCatch try_catch(isolate); | 8753 v8::TryCatch try_catch(isolate); |
(...skipping 12564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21320 | 21318 |
21321 result = CompileRun( | 21319 result = CompileRun( |
21322 "function f() { return %_GetPrototype(object); }" | 21320 "function f() { return %_GetPrototype(object); }" |
21323 "%OptimizeFunctionOnNextCall(f);" | 21321 "%OptimizeFunctionOnNextCall(f);" |
21324 "f()"); | 21322 "f()"); |
21325 CHECK(result->Equals(proto2)); | 21323 CHECK(result->Equals(proto2)); |
21326 } | 21324 } |
21327 | 21325 |
21328 | 21326 |
21329 TEST(ClassPrototypeCreationContext) { | 21327 TEST(ClassPrototypeCreationContext) { |
21330 i::FLAG_harmony_classes = true; | |
21331 v8::Isolate* isolate = CcTest::isolate(); | 21328 v8::Isolate* isolate = CcTest::isolate(); |
21332 v8::HandleScope handle_scope(isolate); | 21329 v8::HandleScope handle_scope(isolate); |
21333 LocalContext env; | 21330 LocalContext env; |
21334 | 21331 |
21335 Handle<Object> result = Handle<Object>::Cast( | 21332 Handle<Object> result = Handle<Object>::Cast( |
21336 CompileRun("'use strict'; class Example { }; Example.prototype")); | 21333 CompileRun("'use strict'; class Example { }; Example.prototype")); |
21337 CHECK(env.local() == result->CreationContext()); | 21334 CHECK(env.local() == result->CreationContext()); |
21338 } | 21335 } |
21339 | 21336 |
21340 | 21337 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21658 CHECK(set->Has(env.local(), set).FromJust()); | 21655 CHECK(set->Has(env.local(), set).FromJust()); |
21659 | 21656 |
21660 CHECK(set->Delete(env.local(), set).FromJust()); | 21657 CHECK(set->Delete(env.local(), set).FromJust()); |
21661 CHECK_EQ(2U, set->Size()); | 21658 CHECK_EQ(2U, set->Size()); |
21662 CHECK(!set->Has(env.local(), set).FromJust()); | 21659 CHECK(!set->Has(env.local(), set).FromJust()); |
21663 CHECK(!set->Delete(env.local(), set).FromJust()); | 21660 CHECK(!set->Delete(env.local(), set).FromJust()); |
21664 | 21661 |
21665 set->Clear(); | 21662 set->Clear(); |
21666 CHECK_EQ(0U, set->Size()); | 21663 CHECK_EQ(0U, set->Size()); |
21667 } | 21664 } |
OLD | NEW |