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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 HandleScope scope; | 457 HandleScope scope; |
458 Handle<JSObject> receiver_handle(receiver); | 458 Handle<JSObject> receiver_handle(receiver); |
459 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data()); | 459 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data()); |
460 thread_local_.failed_access_check_callback_( | 460 thread_local_.failed_access_check_callback_( |
461 v8::Utils::ToLocal(receiver_handle), | 461 v8::Utils::ToLocal(receiver_handle), |
462 type, | 462 type, |
463 v8::Utils::ToLocal(data)); | 463 v8::Utils::ToLocal(data)); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 enum MayAccessDecision{ | 467 enum MayAccessDecision { |
468 YES, NO, UNKNOWN | 468 YES, NO, UNKNOWN |
469 }; | 469 }; |
470 | 470 |
471 | 471 |
472 static MayAccessDecision MayAccessPreCheck(JSObject* receiver, | 472 static MayAccessDecision MayAccessPreCheck(JSObject* receiver, |
473 v8::AccessType type) { | 473 v8::AccessType type) { |
474 // During bootstrapping, callback functions are not enabled yet. | 474 // During bootstrapping, callback functions are not enabled yet. |
475 if (Bootstrapper::IsActive()) return YES; | 475 if (Bootstrapper::IsActive()) return YES; |
476 | 476 |
477 if (receiver->IsJSGlobalProxy()) { | 477 if (receiver->IsJSGlobalProxy()) { |
478 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); | 478 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); |
479 if (!receiver_context->IsContext()) return NO; | 479 if (!receiver_context->IsContext()) return NO; |
480 | 480 |
481 // Get the global context of current top context. | 481 // Get the global context of current top context. |
482 // avoid using Top::global_context() because it uses Handle. | 482 // avoid using Top::global_context() because it uses Handle. |
483 Context* global_context = Top::context()->global()->global_context(); | 483 Context* global_context = Top::context()->global()->global_context(); |
484 if (receiver_context == global_context) return YES; | 484 if (receiver_context == global_context) return YES; |
485 | 485 |
486 if (Context::cast(receiver_context)->security_token() == | 486 if (Context::cast(receiver_context)->security_token() == |
487 global_context->security_token()) | 487 global_context->security_token()) |
488 return YES; | 488 return YES; |
489 } | 489 } |
490 | 490 |
491 return UNKNOWN; | 491 return UNKNOWN; |
492 } | 492 } |
493 | 493 |
494 | 494 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 Top::break_access_->Lock(); | 894 Top::break_access_->Lock(); |
895 } | 895 } |
896 | 896 |
897 | 897 |
898 ExecutionAccess::~ExecutionAccess() { | 898 ExecutionAccess::~ExecutionAccess() { |
899 Top::break_access_->Unlock(); | 899 Top::break_access_->Unlock(); |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 } } // namespace v8::internal | 903 } } // namespace v8::internal |
OLD | NEW |