Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 40ba86e

Browse files
committed
Cleanup leftovers of unsupported and no longer supported methods on V8\ObjectTemplate
1 parent 3baa168 commit 40ba86e

7 files changed

+0
-683
lines changed

src/php_v8_callbacks.cc

-41
Original file line numberDiff line numberDiff line change
@@ -526,44 +526,3 @@ void php_v8_callback_indexed_property_enumerator(const v8::PropertyCallbackInfo<
526526

527527
zval_ptr_dtor(&args);
528528
}
529-
530-
bool php_v8_callback_access_check(v8::Local<v8::Context> accessing_context, v8::Local<v8::Object> accessed_object, v8::Local<v8::Value> data) {
531-
PHP_V8_THROW_EXCEPTION("Broken due to problem (see https://groups.google.com/forum/?fromgroups#!topic/v8-dev/c7LhW2bNabY)");
532-
return false;
533-
534-
PHP_V8_DECLARE_ISOLATE_LOCAL_ALIAS(v8::Isolate::GetCurrent());
535-
php_v8_isolate_t *php_v8_isolate = PHP_V8_ISOLATE_FETCH_REFERENCE(isolate);
536-
537-
538-
zval args;
539-
zval accessed_object_zv;
540-
zval retval;
541-
zval context_zv;
542-
543-
bool security_retval = false;
544-
545-
ZVAL_BOOL(&retval, false);
546-
547-
array_init_size(&args, 2);
548-
549-
php_v8_context_t *php_v8_context = php_v8_context_get_reference(accessing_context);
550-
551-
assert(NULL != php_v8_context);
552-
553-
php_v8_get_or_create_value(&accessed_object_zv, accessed_object, php_v8_isolate);
554-
555-
ZVAL_OBJ(&context_zv, &php_v8_context->std);
556-
add_index_zval(&args, 0, &context_zv);
557-
add_index_zval(&args, 1, &accessed_object_zv);
558-
559-
php_v8_callback_call_from_bucket_with_zargs(phpv8::CallbacksBucket::Index::Callback, data, &args, &retval);
560-
561-
if (Z_TYPE(retval) == IS_TRUE) {
562-
security_retval = true;
563-
}
564-
565-
zval_ptr_dtor(&args);
566-
zval_ptr_dtor(&retval);
567-
568-
return security_retval;
569-
}

src/php_v8_callbacks.h

-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ extern void php_v8_callback_indexed_property_query(uint32_t index, const v8::Pro
5656
extern void php_v8_callback_indexed_property_deleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info);
5757
extern void php_v8_callback_indexed_property_enumerator(const v8::PropertyCallbackInfo<v8::Array>& info);
5858

59-
extern bool php_v8_callback_access_check(v8::Local<v8::Context> accessing_context, v8::Local<v8::Object> accessed_object, v8::Local<v8::Value> data);
60-
6159
//#define PHP_V8_DEBUG_EXTERNAL_MEM 1
6260

6361
#ifdef PHP_V8_DEBUG_EXTERNAL_MEM

src/php_v8_object_template.cc

-52
Original file line numberDiff line numberDiff line change
@@ -362,41 +362,6 @@ static PHP_METHOD(V8ObjectTemplate, SetCallAsFunctionHandler) {
362362

363363
local_template->SetCallAsFunctionHandler(callback, data);
364364
}
365-
// NOTE: Method is not supported anymore due to a limited use and a way it implemented (causes segfault under certain conditions)
366-
/*
367-
static PHP_METHOD(V8ObjectTemplate, MarkAsUndetectable) {
368-
if (zend_parse_parameters_none() == FAILURE) {
369-
return;
370-
}
371-
372-
PHP_V8_FETCH_OBJECT_TEMPLATE_WITH_CHECK(getThis(), php_v8_object_template);
373-
PHP_V8_ENTER_STORED_ISOLATE(php_v8_object_template);
374-
375-
v8::Local<v8::ObjectTemplate> local_template = php_v8_object_template_get_local(isolate, php_v8_object_template);
376-
377-
local_template->MarkAsUndetectable();
378-
}
379-
*/
380-
381-
// not used currently
382-
static PHP_METHOD(V8ObjectTemplate, SetAccessCheckCallback) {
383-
zend_fcall_info fci_callback = empty_fcall_info;
384-
zend_fcall_info_cache fci_cache_callback = empty_fcall_info_cache;
385-
386-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci_callback, &fci_cache_callback) == FAILURE) {
387-
return;
388-
}
389-
390-
PHP_V8_FETCH_OBJECT_TEMPLATE_WITH_CHECK(getThis(), php_v8_object_template);
391-
PHP_V8_ENTER_STORED_ISOLATE(php_v8_object_template);
392-
393-
phpv8::CallbacksBucket *bucket = php_v8_object_template->persistent_data->bucket("access_check");
394-
bucket->add(phpv8::CallbacksBucket::Index::Callback, fci_callback, fci_cache_callback);
395-
396-
v8::Local<v8::ObjectTemplate> local_template = php_v8_object_template_get_local(php_v8_object_template);
397-
398-
local_template->SetAccessCheckCallback(php_v8_callback_access_check, v8::External::New(isolate, bucket));
399-
}
400365

401366
/* Non-standard, implementations of AdjustableExternalMemoryInterface::AdjustExternalAllocatedMemory */
402367
static PHP_METHOD(V8ObjectTemplate, AdjustExternalAllocatedMemory) {
@@ -472,21 +437,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_php_v8_object_template_SetCallAsFunctionHandler,
472437
ZEND_ARG_INFO(0, callback)
473438
ZEND_END_ARG_INFO()
474439

475-
// not used
476-
// void method
477-
/*
478-
ZEND_BEGIN_ARG_INFO_EX(arginfo_php_v8_object_template_MarkAsUndetectable, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
479-
ZEND_END_ARG_INFO()
480-
*/
481-
482-
// not used
483-
// void method
484-
/*
485-
ZEND_BEGIN_ARG_INFO_EX(arginfo_php_v8_object_template_SetAccessCheckCallback, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
486-
ZEND_ARG_CALLABLE_INFO(0, callback, 1)
487-
ZEND_END_ARG_INFO()
488-
*/
489-
490440
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_v8_object_template_AdjustExternalAllocatedMemory, ZEND_RETURN_VALUE, 1, IS_LONG, 0)
491441
ZEND_ARG_TYPE_INFO(0, change_in_bytes, IS_LONG, 0)
492442
ZEND_END_ARG_INFO()
@@ -511,8 +461,6 @@ static const zend_function_entry php_v8_object_template_methods[] = {
511461
PHP_ME(V8ObjectTemplate, SetHandlerForNamedProperty, arginfo_php_v8_object_template_SetHandlerForNamedProperty, ZEND_ACC_PUBLIC)
512462
PHP_ME(V8ObjectTemplate, SetHandlerForIndexedProperty, arginfo_php_v8_object_template_SetHandlerForIndexedProperty, ZEND_ACC_PUBLIC)
513463
PHP_ME(V8ObjectTemplate, SetCallAsFunctionHandler, arginfo_php_v8_object_template_SetCallAsFunctionHandler, ZEND_ACC_PUBLIC)
514-
// PHP_ME(V8ObjectTemplate, MarkAsUndetectable, arginfo_php_v8_object_template_MarkAsUndetectable, ZEND_ACC_PUBLIC)
515-
// PHP_ME(V8ObjectTemplate, SetAccessCheckCallback, arginfo_php_v8_object_template_SetAccessCheckCallback, ZEND_ACC_PUBLIC)
516464

517465
PHP_ME(V8ObjectTemplate, AdjustExternalAllocatedMemory, arginfo_v8_object_template_AdjustExternalAllocatedMemory, ZEND_ACC_PUBLIC)
518466
PHP_ME(V8ObjectTemplate, GetExternalAllocatedMemory, arginfo_v8_object_template_GetExternalAllocatedMemory, ZEND_ACC_PUBLIC)

stubs/src/ObjectTemplate.php

-52
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,6 @@ public function SetAccessor(
8585
) {
8686
}
8787

88-
///**
89-
// * Sets a named or indexed property handler on the object template.
90-
// *
91-
// * See \v8\NamedPropertyHandlerConfiguration and \v8\IndexedPropertyHandlerConfiguration constructor argument
92-
// * description for details
93-
// *
94-
// * @param \v8\NamedPropertyHandlerConfiguration | \v8\IndexedPropertyHandlerConfiguration $configuration
95-
// */
96-
//public function SetHandler(NamedPropertyHandlerConfiguration $configuration)
97-
//{
98-
//}
99-
10088
/**
10189
* Sets a named property handler on the object template.
10290
*
@@ -140,46 +128,6 @@ public function SetCallAsFunctionHandler(callable $callback)
140128
{
141129
}
142130

143-
// Method is not supported anymore due to a limited use and a way it implemented (causes segfault under certain conditions)
144-
// see v8/src/api-natives.cc:677
145-
// // Mark as undetectable if needed.
146-
// if (obj->undetectable()) {
147-
// // We only allow callable undetectable receivers here, since this whole
148-
// // undetectable business is only to support document.all, which is both
149-
// // undetectable and callable. If we ever see the need to have an object
150-
// // that is undetectable but not callable, we need to update the types.h
151-
// // to allow encoding this.
152-
// CHECK(!obj->instance_call_handler()->IsUndefined(isolate));
153-
// map->set_is_undetectable();
154-
// }
155-
156-
157-
///**
158-
// * Mark object instances of the template as undetectable.
159-
// *
160-
// * In many ways, undetectable objects behave as though they are not
161-
// * there. They behave like 'undefined' in conditionals and when
162-
// * printed. However, properties can be accessed and called as on
163-
// * normal objects.
164-
// */
165-
//public function MarkAsUndetectable()
166-
//{
167-
//}
168-
169-
// Disabled due to https://groups.google.com/forum/#!topic/v8-dev/c7LhW2bNabY and it should be not necessary to use
170-
// it in other then browser setup in most cases, though It would be nice to have it for API consistency reason.
171-
///**
172-
// * Sets access check callback on the object template and enables access
173-
// * checks.
174-
// *
175-
// * When accessing properties on instances of this object template,
176-
// * the access check callback will be called to determine whether or
177-
// * not to allow cross-context access to the properties.
178-
// */
179-
//public function SetAccessCheckCallback(callable $callback)
180-
//{
181-
//}
182-
183131
/**
184132
* {@inheritdoc}
185133
*/

tests/V8ObjectTemplate_MarkAsUndetectable.phpt

-54
This file was deleted.

0 commit comments

Comments
 (0)