summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/jsapi
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/jsapi')
-rw-r--r--fpdfsdk/src/jsapi/fxjs_v8.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index f015f87136..5631ab6258 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -287,14 +287,15 @@ void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate,
void FXJS_DefineGlobalConst(v8::Isolate* pIsolate,
const wchar_t* sConstName,
- v8::Local<v8::Value> pDefault) {
+ v8::FunctionCallback pConstGetter) {
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
CFX_ByteString bsConst = CFX_WideString(sConstName).UTF8Encode();
- GetGlobalObjectTemplate(pIsolate)->Set(
- v8::String::NewFromUtf8(pIsolate, bsConst.c_str(),
- v8::NewStringType::kNormal).ToLocalChecked(),
- pDefault, v8::ReadOnly);
+ GetGlobalObjectTemplate(pIsolate)
+ ->SetAccessorProperty(v8::String::NewFromUtf8(pIsolate, bsConst.c_str(),
+ v8::NewStringType::kNormal)
+ .ToLocalChecked(),
+ v8::FunctionTemplate::New(pIsolate, pConstGetter));
}
void FXJS_InitializeRuntime(