| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 obj->NewInstance(env.local()).ToLocalChecked()) | 679 obj->NewInstance(env.local()).ToLocalChecked()) |
| 680 .FromJust()); | 680 .FromJust()); |
| 681 CompileRun( | 681 CompileRun( |
| 682 "Object.defineProperty(obj, 'prop', { writable: false });" | 682 "Object.defineProperty(obj, 'prop', { writable: false });" |
| 683 "Object.defineProperty(obj, 'prop', { writable: true });"); | 683 "Object.defineProperty(obj, 'prop', { writable: true });"); |
| 684 } | 684 } |
| 685 | 685 |
| 686 | 686 |
| 687 static bool security_check_value = false; | 687 static bool security_check_value = false; |
| 688 | 688 |
| 689 | |
| 690 static bool SecurityTestCallback(Local<v8::Context> accessing_context, | 689 static bool SecurityTestCallback(Local<v8::Context> accessing_context, |
| 691 Local<v8::Object> accessed_object) { | 690 Local<v8::Object> accessed_object, |
| 691 Local<v8::Value> data) { |
| 692 return security_check_value; | 692 return security_check_value; |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 TEST(PrototypeGetterAccessCheck) { | 696 TEST(PrototypeGetterAccessCheck) { |
| 697 i::FLAG_allow_natives_syntax = true; | 697 i::FLAG_allow_natives_syntax = true; |
| 698 LocalContext env; | 698 LocalContext env; |
| 699 v8::Isolate* isolate = env->GetIsolate(); | 699 v8::Isolate* isolate = env->GetIsolate(); |
| 700 v8::HandleScope scope(isolate); | 700 v8::HandleScope scope(isolate); |
| 701 auto fun_templ = v8::FunctionTemplate::New(isolate); | 701 auto fun_templ = v8::FunctionTemplate::New(isolate); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 | 767 |
| 768 security_check_value = true; | 768 security_check_value = true; |
| 769 ExpectInt32("f()", 907); | 769 ExpectInt32("f()", 907); |
| 770 security_check_value = false; | 770 security_check_value = false; |
| 771 { | 771 { |
| 772 v8::TryCatch try_catch(isolate); | 772 v8::TryCatch try_catch(isolate); |
| 773 CompileRun("f();"); | 773 CompileRun("f();"); |
| 774 CHECK(try_catch.HasCaught()); | 774 CHECK(try_catch.HasCaught()); |
| 775 } | 775 } |
| 776 } | 776 } |
| OLD | NEW |