| 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 20885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20896 } | 20896 } |
| 20897 for (int i = 0; i < runs; i++) { | 20897 for (int i = 0; i < runs; i++) { |
| 20898 Local<String> expected; | 20898 Local<String> expected; |
| 20899 if (i != 0) { | 20899 if (i != 0) { |
| 20900 CHECK_EQ(v8_str("escape value"), values[i]); | 20900 CHECK_EQ(v8_str("escape value"), values[i]); |
| 20901 } else { | 20901 } else { |
| 20902 CHECK(values[i].IsEmpty()); | 20902 CHECK(values[i].IsEmpty()); |
| 20903 } | 20903 } |
| 20904 } | 20904 } |
| 20905 } | 20905 } |
| 20906 |
| 20907 |
| 20908 TEST(Regress354123) { |
| 20909 LocalContext current; |
| 20910 v8::Isolate* isolate = current->GetIsolate(); |
| 20911 v8::HandleScope scope(isolate); |
| 20912 |
| 20913 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); |
| 20914 templ->SetAccessCheckCallbacks(NamedAccessCounter, IndexedAccessCounter); |
| 20915 current->Global()->Set(v8_str("friend"), templ->NewInstance()); |
| 20916 |
| 20917 // Test access using __proto__ from the prototype chain. |
| 20918 named_access_count = 0; |
| 20919 CompileRun("friend.__proto__ = {};"); |
| 20920 CHECK_EQ(2, named_access_count); |
| 20921 CompileRun("friend.__proto__;"); |
| 20922 CHECK_EQ(4, named_access_count); |
| 20923 |
| 20924 // Test access using __proto__ as a hijacked function. |
| 20925 named_access_count = 0; |
| 20926 CompileRun("var f = Object.prototype.__lookupSetter__('__proto__');" |
| 20927 "f.call(friend, {});"); |
| 20928 CHECK_EQ(1, named_access_count); |
| 20929 CompileRun("var f = Object.prototype.__lookupGetter__('__proto__');" |
| 20930 "f.call(friend);"); |
| 20931 CHECK_EQ(2, named_access_count); |
| 20932 } |
| OLD | NEW |