summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa.gyp6
-rw-r--r--xfa/src/fxjse/src/class.cpp9
-rw-r--r--xfa/src/fxjse/src/context.cpp16
-rw-r--r--xfa/src/fxjse/src/value.cpp28
4 files changed, 37 insertions, 22 deletions
diff --git a/xfa.gyp b/xfa.gyp
index e51d4d9946..cf9a18e7c8 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -654,10 +654,6 @@
],
"conditions": [
["clang==1" , {
- # TODO(tsepez): remove this when FX fixes warnings
- "cflags": [
- "-Wno-deprecated-declarations"
- ],
}],
["pdf_enable_v8==1", {
'dependencies': [
@@ -708,8 +704,6 @@
["OS == 'mac'", {
"configurations": {},
"sources": [],
- "cflags": [ "-Wno-deprecated-declarations" ],
- "defines!": [ "V8_DEPRECATION_WARNINGS" ],
}],
]
}
diff --git a/xfa/src/fxjse/src/class.cpp b/xfa/src/fxjse/src/class.cpp
index 6ca3be8b72..206ad05734 100644
--- a/xfa/src/fxjse/src/class.cpp
+++ b/xfa/src/fxjse/src/class.cpp
@@ -33,7 +33,8 @@ void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext,
v8::Local<v8::Object> hGlobalObject =
FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext());
for (int32_t i = 0; i < nNum; i++) {
- hGlobalObject->ForceSet(
+ hGlobalObject->DefineOwnProperty(
+ scope.GetLocalContext(),
v8::String::NewFromUtf8(pIsolate, lpFunctions[i].name),
v8::Function::New(
pIsolate, FXJSE_V8FunctionCallback_Wrapper,
@@ -240,7 +241,11 @@ static void FXJSE_Context_GlobalObjToString(
info.GetIsolate(), (const FX_CHAR*)szStringVal,
v8::String::kNormalString, szStringVal.GetLength()));
} else {
- info.GetReturnValue().Set(info.This()->ObjectProtoToString());
+ v8::Local<v8::String> local_str =
+ info.This()
+ ->ObjectProtoToString(info.GetIsolate()->GetCurrentContext())
+ .FromMaybe(v8::Local<v8::String>());
+ info.GetReturnValue().Set(local_str);
}
}
diff --git a/xfa/src/fxjse/src/context.cpp b/xfa/src/fxjse/src/context.cpp
index 9d5b699c8b..f88fcde2cd 100644
--- a/xfa/src/fxjse/src/context.cpp
+++ b/xfa/src/fxjse/src/context.cpp
@@ -118,9 +118,11 @@ v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate,
hReturnValue->Set(2, hException);
hReturnValue->Set(3, v8::Integer::New(pIsolate, hMessage->GetLineNumber()));
hReturnValue->Set(4, hMessage->GetSourceLine());
- hReturnValue->Set(5,
- v8::Integer::New(pIsolate, hMessage->GetStartColumn()));
- hReturnValue->Set(6, v8::Integer::New(pIsolate, hMessage->GetEndColumn()));
+ v8::Maybe<int32_t> maybe_int =
+ hMessage->GetStartColumn(pIsolate->GetCurrentContext());
+ hReturnValue->Set(5, v8::Integer::New(pIsolate, maybe_int.FromMaybe(0)));
+ maybe_int = hMessage->GetEndColumn(pIsolate->GetCurrentContext());
+ hReturnValue->Set(6, v8::Integer::New(pIsolate, maybe_int.FromMaybe(0)));
}
return hReturnValue;
}
@@ -162,8 +164,12 @@ FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue,
if (!hValue->IsObject()) {
return FALSE;
}
- nLine = hValue.As<v8::Object>()->Get(3)->ToInt32()->Value();
- nCol = hValue.As<v8::Object>()->Get(5)->ToInt32()->Value();
+ v8::MaybeLocal<v8::Int32> maybe_int =
+ hValue.As<v8::Object>()->Get(3)->ToInt32(pIsolate->GetCurrentContext());
+ nLine = maybe_int.FromMaybe(v8::Local<v8::Int32>())->Value();
+ maybe_int =
+ hValue.As<v8::Object>()->Get(5)->ToInt32(pIsolate->GetCurrentContext());
+ nCol = maybe_int.FromMaybe(v8::Local<v8::Int32>())->Value();
return TRUE;
}
diff --git a/xfa/src/fxjse/src/value.cpp b/xfa/src/fxjse/src/value.cpp
index d4e2c0dbc2..771f757d18 100644
--- a/xfa/src/fxjse/src/value.cpp
+++ b/xfa/src/fxjse/src/value.cpp
@@ -451,7 +451,10 @@ FX_BOOL CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
m_pIsolate, szPropName.GetCStr(), v8::String::kNormalString,
szPropName.GetLength());
return hObject.As<v8::Object>()->HasRealNamedProperty(hKey) ||
- (bUseTypeGetter && hObject.As<v8::Object>()->HasOwnProperty(hKey));
+ (bUseTypeGetter &&
+ hObject.As<v8::Object>()
+ ->HasOwnProperty(m_pIsolate->GetCurrentContext(), hKey)
+ .FromMaybe(false));
}
FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
@@ -464,11 +467,14 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(m_pIsolate, lpPropValue->m_hValue);
- return hObject.As<v8::Object>()->ForceSet(
- v8::String::NewFromUtf8(m_pIsolate, szPropName.GetCStr(),
- v8::String::kNormalString,
- szPropName.GetLength()),
- hValue);
+ return hObject.As<v8::Object>()
+ ->DefineOwnProperty(
+ m_pIsolate->GetCurrentContext(),
+ v8::String::NewFromUtf8(m_pIsolate, szPropName.GetCStr(),
+ v8::String::kNormalString,
+ szPropName.GetLength()),
+ hValue)
+ .FromMaybe(false);
}
FX_BOOL CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction,
@@ -541,7 +547,10 @@ FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
FX_BOOL bRetValue = TRUE;
if (lpReceiver == FXJSE_INVALID_PTR) {
- hReturnValue = hFunctionObject->CallAsConstructor(nArgCount, lpLocalArgs);
+ v8::MaybeLocal<v8::Value> maybe_retvalue =
+ hFunctionObject->CallAsConstructor(m_pIsolate->GetCurrentContext(),
+ nArgCount, lpLocalArgs);
+ hReturnValue = maybe_retvalue.FromMaybe(v8::Local<v8::Value>());
} else {
v8::Local<v8::Value> hReceiver;
if (lpReceiver) {
@@ -551,8 +560,9 @@ FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
if (hReceiver.IsEmpty() || !hReceiver->IsObject())
hReceiver = v8::Object::New(m_pIsolate);
- hReturnValue =
- hFunctionObject->CallAsFunction(hReceiver, nArgCount, lpLocalArgs);
+ v8::MaybeLocal<v8::Value> maybe_retvalue = hFunctionObject->CallAsFunction(
+ m_pIsolate->GetCurrentContext(), hReceiver, nArgCount, lpLocalArgs);
+ hReturnValue = maybe_retvalue.FromMaybe(v8::Local<v8::Value>());
}
if (trycatch.HasCaught()) {