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 19269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19280 access_check_fail_thrown = false; | 19280 access_check_fail_thrown = false; |
19281 catch_callback_called = false; | 19281 catch_callback_called = false; |
19282 CompileRun("try { [1, 2, 3].sort(); } catch (e) { catcher(e) };"); | 19282 CompileRun("try { [1, 2, 3].sort(); } catch (e) { catcher(e) };"); |
19283 CHECK(!access_check_fail_thrown); | 19283 CHECK(!access_check_fail_thrown); |
19284 CHECK(!catch_callback_called); | 19284 CHECK(!catch_callback_called); |
19285 } | 19285 } |
19286 | 19286 |
19287 | 19287 |
19288 TEST(AccessCheckThrows) { | 19288 TEST(AccessCheckThrows) { |
19289 i::FLAG_allow_natives_syntax = true; | 19289 i::FLAG_allow_natives_syntax = true; |
| 19290 i::FLAG_turbo_try_catch = true; |
19290 v8::V8::Initialize(); | 19291 v8::V8::Initialize(); |
19291 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckThrows); | 19292 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckThrows); |
19292 v8::Isolate* isolate = CcTest::isolate(); | 19293 v8::Isolate* isolate = CcTest::isolate(); |
19293 v8::HandleScope scope(isolate); | 19294 v8::HandleScope scope(isolate); |
19294 | 19295 |
19295 // Create an ObjectTemplate for global objects and install access | 19296 // Create an ObjectTemplate for global objects and install access |
19296 // check callbacks that will block access. | 19297 // check callbacks that will block access. |
19297 v8::Handle<v8::ObjectTemplate> global_template = | 19298 v8::Handle<v8::ObjectTemplate> global_template = |
19298 v8::ObjectTemplate::New(isolate); | 19299 v8::ObjectTemplate::New(isolate); |
19299 global_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); | 19300 global_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL); |
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21511 CHECK_EQ(2U, set->Size()); | 21512 CHECK_EQ(2U, set->Size()); |
21512 | 21513 |
21513 v8::Local<v8::Array> keys = set->AsArray(); | 21514 v8::Local<v8::Array> keys = set->AsArray(); |
21514 CHECK_EQ(2U, keys->Length()); | 21515 CHECK_EQ(2U, keys->Length()); |
21515 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); | 21516 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); |
21516 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); | 21517 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); |
21517 | 21518 |
21518 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); | 21519 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); |
21519 CHECK_EQ(2U, set->Size()); | 21520 CHECK_EQ(2U, set->Size()); |
21520 } | 21521 } |
OLD | NEW |