mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-08 15:48:40 +00:00
Merge pull request #311 from stesie/fix-deprecated
Fix deprecated V8 API calls
This commit is contained in:
commit
f87cf9f539
6
Vagrantfile
vendored
6
Vagrantfile
vendored
@ -8,17 +8,17 @@
|
|||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
# Every Vagrant development environment requires a box. You can search for
|
# Every Vagrant development environment requires a box. You can search for
|
||||||
# boxes at https://atlas.hashicorp.com/search.
|
# boxes at https://atlas.hashicorp.com/search.
|
||||||
config.vm.box = "ubuntu/trusty64"
|
config.vm.box = "ubuntu/xenial64"
|
||||||
|
|
||||||
config.vm.provider "lxc" do |lxc, override|
|
config.vm.provider "lxc" do |lxc, override|
|
||||||
override.vm.box = "fgrehm/trusty64-lxc"
|
override.vm.box = "zaikin/xenial64-lxc"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# mass-define "generic" Ubuntu boxes
|
# mass-define "generic" Ubuntu boxes
|
||||||
#
|
#
|
||||||
%w{5.1 5.2 5.4 5.7 5.8 5.9 6.0}.each { |version|
|
%w{5.7 5.8 5.9 6.0}.each { |version|
|
||||||
config.vm.define "v8-#{version}" do |i|
|
config.vm.define "v8-#{version}" do |i|
|
||||||
i.vm.synced_folder ".", "/data/v8js"
|
i.vm.synced_folder ".", "/data/v8js"
|
||||||
|
|
||||||
|
@ -188,6 +188,8 @@ int main ()
|
|||||||
LDFLAGS="$old_LDFLAGS"
|
LDFLAGS="$old_LDFLAGS"
|
||||||
CPPFLAGS=$old_CPPFLAGS
|
CPPFLAGS=$old_CPPFLAGS
|
||||||
|
|
||||||
|
AC_DEFINE([V8_DEPRECATION_WARNINGS], [1], [Enable compiler warnings when using V8_DEPRECATED apis.])
|
||||||
|
|
||||||
PHP_ADD_INCLUDE($V8_DIR)
|
PHP_ADD_INCLUDE($V8_DIR)
|
||||||
PHP_NEW_EXTENSION(v8js, [ \
|
PHP_NEW_EXTENSION(v8js, [ \
|
||||||
v8js_array_access.cc \
|
v8js_array_access.cc \
|
||||||
|
@ -410,8 +410,7 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
/* Redirect fatal errors to PHP error handler */
|
/* Redirect fatal errors to PHP error handler */
|
||||||
// This needs to be done within the context isolate
|
isolate->SetFatalErrorHandler(v8js_fatal_error_handler);
|
||||||
v8::V8::SetFatalErrorHandler(v8js_fatal_error_handler);
|
|
||||||
|
|
||||||
/* Create global template for global object */
|
/* Create global template for global object */
|
||||||
// Now we are using multiple isolates this needs to be created for every context
|
// Now we are using multiple isolates this needs to be created for every context
|
||||||
@ -486,7 +485,7 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
/* Add the PHP object into global object */
|
/* Add the PHP object into global object */
|
||||||
php_obj_t->InstanceTemplate()->SetInternalFieldCount(2);
|
php_obj_t->InstanceTemplate()->SetInternalFieldCount(2);
|
||||||
v8::Local<v8::Object> php_obj = php_obj_t->InstanceTemplate()->NewInstance();
|
v8::Local<v8::Object> php_obj = php_obj_t->InstanceTemplate()->NewInstance();
|
||||||
V8JS_GLOBAL(isolate)->ForceSet(object_name_js, php_obj, v8::ReadOnly);
|
V8JS_GLOBAL(isolate)->DefineOwnProperty(context, object_name_js, php_obj, v8::ReadOnly);
|
||||||
|
|
||||||
/* Export public property values */
|
/* Export public property values */
|
||||||
HashTable *properties = zend_std_get_properties(getThis());
|
HashTable *properties = zend_std_get_properties(getThis());
|
||||||
@ -504,12 +503,12 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> key = v8::String::NewFromUtf8(isolate, ZSTR_VAL(member),
|
v8::Local<v8::Name> key = v8::String::NewFromUtf8(isolate, ZSTR_VAL(member),
|
||||||
v8::String::kInternalizedString, static_cast<int>(ZSTR_LEN(member)));
|
v8::String::kInternalizedString, static_cast<int>(ZSTR_LEN(member)));
|
||||||
|
|
||||||
/* Write value to PHP JS object */
|
/* Write value to PHP JS object */
|
||||||
value = OBJ_PROP(Z_OBJ_P(getThis()), property_info->offset);
|
value = OBJ_PROP(Z_OBJ_P(getThis()), property_info->offset);
|
||||||
php_obj->ForceSet(key, zval_to_v8js(value, isolate), v8::ReadOnly);
|
php_obj->DefineOwnProperty(context, key, zval_to_v8js(value, isolate), v8::ReadOnly);
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
|
||||||
@ -584,7 +583,7 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
persistent_ft->Reset(isolate, ft);
|
persistent_ft->Reset(isolate, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
php_obj->ForceSet(method_name, ft->GetFunction());
|
php_obj->CreateDataProperty(context, method_name, ft->GetFunction());
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@ -616,7 +615,7 @@ static void v8js_compile_script(zval *this_ptr, const zend_string *str, const ze
|
|||||||
V8JS_BEGIN_CTX(c, this_ptr)
|
V8JS_BEGIN_CTX(c, this_ptr)
|
||||||
|
|
||||||
/* Catch JS exceptions */
|
/* Catch JS exceptions */
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch(isolate);
|
||||||
|
|
||||||
/* Set script identifier */
|
/* Set script identifier */
|
||||||
if (identifier && ZSTR_LEN(identifier) > std::numeric_limits<int>::max()) {
|
if (identifier && ZSTR_LEN(identifier) > std::numeric_limits<int>::max()) {
|
||||||
@ -1289,8 +1288,8 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void **
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write value to PHP JS object */
|
/* Write value to PHP JS object */
|
||||||
v8::Local<v8::Value> key = V8JS_SYML(Z_STRVAL_P(member), static_cast<int>(Z_STRLEN_P(member)));
|
v8::Local<v8::Name> key = V8JS_SYML(Z_STRVAL_P(member), static_cast<int>(Z_STRLEN_P(member)));
|
||||||
jsobj->ForceSet(key, zval_to_v8js(value, isolate), v8::ReadOnly);
|
jsobj->DefineOwnProperty(v8_context, key, zval_to_v8js(value, isolate), v8::ReadOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write value to PHP object */
|
/* Write value to PHP object */
|
||||||
|
@ -44,7 +44,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
|
|||||||
v8::Local<v8::Message> tc_message = try_catch->Message();
|
v8::Local<v8::Message> tc_message = try_catch->Message();
|
||||||
const char *filename_string, *sourceline_string;
|
const char *filename_string, *sourceline_string;
|
||||||
char *message_string;
|
char *message_string;
|
||||||
int linenum, start_col, end_col;
|
int linenum, start_col;
|
||||||
|
|
||||||
object_init_ex(return_value, php_ce_v8js_script_exception);
|
object_init_ex(return_value, php_ce_v8js_script_exception);
|
||||||
|
|
||||||
@ -70,8 +70,10 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
|
|||||||
start_col = tc_message->GetStartColumn();
|
start_col = tc_message->GetStartColumn();
|
||||||
PHPV8_EXPROP(_long, JsStartColumn, start_col);
|
PHPV8_EXPROP(_long, JsStartColumn, start_col);
|
||||||
|
|
||||||
end_col = tc_message->GetEndColumn();
|
v8::Maybe<int> end_col = tc_message->GetEndColumn(isolate->GetEnteredContext());
|
||||||
PHPV8_EXPROP(_long, JsEndColumn, end_col);
|
if (end_col.IsJust()) {
|
||||||
|
PHPV8_EXPROP(_long, JsEndColumn, end_col.FromJust());
|
||||||
|
}
|
||||||
|
|
||||||
spprintf(&message_string, 0, "%s:%d: %s", filename_string, linenum, exception_string);
|
spprintf(&message_string, 0, "%s:%d: %s", filename_string, linenum, exception_string);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ v8::Local<v8::Value> v8js_wrap_generator(v8::Isolate *isolate, v8::Local<v8::Val
|
|||||||
assert(!wrapped_object.IsEmpty());
|
assert(!wrapped_object.IsEmpty());
|
||||||
assert(wrapped_object->IsObject());
|
assert(wrapped_object->IsObject());
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch(isolate);
|
||||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, "(\
|
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, "(\
|
||||||
function(wrapped_object) { \
|
function(wrapped_object) { \
|
||||||
return (function*() { \
|
return (function*() { \
|
||||||
|
@ -92,7 +92,7 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local<v8::Value> var, int leve
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::TryCatch try_catch; /* object.toString() can throw an exception */
|
v8::TryCatch try_catch(isolate); /* object.toString() can throw an exception */
|
||||||
v8::Local<v8::String> details;
|
v8::Local<v8::String> details;
|
||||||
|
|
||||||
if(var->IsRegExp()) {
|
if(var->IsRegExp()) {
|
||||||
@ -100,7 +100,7 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local<v8::Value> var, int leve
|
|||||||
details = re->GetSource();
|
details = re->GetSource();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
details = var->ToDetailString();
|
details = var->ToDetailString(isolate->GetEnteredContext()).FromMaybe(v8::Local<v8::String>());
|
||||||
|
|
||||||
if (try_catch.HasCaught()) {
|
if (try_catch.HasCaught()) {
|
||||||
details = V8JS_SYM("<toString threw exception>");
|
details = V8JS_SYM("<toString threw exception>");
|
||||||
@ -401,18 +401,18 @@ V8JS_METHOD(require)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a template for the global object and set the built-in global functions
|
// Create a template for the global object and set the built-in global functions
|
||||||
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
|
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
|
||||||
global_template->Set(V8JS_SYM("print"), v8::FunctionTemplate::New(isolate, V8JS_MN(print)), v8::ReadOnly);
|
global_template->Set(V8JS_SYM("print"), v8::FunctionTemplate::New(isolate, V8JS_MN(print)), v8::ReadOnly);
|
||||||
global_template->Set(V8JS_SYM("var_dump"), v8::FunctionTemplate::New(isolate, V8JS_MN(var_dump)), v8::ReadOnly);
|
global_template->Set(V8JS_SYM("var_dump"), v8::FunctionTemplate::New(isolate, V8JS_MN(var_dump)), v8::ReadOnly);
|
||||||
global_template->Set(V8JS_SYM("sleep"), v8::FunctionTemplate::New(isolate, V8JS_MN(sleep)), v8::ReadOnly);
|
global_template->Set(V8JS_SYM("sleep"), v8::FunctionTemplate::New(isolate, V8JS_MN(sleep)), v8::ReadOnly);
|
||||||
global_template->Set(V8JS_SYM("require"), v8::FunctionTemplate::New(isolate, V8JS_MN(require), v8::External::New(isolate, c)), v8::ReadOnly);
|
global_template->Set(V8JS_SYM("require"), v8::FunctionTemplate::New(isolate, V8JS_MN(require), v8::External::New(isolate, c)), v8::ReadOnly);
|
||||||
|
|
||||||
// Add the exports object in which the module can return its API
|
// Add the exports object in which the module can return its API
|
||||||
v8::Local<v8::ObjectTemplate> exports_template = v8::ObjectTemplate::New();
|
v8::Local<v8::ObjectTemplate> exports_template = v8::ObjectTemplate::New(isolate);
|
||||||
global_template->Set(V8JS_SYM("exports"), exports_template);
|
global_template->Set(V8JS_SYM("exports"), exports_template);
|
||||||
|
|
||||||
// Add the module object in which the module can have more fine-grained control over what it can return
|
// Add the module object in which the module can have more fine-grained control over what it can return
|
||||||
v8::Local<v8::ObjectTemplate> module_template = v8::ObjectTemplate::New();
|
v8::Local<v8::ObjectTemplate> module_template = v8::ObjectTemplate::New(isolate);
|
||||||
module_template->Set(V8JS_SYM("id"), V8JS_STR(normalised_module_id));
|
module_template->Set(V8JS_SYM("id"), V8JS_STR(normalised_module_id));
|
||||||
global_template->Set(V8JS_SYM("module"), module_template);
|
global_template->Set(V8JS_SYM("module"), module_template);
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ V8JS_METHOD(require)
|
|||||||
v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, v8::Context::New(isolate, NULL, global_template));
|
v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, v8::Context::New(isolate, NULL, global_template));
|
||||||
|
|
||||||
// Catch JS exceptions
|
// Catch JS exceptions
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch(isolate);
|
||||||
|
|
||||||
v8::Locker locker(isolate);
|
v8::Locker locker(isolate);
|
||||||
v8::Isolate::Scope isolate_scope(isolate);
|
v8::Isolate::Scope isolate_scope(isolate);
|
||||||
|
@ -438,10 +438,17 @@ static void v8js_invoke_callback(const v8::FunctionCallbackInfo<v8::Value>& info
|
|||||||
new_tpl = v8::Local<v8::FunctionTemplate>::New
|
new_tpl = v8::Local<v8::FunctionTemplate>::New
|
||||||
(isolate, ctx->template_cache.at(ce->name));
|
(isolate, ctx->template_cache.at(ce->name));
|
||||||
|
|
||||||
result = new_tpl->GetFunction()->NewInstance(argc, argv);
|
v8::MaybeLocal<v8::Object> maybeResult = new_tpl->GetFunction()->NewInstance(isolate->GetEnteredContext(), argc, argv);
|
||||||
|
|
||||||
|
if (!maybeResult.IsEmpty()) {
|
||||||
|
result = maybeResult.ToLocalChecked();
|
||||||
|
} else {
|
||||||
|
result = V8JS_UNDEFINED;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result = cb->Call(self, argc, argv);
|
result = cb->Call(self, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.GetReturnValue().Set(result);
|
info.GetReturnValue().Set(result);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@ -804,7 +811,7 @@ static void v8js_named_property_deleter(v8::Local<v8::String> property, const v8
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static v8::Local<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value) /* {{{ */
|
static v8::MaybeLocal<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value) /* {{{ */
|
||||||
{
|
{
|
||||||
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
||||||
v8::Local<v8::FunctionTemplate> new_tpl;
|
v8::Local<v8::FunctionTemplate> new_tpl;
|
||||||
@ -903,11 +910,11 @@ static v8::Local<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_e
|
|||||||
|
|
||||||
// Create v8 wrapper object
|
// Create v8 wrapper object
|
||||||
v8::Local<v8::Value> external = v8::External::New(isolate, Z_OBJ_P(value));
|
v8::Local<v8::Value> external = v8::External::New(isolate, Z_OBJ_P(value));
|
||||||
v8::Local<v8::Object> newobj = new_tpl->GetFunction()->NewInstance(1, &external);
|
v8::MaybeLocal<v8::Object> newobj = new_tpl->GetFunction()->NewInstance(isolate->GetEnteredContext(), 1, &external);
|
||||||
|
|
||||||
if (ce == zend_ce_closure) {
|
if (ce == zend_ce_closure && !newobj.IsEmpty()) {
|
||||||
// free uncached function template when object is freed
|
// free uncached function template when object is freed
|
||||||
ctx->weak_closures[persist_tpl_].Reset(isolate, newobj);
|
ctx->weak_closures[persist_tpl_].Reset(isolate, newobj.ToLocalChecked());
|
||||||
ctx->weak_closures[persist_tpl_].SetWeak(persist_tpl_, v8js_weak_closure_callback, v8::WeakCallbackType::kParameter);
|
ctx->weak_closures[persist_tpl_].SetWeak(persist_tpl_, v8js_weak_closure_callback, v8::WeakCallbackType::kParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,15 +1032,19 @@ v8::Local<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate) /* {{
|
|||||||
|
|
||||||
/* If it's a PHP object, wrap it */
|
/* If it's a PHP object, wrap it */
|
||||||
if (ce) {
|
if (ce) {
|
||||||
v8::Local<v8::Value> wrapped_object = v8js_wrap_object(isolate, ce, value);
|
v8::MaybeLocal<v8::Object> wrapped_object = v8js_wrap_object(isolate, ce, value);
|
||||||
|
|
||||||
|
if (wrapped_object.IsEmpty()) {
|
||||||
|
return V8JS_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
if (ce == zend_ce_generator) {
|
if (ce == zend_ce_generator) {
|
||||||
/* Wrap PHP Generator object in a wrapper function that provides
|
/* Wrap PHP Generator object in a wrapper function that provides
|
||||||
* ES6 style behaviour. */
|
* ES6 style behaviour. */
|
||||||
wrapped_object = v8js_wrap_generator(isolate, wrapped_object);
|
return v8js_wrap_generator(isolate, wrapped_object.ToLocalChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
return wrapped_object;
|
return wrapped_object.ToLocalChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Associative PHP arrays cannot be wrapped to JS arrays, convert them to
|
/* Associative PHP arrays cannot be wrapped to JS arrays, convert them to
|
||||||
|
@ -67,7 +67,7 @@ static void v8js_timer_interrupt_handler(v8::Isolate *isolate, void *data) { /*
|
|||||||
if (timer_ctx->memory_limit > 0 && hs.used_heap_size() > timer_ctx->memory_limit) {
|
if (timer_ctx->memory_limit > 0 && hs.used_heap_size() > timer_ctx->memory_limit) {
|
||||||
if (has_sent_notification) {
|
if (has_sent_notification) {
|
||||||
timer_ctx->killed = true;
|
timer_ctx->killed = true;
|
||||||
v8::V8::TerminateExecution(c->isolate);
|
c->isolate->TerminateExecution();
|
||||||
c->memory_limit_hit = true;
|
c->memory_limit_hit = true;
|
||||||
} else {
|
} else {
|
||||||
// force garbage collection, then check again
|
// force garbage collection, then check again
|
||||||
@ -98,7 +98,7 @@ void v8js_timer_thread(zend_v8js_globals *globals) /* {{{ */
|
|||||||
}
|
}
|
||||||
else if(timer_ctx->time_limit > 0 && now > timer_ctx->time_point) {
|
else if(timer_ctx->time_limit > 0 && now > timer_ctx->time_point) {
|
||||||
timer_ctx->killed = true;
|
timer_ctx->killed = true;
|
||||||
v8::V8::TerminateExecution(c->isolate);
|
c->isolate->TerminateExecution();
|
||||||
c->time_limit_hit = true;
|
c->time_limit_hit = true;
|
||||||
}
|
}
|
||||||
else if (timer_ctx->memory_limit > 0) {
|
else if (timer_ctx->memory_limit > 0) {
|
||||||
|
10
v8js_v8.cc
10
v8js_v8.cc
@ -120,7 +120,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value,
|
|||||||
V8JSG(timer_mutex).unlock();
|
V8JSG(timer_mutex).unlock();
|
||||||
|
|
||||||
/* Catch JS exceptions */
|
/* Catch JS exceptions */
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch(isolate);
|
||||||
|
|
||||||
/* Set flags for runtime use */
|
/* Set flags for runtime use */
|
||||||
c->flags = flags;
|
c->flags = flags;
|
||||||
@ -246,7 +246,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value,
|
|||||||
|
|
||||||
void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */
|
void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */
|
||||||
{
|
{
|
||||||
if(v8::V8::IsExecutionTerminating(isolate)) {
|
if(isolate->IsExecutionTerminating()) {
|
||||||
/* Execution already terminating, needn't trigger it again and
|
/* Execution already terminating, needn't trigger it again and
|
||||||
* especially must not execute the spinning loop (which would cause
|
* especially must not execute the spinning loop (which would cause
|
||||||
* crashes in V8 itself, at least with 4.2 and 4.3 version lines). */
|
* crashes in V8 itself, at least with 4.2 and 4.3 version lines). */
|
||||||
@ -264,7 +264,7 @@ void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */
|
|||||||
|
|
||||||
v8::Local<v8::String> source = V8JS_STR("for(;;);");
|
v8::Local<v8::String> source = V8JS_STR("for(;;);");
|
||||||
v8::Local<v8::Script> script = v8::Script::Compile(source);
|
v8::Local<v8::Script> script = v8::Script::Compile(source);
|
||||||
v8::V8::TerminateExecution(isolate);
|
isolate->TerminateExecution();
|
||||||
script->Run();
|
script->Run();
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@ -282,7 +282,9 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
|
|||||||
v8::Local<v8::String> jsKey = jsKeys->Get(i)->ToString();
|
v8::Local<v8::String> jsKey = jsKeys->Get(i)->ToString();
|
||||||
|
|
||||||
/* Skip any prototype properties */
|
/* Skip any prototype properties */
|
||||||
if (!jsObj->HasOwnProperty(jsKey) && !jsObj->HasRealNamedProperty(jsKey) && !jsObj->HasRealNamedCallbackProperty(jsKey)) {
|
if (!jsObj->HasOwnProperty(isolate->GetEnteredContext(), jsKey).FromMaybe(false)
|
||||||
|
&& !jsObj->HasRealNamedProperty(jsKey)
|
||||||
|
&& !jsObj->HasRealNamedCallbackProperty(jsKey)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ static void v8js_v8object_write_property(zval *object, zval *member, zval *value
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (v8obj->IsObject()) {
|
if (v8obj->IsObject()) {
|
||||||
v8obj->ToObject()->ForceSet(V8JS_SYML(Z_STRVAL_P(member), static_cast<int>(Z_STRLEN_P(member))), zval_to_v8js(value, isolate));
|
v8obj->ToObject()->CreateDataProperty(v8_context, V8JS_SYML(Z_STRVAL_P(member), static_cast<int>(Z_STRLEN_P(member))), zval_to_v8js(value, isolate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
Loading…
Reference in New Issue
Block a user