diff options
author | Leko <leko.noor@gmail.com> | 2017-11-27 16:16:32 +0900 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-12-01 20:37:58 +0100 |
commit | 19221d1d6f8a4371a3cef76b0aa9f5d5c7b5a2a9 (patch) | |
tree | a519a9a8a080183378e1a3d13e91f668c8198d4d /src/node_contextify.cc | |
parent | e9e9863ca7ba61ea4e1b5a28c18b29e449f87f00 (diff) | |
download | android-node-v8-19221d1d6f8a4371a3cef76b0aa9f5d5c7b5a2a9.tar.gz android-node-v8-19221d1d6f8a4371a3cef76b0aa9f5d5c7b5a2a9.tar.bz2 android-node-v8-19221d1d6f8a4371a3cef76b0aa9f5d5c7b5a2a9.zip |
src: use non-deprecated versions of `->To*()` utils
Squashed from multiple commits:
- src: replace ->To*(isolate) with ->To*(context).ToLocalChecked()
- test: use .As<Object> on Exception::Error
> Exception::Error always returns an object, so e.As<Object>() should also work fine
See https://github.com/nodejs/node/pull/17343#discussion_r153232027
- test: use .As<Object> instead of ->ToObject
we already checked that its a buffer
- src: use FromMaybe instead of ToLocalChecked
It fixed this test case: 19a1b2e414
- src: pass context to Get()
Dont pass Local<Context> is deprecated soon.
So we migrate to maybe version.
- src: return if Get or ToObject return an empty before call ToLocalChecked
Refs: https://github.com/nodejs/node/issues/17244
PR-URL: https://github.com/nodejs/node/pull/17343
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r-- | src/node_contextify.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 584d2dc6f9..73c5fe08ab 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -621,7 +621,8 @@ class ContextifyScript : public BaseObject { new ContextifyScript(env, args.This()); TryCatch try_catch(env->isolate()); - Local<String> code = args[0]->ToString(env->isolate()); + Local<String> code = + args[0]->ToString(env->context()).FromMaybe(Local<String>()); Local<Value> options = args[1]; MaybeLocal<String> filename = GetFilenameArg(env, options); |