OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 void Top::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) { | 432 void Top::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) { |
433 if (!thread_local_.failed_access_check_callback_) return; | 433 if (!thread_local_.failed_access_check_callback_) return; |
434 | 434 |
435 ASSERT(receiver->IsAccessCheckNeeded()); | 435 ASSERT(receiver->IsAccessCheckNeeded()); |
436 ASSERT(Top::context()); | 436 ASSERT(Top::context()); |
437 // The callers of this method are not expecting a GC. | 437 // The callers of this method are not expecting a GC. |
438 AssertNoAllocation no_gc; | 438 AssertNoAllocation no_gc; |
439 | 439 |
440 // Get the data object from access check info. | 440 // Get the data object from access check info. |
441 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); | 441 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); |
442 Object* info = constructor->shared()->function_data(); | 442 if (!constructor->shared()->IsApiFunction()) return; |
443 if (info == Heap::undefined_value()) return; | 443 Object* data_obj = |
444 | 444 constructor->shared()->get_api_func_data()->access_check_info(); |
445 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info(); | |
446 if (data_obj == Heap::undefined_value()) return; | 445 if (data_obj == Heap::undefined_value()) return; |
447 | 446 |
448 HandleScope scope; | 447 HandleScope scope; |
449 Handle<JSObject> receiver_handle(receiver); | 448 Handle<JSObject> receiver_handle(receiver); |
450 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data()); | 449 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data()); |
451 thread_local_.failed_access_check_callback_( | 450 thread_local_.failed_access_check_callback_( |
452 v8::Utils::ToLocal(receiver_handle), | 451 v8::Utils::ToLocal(receiver_handle), |
453 type, | 452 type, |
454 v8::Utils::ToLocal(data)); | 453 v8::Utils::ToLocal(data)); |
455 } | 454 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 494 |
496 // Check for compatibility between the security tokens in the | 495 // Check for compatibility between the security tokens in the |
497 // current lexical context and the accessed object. | 496 // current lexical context and the accessed object. |
498 ASSERT(Top::context()); | 497 ASSERT(Top::context()); |
499 | 498 |
500 MayAccessDecision decision = MayAccessPreCheck(receiver, type); | 499 MayAccessDecision decision = MayAccessPreCheck(receiver, type); |
501 if (decision != UNKNOWN) return decision == YES; | 500 if (decision != UNKNOWN) return decision == YES; |
502 | 501 |
503 // Get named access check callback | 502 // Get named access check callback |
504 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); | 503 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); |
505 Object* info = constructor->shared()->function_data(); | 504 if (!constructor->shared()->IsApiFunction()) return false; |
506 if (info == Heap::undefined_value()) return false; | |
507 | 505 |
508 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info(); | 506 Object* data_obj = |
| 507 constructor->shared()->get_api_func_data()->access_check_info(); |
509 if (data_obj == Heap::undefined_value()) return false; | 508 if (data_obj == Heap::undefined_value()) return false; |
510 | 509 |
511 Object* fun_obj = AccessCheckInfo::cast(data_obj)->named_callback(); | 510 Object* fun_obj = AccessCheckInfo::cast(data_obj)->named_callback(); |
512 v8::NamedSecurityCallback callback = | 511 v8::NamedSecurityCallback callback = |
513 v8::ToCData<v8::NamedSecurityCallback>(fun_obj); | 512 v8::ToCData<v8::NamedSecurityCallback>(fun_obj); |
514 | 513 |
515 if (!callback) return false; | 514 if (!callback) return false; |
516 | 515 |
517 HandleScope scope; | 516 HandleScope scope; |
518 Handle<JSObject> receiver_handle(receiver); | 517 Handle<JSObject> receiver_handle(receiver); |
(...skipping 21 matching lines...) Expand all Loading... |
540 // current lexical context and the accessed object. | 539 // current lexical context and the accessed object. |
541 ASSERT(Top::context()); | 540 ASSERT(Top::context()); |
542 // The callers of this method are not expecting a GC. | 541 // The callers of this method are not expecting a GC. |
543 AssertNoAllocation no_gc; | 542 AssertNoAllocation no_gc; |
544 | 543 |
545 MayAccessDecision decision = MayAccessPreCheck(receiver, type); | 544 MayAccessDecision decision = MayAccessPreCheck(receiver, type); |
546 if (decision != UNKNOWN) return decision == YES; | 545 if (decision != UNKNOWN) return decision == YES; |
547 | 546 |
548 // Get indexed access check callback | 547 // Get indexed access check callback |
549 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); | 548 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); |
550 Object* info = constructor->shared()->function_data(); | 549 if (!constructor->shared()->IsApiFunction()) return false; |
551 if (info == Heap::undefined_value()) return false; | |
552 | 550 |
553 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info(); | 551 Object* data_obj = |
| 552 constructor->shared()->get_api_func_data()->access_check_info(); |
554 if (data_obj == Heap::undefined_value()) return false; | 553 if (data_obj == Heap::undefined_value()) return false; |
555 | 554 |
556 Object* fun_obj = AccessCheckInfo::cast(data_obj)->indexed_callback(); | 555 Object* fun_obj = AccessCheckInfo::cast(data_obj)->indexed_callback(); |
557 v8::IndexedSecurityCallback callback = | 556 v8::IndexedSecurityCallback callback = |
558 v8::ToCData<v8::IndexedSecurityCallback>(fun_obj); | 557 v8::ToCData<v8::IndexedSecurityCallback>(fun_obj); |
559 | 558 |
560 if (!callback) return false; | 559 if (!callback) return false; |
561 | 560 |
562 HandleScope scope; | 561 HandleScope scope; |
563 Handle<JSObject> receiver_handle(receiver); | 562 Handle<JSObject> receiver_handle(receiver); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 Top::break_access_->Lock(); | 966 Top::break_access_->Lock(); |
968 } | 967 } |
969 | 968 |
970 | 969 |
971 ExecutionAccess::~ExecutionAccess() { | 970 ExecutionAccess::~ExecutionAccess() { |
972 Top::break_access_->Unlock(); | 971 Top::break_access_->Unlock(); |
973 } | 972 } |
974 | 973 |
975 | 974 |
976 } } // namespace v8::internal | 975 } } // namespace v8::internal |
OLD | NEW |