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 8151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8162 env2->SetSecurityToken(bar); | 8162 env2->SetSecurityToken(bar); |
8163 { | 8163 { |
8164 Context::Scope scope_env2(env2); | 8164 Context::Scope scope_env2(env2); |
8165 Local<Value> result = CompileRun( | 8165 Local<Value> result = CompileRun( |
8166 "(function() {" | 8166 "(function() {" |
8167 " var obj = { '__proto__': env1 };" | 8167 " var obj = { '__proto__': env1 };" |
8168 " try {" | 8168 " try {" |
8169 " for (var p in obj) {" | 8169 " for (var p in obj) {" |
8170 " if (p == 'prop') return false;" | 8170 " if (p == 'prop') return false;" |
8171 " }" | 8171 " }" |
| 8172 " return true;" |
| 8173 " } catch (e) {" |
8172 " return false;" | 8174 " return false;" |
8173 " } catch (e) {" | |
8174 " return true;" | |
8175 " }" | 8175 " }" |
8176 "})()"); | 8176 "})()"); |
8177 CHECK(result->IsTrue()); | 8177 CHECK(result->IsTrue()); |
8178 } | 8178 } |
8179 } | 8179 } |
8180 | 8180 |
8181 | 8181 |
8182 TEST(ContextDetachGlobal) { | 8182 TEST(ContextDetachGlobal) { |
8183 LocalContext env1; | 8183 LocalContext env1; |
8184 v8::HandleScope handle_scope(env1->GetIsolate()); | 8184 v8::HandleScope handle_scope(env1->GetIsolate()); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8620 "(function() {" | 8620 "(function() {" |
8621 " var obj = { '__proto__': other };" | 8621 " var obj = { '__proto__': other };" |
8622 " try {" | 8622 " try {" |
8623 " for (var p in obj) {" | 8623 " for (var p in obj) {" |
8624 " if (p == 'accessible_prop' ||" | 8624 " if (p == 'accessible_prop' ||" |
8625 " p == 'blocked_js_prop' ||" | 8625 " p == 'blocked_js_prop' ||" |
8626 " p == 'blocked_js_prop') {" | 8626 " p == 'blocked_js_prop') {" |
8627 " return false;" | 8627 " return false;" |
8628 " }" | 8628 " }" |
8629 " }" | 8629 " }" |
| 8630 " return true;" |
| 8631 " } catch (e) {" |
8630 " return false;" | 8632 " return false;" |
8631 " } catch (e) {" | |
8632 " return true;" | |
8633 " }" | 8633 " }" |
8634 "})()"); | 8634 "})()"); |
8635 CHECK(value->IsTrue()); | 8635 CHECK(value->IsTrue()); |
8636 | 8636 |
8637 context1->Exit(); | 8637 context1->Exit(); |
8638 context0->Exit(); | 8638 context0->Exit(); |
8639 } | 8639 } |
8640 | 8640 |
8641 | 8641 |
8642 TEST(AccessControlES5) { | 8642 TEST(AccessControlES5) { |
(...skipping 10712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19355 CheckCorrectThrow("has_own_property(other, 'x')"); | 19355 CheckCorrectThrow("has_own_property(other, 'x')"); |
19356 CheckCorrectThrow("%GetProperty(other, 'x')"); | 19356 CheckCorrectThrow("%GetProperty(other, 'x')"); |
19357 CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)"); | 19357 CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)"); |
19358 CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)"); | 19358 CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)"); |
19359 CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); | 19359 CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); |
19360 CheckCorrectThrow("%DeleteProperty(other, '1', 0)"); | 19360 CheckCorrectThrow("%DeleteProperty(other, '1', 0)"); |
19361 CheckCorrectThrow("%HasOwnProperty(other, 'x')"); | 19361 CheckCorrectThrow("%HasOwnProperty(other, 'x')"); |
19362 CheckCorrectThrow("%HasProperty(other, 'x')"); | 19362 CheckCorrectThrow("%HasProperty(other, 'x')"); |
19363 CheckCorrectThrow("%HasElement(other, 1)"); | 19363 CheckCorrectThrow("%HasElement(other, 1)"); |
19364 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 19364 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
19365 CheckCorrectThrow("%GetPropertyNames(other)"); | |
19366 // PROPERTY_ATTRIBUTES_NONE = 0 | 19365 // PROPERTY_ATTRIBUTES_NONE = 0 |
19367 CheckCorrectThrow("%GetOwnPropertyNames(other, 0)"); | 19366 CheckCorrectThrow("%GetOwnPropertyNames(other, 0)"); |
19368 CheckCorrectThrow("%DefineAccessorPropertyUnchecked(" | 19367 CheckCorrectThrow("%DefineAccessorPropertyUnchecked(" |
19369 "other, 'x', null, null, 1)"); | 19368 "other, 'x', null, null, 1)"); |
19370 | 19369 |
19371 // Reset the failed access check callback so it does not influence | 19370 // Reset the failed access check callback so it does not influence |
19372 // the other tests. | 19371 // the other tests. |
19373 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); | 19372 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); |
19374 } | 19373 } |
19375 | 19374 |
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21837 " fake.age;\n" | 21836 " fake.age;\n" |
21838 " result = 1;\n" | 21837 " result = 1;\n" |
21839 " } catch (e) {\n" | 21838 " } catch (e) {\n" |
21840 " }\n" | 21839 " }\n" |
21841 " test(d+1);\n" | 21840 " test(d+1);\n" |
21842 "}\n" | 21841 "}\n" |
21843 "test(0);\n" | 21842 "test(0);\n" |
21844 "result;\n", | 21843 "result;\n", |
21845 0); | 21844 0); |
21846 } | 21845 } |
OLD | NEW |