diff options
author | Lei Zhang <thestig@chromium.org> | 2018-08-29 23:18:08 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-29 23:18:08 +0000 |
commit | d5f427901b52e1311ab51f16e87459ec34691591 (patch) | |
tree | 7dd25968b86a92bcba4db82361df989f118df4a4 /fxjs/cjs_runtime.cpp | |
parent | 9e90e7987de10832b505cc0b46abf502b6f5eb7a (diff) | |
download | pdfium-d5f427901b52e1311ab51f16e87459ec34691591.tar.xz |
Stop using deprecated V8 APIs in CJS_Runtime.
Also for CFXJSE_Arguments.
Change-Id: I15bfa4e09675bb48aecfa0c55539bf8dc50675e6
Reviewed-on: https://pdfium-review.googlesource.com/41370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cjs_runtime.cpp')
-rw-r--r-- | fxjs/cjs_runtime.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp index 6042538e30..e7de7abd8f 100644 --- a/fxjs/cjs_runtime.cpp +++ b/fxjs/cjs_runtime.cpp @@ -47,9 +47,7 @@ #endif // PDF_ENABLE_XFA CJS_Runtime::CJS_Runtime(CPDFSDK_FormFillEnvironment* pFormFillEnv) - : m_pFormFillEnv(pFormFillEnv), - m_bBlocking(false), - m_isolateManaged(false) { + : m_pFormFillEnv(pFormFillEnv) { v8::Isolate* pIsolate = nullptr; IPDF_JSPLATFORM* pPlatform = m_pFormFillEnv->GetFormFillInfo()->m_pJsPlatform; @@ -199,9 +197,12 @@ bool CJS_Runtime::GetValueByNameFromGlobalObject(const ByteStringView& utf8Name, v8::HandleScope handle_scope(GetIsolate()); v8::Local<v8::Context> context = GetV8Context(); v8::Context::Scope context_scope(context); - v8::Local<v8::Value> propvalue = context->Global()->Get( + v8::Local<v8::String> str = v8::String::NewFromUtf8(GetIsolate(), utf8Name.unterminated_c_str(), - v8::String::kNormalString, utf8Name.GetLength())); + v8::NewStringType::kNormal, utf8Name.GetLength()) + .ToLocalChecked(); + v8::Local<v8::Value> propvalue = + context->Global()->Get(context, str).ToLocalChecked(); if (propvalue.IsEmpty()) { pValue->SetUndefined(); return false; @@ -222,11 +223,11 @@ bool CJS_Runtime::SetValueByNameInGlobalObject(const ByteStringView& utf8Name, v8::Context::Scope context_scope(context); v8::Local<v8::Value> propvalue = v8::Local<v8::Value>::New(pIsolate, pValue->DirectGetValue()); - context->Global()->Set( + v8::Local<v8::String> str = v8::String::NewFromUtf8(pIsolate, utf8Name.unterminated_c_str(), - v8::String::kNormalString, utf8Name.GetLength()), - propvalue); - return true; + v8::NewStringType::kNormal, utf8Name.GetLength()) + .ToLocalChecked(); + return context->Global()->Set(context, str, propvalue).FromJust(); } #endif |