diff options
author | Ujjwal Sharma <usharma1998@gmail.com> | 2018-08-29 15:39:09 +0200 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2018-09-06 08:53:57 +0200 |
commit | ee237e3e55cbe0a9eccf993c54e1fa60a79278a3 (patch) | |
tree | c5b0fe4fa79b4d00bb433887d18122458e67ace1 /src/util.cc | |
parent | b9c0d5e349801e681a7b1f03cc1a46244069259d (diff) | |
download | node-new-ee237e3e55cbe0a9eccf993c54e1fa60a79278a3.tar.gz |
src: remove calls to deprecated v8 functions (ToString)
Remove all calls to deprecated v8 functions (here: Value::ToString)
inside the code (src directory only).
PR-URL: https://github.com/nodejs/node/pull/21935
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/util.cc b/src/util.cc index c36ea5169d..44c47f0f91 100644 --- a/src/util.cc +++ b/src/util.cc @@ -37,9 +37,8 @@ template <typename T> static void MakeUtf8String(Isolate* isolate, Local<Value> value, T* target) { - Local<String> string = value->ToString(isolate); - if (string.IsEmpty()) - return; + Local<String> string; + if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; const size_t storage = StringBytes::StorageSize(isolate, string, UTF8) + 1; target->AllocateSufficientStorage(storage); @@ -63,9 +62,8 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) { return; } - Local<String> string = value->ToString(isolate); - if (string.IsEmpty()) - return; + Local<String> string; + if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; // Allocate enough space to include the null terminator const size_t storage = string->Length() + 1; |