Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Unified Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1761073006: Re-land "Only place primitive objects on the V8 global template."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Better solution - destroy handles before runtime. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/jsapi/fxjs_v8.cpp
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index f015f87136e001e94b5bfcd35c7f07557ac8fff1..5631ab625859e95f5fd73ff7e0e2db14a26019eb 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(
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698