Add optional data parameter to SetAccessCheckCallback

The data field is passed to the failed access check callback which blink
depends on.

BUG=none
R=verwaest@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1427443002

Cr-Commit-Position: refs/heads/master@{#31555}
This commit is contained in:
jochen 2015-10-26 03:42:11 -07:00 committed by Commit bot
parent d5a91e3d63
commit e2675937d5
2 changed files with 8 additions and 3 deletions

View File

@ -4674,7 +4674,8 @@ class V8_EXPORT ObjectTemplate : public Template {
* the access check callback will be called to determine whether or
* not to allow cross-context access to the properties.
*/
void SetAccessCheckCallback(AccessCheckCallback callback);
void SetAccessCheckCallback(AccessCheckCallback callback,
Local<Value> data = Local<Value>());
V8_DEPRECATE_SOON(
"Use SetAccessCheckCallback instead",

View File

@ -1452,7 +1452,8 @@ void ObjectTemplate::MarkAsUndetectable() {
}
void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback) {
void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback,
Local<Value> data) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
@ -1468,7 +1469,10 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback) {
SET_FIELD_WRAPPED(info, set_named_callback, nullptr);
SET_FIELD_WRAPPED(info, set_indexed_callback, nullptr);
info->set_data(*isolate->factory()->undefined_value());
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
info->set_data(*Utils::OpenHandle(*data));
cons->set_access_check_info(*info);
cons->set_needs_access_check(true);