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 8774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8785 value = CompileRun( | 8785 value = CompileRun( |
8786 "var names = Object.getOwnPropertyNames(object);" | 8786 "var names = Object.getOwnPropertyNames(object);" |
8787 "names.length == 1 && names[0] == 'accessible_prop';"); | 8787 "names.length == 1 && names[0] == 'accessible_prop';"); |
8788 CHECK(value->BooleanValue()); | 8788 CHECK(value->BooleanValue()); |
8789 | 8789 |
8790 context1->Exit(); | 8790 context1->Exit(); |
8791 context0->Exit(); | 8791 context0->Exit(); |
8792 } | 8792 } |
8793 | 8793 |
8794 | 8794 |
8795 TEST(SuperAccessControl) { | |
8796 i::FLAG_allow_natives_syntax = true; | |
8797 v8::Isolate* isolate = CcTest::isolate(); | |
8798 v8::HandleScope handle_scope(isolate); | |
8799 v8::Handle<v8::ObjectTemplate> obj_template = | |
8800 v8::ObjectTemplate::New(isolate); | |
8801 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); | |
8802 LocalContext env; | |
8803 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); | |
8804 | |
8805 { | |
8806 v8::TryCatch try_catch(isolate); | |
8807 CompileRun( | |
8808 "var f = { m() { return super.hasOwnProperty; } }.m;" | |
8809 "var m = %ToMethod(f, prohibited);" | |
8810 "m();"); | |
8811 CHECK(try_catch.HasCaught()); | |
8812 } | |
8813 | |
8814 { | |
8815 v8::TryCatch try_catch(isolate); | |
8816 CompileRun( | |
8817 "var f = {m() { return super[42]; } }.m;" | |
8818 "var m = %ToMethod(f, prohibited);" | |
8819 "m();"); | |
8820 CHECK(try_catch.HasCaught()); | |
8821 } | |
8822 | |
8823 { | |
8824 v8::TryCatch try_catch(isolate); | |
8825 CompileRun( | |
8826 "var f = {m() { super.hasOwnProperty = function () {}; } }.m;" | |
8827 "var m = %ToMethod(f, prohibited);" | |
8828 "m();"); | |
8829 CHECK(try_catch.HasCaught()); | |
8830 } | |
8831 | |
8832 { | |
8833 v8::TryCatch try_catch(isolate); | |
8834 CompileRun( | |
8835 "Object.defineProperty(Object.prototype, 'x', { set : function(){}});" | |
8836 "var f = {" | |
8837 " m() { " | |
8838 " 'use strict';" | |
8839 " super.x = function () {};" | |
8840 " }" | |
8841 "}.m;" | |
8842 "var m = %ToMethod(f, prohibited);" | |
8843 "m();"); | |
8844 CHECK(try_catch.HasCaught()); | |
8845 } | |
8846 } | |
8847 | |
8848 | |
8849 TEST(Regress470113) { | 8795 TEST(Regress470113) { |
8850 v8::Isolate* isolate = CcTest::isolate(); | 8796 v8::Isolate* isolate = CcTest::isolate(); |
8851 v8::HandleScope handle_scope(isolate); | 8797 v8::HandleScope handle_scope(isolate); |
8852 v8::Handle<v8::ObjectTemplate> obj_template = | 8798 v8::Handle<v8::ObjectTemplate> obj_template = |
8853 v8::ObjectTemplate::New(isolate); | 8799 v8::ObjectTemplate::New(isolate); |
8854 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); | 8800 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); |
8855 LocalContext env; | 8801 LocalContext env; |
8856 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); | 8802 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); |
8857 | 8803 |
8858 { | 8804 { |
(...skipping 13052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21911 timeout_thread.Join(); | 21857 timeout_thread.Join(); |
21912 } | 21858 } |
21913 | 21859 |
21914 | 21860 |
21915 TEST(EstimatedContextSize) { | 21861 TEST(EstimatedContextSize) { |
21916 v8::Isolate* isolate = CcTest::isolate(); | 21862 v8::Isolate* isolate = CcTest::isolate(); |
21917 v8::HandleScope scope(isolate); | 21863 v8::HandleScope scope(isolate); |
21918 LocalContext env; | 21864 LocalContext env; |
21919 CHECK(50000 < env->EstimatedSize()); | 21865 CHECK(50000 < env->EstimatedSize()); |
21920 } | 21866 } |
OLD | NEW |