summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-13 06:38:29 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-13 06:38:29 +0000
commit56e0c3ebe017135dcbd046bd6bc8c9ca54518597 (patch)
tree246356a5312522e1ef19b8c218554e59d5b2096e
parent355f9eaaf10a48e262d8ef29b581a88be91d9cdd (diff)
downloadpdfium-56e0c3ebe017135dcbd046bd6bc8c9ca54518597.tar.xz
Fix v8 ToLocalChecked() failure in CJS_Runtime.
BUG=chromium:894938 Change-Id: I3d1ca33eec4cd2b01bfa4dfce7da3642dd5ad31b Reviewed-on: https://pdfium-review.googlesource.com/c/43983 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--fxjs/cjs_runtime.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index 7d3808a61d..539594cd90 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -201,8 +201,13 @@ bool CJS_Runtime::GetValueByNameFromGlobalObject(const ByteStringView& utf8Name,
v8::String::NewFromUtf8(GetIsolate(), utf8Name.unterminated_c_str(),
v8::NewStringType::kNormal, utf8Name.GetLength())
.ToLocalChecked();
- v8::Local<v8::Value> propvalue =
- context->Global()->Get(context, str).ToLocalChecked();
+ v8::MaybeLocal<v8::Value> maybe_propvalue =
+ context->Global()->Get(context, str);
+ if (maybe_propvalue.IsEmpty()) {
+ pValue->SetUndefined();
+ return false;
+ }
+ v8::Local<v8::Value> propvalue = maybe_propvalue.ToLocalChecked();
if (propvalue.IsEmpty()) {
pValue->SetUndefined();
return false;