Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: src/api.cc

Issue 11802003: Add API for access checks on observed objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 i::FunctionTemplateInfo* constructor = 1460 i::FunctionTemplateInfo* constructor =
1461 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1461 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1462 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1462 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1463 cons->set_undetectable(true); 1463 cons->set_undetectable(true);
1464 } 1464 }
1465 1465
1466 1466
1467 void ObjectTemplate::SetAccessCheckCallbacks( 1467 void ObjectTemplate::SetAccessCheckCallbacks(
1468 NamedSecurityCallback named_callback, 1468 NamedSecurityCallback named_callback,
1469 IndexedSecurityCallback indexed_callback, 1469 IndexedSecurityCallback indexed_callback,
1470 ObserveSecurityCallback observe_callback,
1470 Handle<Value> data, 1471 Handle<Value> data,
1471 bool turned_on_by_default) { 1472 bool turned_on_by_default) {
1472 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1473 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1473 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessCheckCallbacks()")) { 1474 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessCheckCallbacks()")) {
1474 return; 1475 return;
1475 } 1476 }
1476 ENTER_V8(isolate); 1477 ENTER_V8(isolate);
1477 i::HandleScope scope(isolate); 1478 i::HandleScope scope(isolate);
1478 EnsureConstructor(this); 1479 EnsureConstructor(this);
1479 1480
1480 i::Handle<i::Struct> struct_info = 1481 i::Handle<i::Struct> struct_info =
1481 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); 1482 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE);
1482 i::Handle<i::AccessCheckInfo> info = 1483 i::Handle<i::AccessCheckInfo> info =
1483 i::Handle<i::AccessCheckInfo>::cast(struct_info); 1484 i::Handle<i::AccessCheckInfo>::cast(struct_info);
1484 1485
1485 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); 1486 SET_FIELD_WRAPPED(info, set_named_callback, named_callback);
1486 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); 1487 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback);
1488 SET_FIELD_WRAPPED(info, set_observe_callback, observe_callback);
1487 1489
1488 if (data.IsEmpty()) data = v8::Undefined(); 1490 if (data.IsEmpty()) data = v8::Undefined();
1489 info->set_data(*Utils::OpenHandle(*data)); 1491 info->set_data(*Utils::OpenHandle(*data));
1490 1492
1491 i::FunctionTemplateInfo* constructor = 1493 i::FunctionTemplateInfo* constructor =
1492 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1494 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1493 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1495 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1494 cons->set_access_check_info(*info); 1496 cons->set_access_check_info(*info);
1495 cons->set_needs_access_check(turned_on_by_default); 1497 cons->set_needs_access_check(turned_on_by_default);
1496 } 1498 }
1497 1499
1500 void ObjectTemplate::SetAccessCheckCallbacks(
1501 NamedSecurityCallback named_callback,
1502 IndexedSecurityCallback indexed_callback,
1503 Handle<Value> data,
1504 bool turned_on_by_default) {
1505 return SetAccessCheckCallbacks(named_callback,
1506 indexed_callback,
1507 NULL,
1508 data,
1509 turned_on_by_default);
1510 }
1511
1498 1512
1499 void ObjectTemplate::SetIndexedPropertyHandler( 1513 void ObjectTemplate::SetIndexedPropertyHandler(
1500 IndexedPropertyGetter getter, 1514 IndexedPropertyGetter getter,
1501 IndexedPropertySetter setter, 1515 IndexedPropertySetter setter,
1502 IndexedPropertyQuery query, 1516 IndexedPropertyQuery query,
1503 IndexedPropertyDeleter remover, 1517 IndexedPropertyDeleter remover,
1504 IndexedPropertyEnumerator enumerator, 1518 IndexedPropertyEnumerator enumerator,
1505 Handle<Value> data) { 1519 Handle<Value> data) {
1506 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1520 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1507 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetIndexedPropertyHandler()")) { 1521 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetIndexedPropertyHandler()")) {
(...skipping 5225 matching lines...) Expand 10 before | Expand all | Expand 10 after
6733 6747
6734 v->VisitPointers(blocks_.first(), first_block_limit_); 6748 v->VisitPointers(blocks_.first(), first_block_limit_);
6735 6749
6736 for (int i = 1; i < blocks_.length(); i++) { 6750 for (int i = 1; i < blocks_.length(); i++) {
6737 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6751 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6738 } 6752 }
6739 } 6753 }
6740 6754
6741 6755
6742 } } // namespace v8::internal 6756 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698