summaryrefslogtreecommitdiff
path: root/fxjs/cjs_globalarrays.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-29 19:24:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-29 19:24:39 +0000
commitb2b1f55214688d5e3bfd5015e0a4829d2f314c27 (patch)
tree362af0708d92137f78aade46912fc63395d2cf2b /fxjs/cjs_globalarrays.cpp
parent803cf76a5801536afe3ac2baad0f9a66ec27eeb6 (diff)
downloadpdfium-b2b1f55214688d5e3bfd5015e0a4829d2f314c27.tar.xz
Stop using deprecated V8 APIs in CJS_GlobalArrays.
Change-Id: I7ed3037d8d8862787ad7364eb5f55cd22eb879ad Reviewed-on: https://pdfium-review.googlesource.com/41357 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_globalarrays.cpp')
-rw-r--r--fxjs/cjs_globalarrays.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/fxjs/cjs_globalarrays.cpp b/fxjs/cjs_globalarrays.cpp
index a697c18ac6..9cf540e418 100644
--- a/fxjs/cjs_globalarrays.cpp
+++ b/fxjs/cjs_globalarrays.cpp
@@ -8,10 +8,11 @@
#define GLOBAL_ARRAY(rt, name, ...) \
{ \
- const wchar_t* values[] = {__VA_ARGS__}; \
+ static const wchar_t* const values[] = {__VA_ARGS__}; \
v8::Local<v8::Array> array = (rt)->NewArray(); \
+ v8::Local<v8::Context> ctx = (rt)->GetIsolate()->GetCurrentContext(); \
for (size_t i = 0; i < FX_ArraySize(values); ++i) \
- array->Set(i, (rt)->NewString(values[i])); \
+ array->Set(ctx, i, (rt)->NewString(values[i])).FromJust(); \
(rt)->SetConstArray((name), array); \
(rt)->DefineGlobalConst( \
(name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \