From 3955409f56507aa515fddd8e3235e1bbe6d70c8e Mon Sep 17 00:00:00 2001 From: Timothy Pace Date: Thu, 13 Feb 2020 16:42:40 -0800 Subject: [PATCH] Remove deprecated Context versions of ToBoolean and BooleanValue --- v8js_convert.cc | 8 ++------ v8js_methods.cc | 11 ++--------- v8js_object_export.cc | 4 ++-- v8js_v8.cc | 2 +- v8js_v8object_class.cc | 2 +- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/v8js_convert.cc b/v8js_convert.cc index 332a9ed..9163b41 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -212,12 +212,8 @@ int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8 } else if (jsValue->IsBoolean()) { - v8::Maybe value = jsValue->BooleanValue(v8_context); - if (value.IsNothing()) - { - return FAILURE; - } - RETVAL_BOOL(value.ToChecked()); + bool value = jsValue->BooleanValue(isolate); + RETVAL_BOOL(value); } else if (jsValue->IsInt32() || jsValue->IsUint32()) { diff --git a/v8js_methods.cc b/v8js_methods.cc index 470f0bf..b8a2e22 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -122,15 +122,8 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int leve } if (var->IsBoolean()) { - v8::Maybe value = var->BooleanValue(v8_context); - if (value.IsNothing()) - { - php_printf("\n"); - } - else - { - php_printf("bool(%s)\n", value.FromJust() ? "true" : "false"); - } + bool value = var->BooleanValue(isolate); + php_printf("bool(%s)\n", value ? "true" : "false"); return; } diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 9aac1fc..17b52aa 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -863,9 +863,9 @@ static void v8js_named_property_deleter(v8::Local property, const v8:: } v8::Isolate *isolate = info.GetIsolate(); - v8::MaybeLocal value = r->ToBoolean(isolate->GetEnteredContext()); + v8::Local value = r->ToBoolean(isolate); if (!value.IsEmpty()) { - info.GetReturnValue().Set(value.ToLocalChecked()); + info.GetReturnValue().Set(value); } } /* }}} */ diff --git a/v8js_v8.cc b/v8js_v8.cc index a841342..fa9e521 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -133,7 +133,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, c->tz = strdup(tz); } else if (strcmp(c->tz, tz) != 0) { - v8::Date::DateTimeConfigurationChangeNotification(c->isolate); + c->isolate->DateTimeConfigurationChangeNotification(); free(c->tz); c->tz = strdup(tz); diff --git a/v8js_v8object_class.cc b/v8js_v8object_class.cc index 9440e19..b55f0f4 100644 --- a/v8js_v8object_class.cc +++ b/v8js_v8object_class.cc @@ -98,7 +98,7 @@ static int v8js_v8object_has_property(zval *object, zval *member, int has_set_ex } /* empty() */ - retval = jsVal->BooleanValue(v8_context).FromMaybe(false); + retval = jsVal->BooleanValue(isolate); /* for PHP compatibility, [] should also be empty */ if (jsVal->IsArray() && retval) {