summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/cfxjse_arguments.cpp4
-rw-r--r--fxjs/cfxjse_arguments.h4
-rw-r--r--fxjs/cjs_runtime.cpp19
-rw-r--r--fxjs/cjs_runtime.h4
4 files changed, 17 insertions, 14 deletions
diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp
index 0b0dc39953..174fd3c2c7 100644
--- a/fxjs/cfxjse_arguments.cpp
+++ b/fxjs/cfxjse_arguments.cpp
@@ -49,7 +49,9 @@ float CFXJSE_Arguments::GetFloat(int32_t index) const {
ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
v8::Isolate* isolate = m_pInfo->GetIsolate();
- v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString(isolate);
+ v8::Local<v8::Value> info = (*m_pInfo)[index];
+ v8::Local<v8::String> hString =
+ info->ToString(isolate->GetCurrentContext()).ToLocalChecked();
v8::String::Utf8Value szStringVal(isolate, hString);
return ByteString(*szStringVal);
}
diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h
index e24fc8feb8..d523d6f906 100644
--- a/fxjs/cfxjse_arguments.h
+++ b/fxjs/cfxjse_arguments.h
@@ -28,8 +28,8 @@ class CFXJSE_Arguments {
CFXJSE_Value* GetReturnValue() const;
private:
- UnownedPtr<const v8::FunctionCallbackInfo<v8::Value>> m_pInfo;
- UnownedPtr<CFXJSE_Value> m_pRetValue;
+ UnownedPtr<const v8::FunctionCallbackInfo<v8::Value>> const m_pInfo;
+ UnownedPtr<CFXJSE_Value> const m_pRetValue;
};
#endif // FXJS_CFXJSE_ARGUMENTS_H_
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
diff --git a/fxjs/cjs_runtime.h b/fxjs/cjs_runtime.h
index f7b2679523..8835106697 100644
--- a/fxjs/cjs_runtime.h
+++ b/fxjs/cjs_runtime.h
@@ -65,8 +65,8 @@ class CJS_Runtime final : public IJS_Runtime,
std::vector<std::unique_ptr<CJS_EventContext>> m_EventContextArray;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
- bool m_bBlocking;
- bool m_isolateManaged;
+ bool m_bBlocking = false;
+ bool m_isolateManaged = false;
std::set<FieldEvent> m_FieldEventSet;
};