From a1bda1b4deb08dfb3e06cb778f0db40023b18318 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Mon, 5 Oct 2015 20:44:09 -0500 Subject: util: fix for inspecting promises The upgrade to v8 4.6 removes ObjectIsPromise. This change utilizes v8::Value::IsPromise to verify that the argument is indeed a promise. PR-URL: https://github.com/nodejs/node/pull/3221 Reviewed-By: Ben Noordhuis --- src/node_util.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/node_util.cc') diff --git a/src/node_util.cc b/src/node_util.cc index cc86478e09..19c3e3240a 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -23,6 +23,10 @@ static void IsSetIterator(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(args[0]->IsSetIterator()); } +static void IsPromise(const FunctionCallbackInfo& args) { + CHECK_EQ(1, args.Length()); + args.GetReturnValue().Set(args[0]->IsPromise()); +} void Initialize(Local target, Local unused, @@ -30,6 +34,7 @@ void Initialize(Local target, Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "isMapIterator", IsMapIterator); env->SetMethod(target, "isSetIterator", IsSetIterator); + env->SetMethod(target, "isPromise", IsPromise); } } // namespace util -- cgit v1.2.3