summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
authorjinming_wang <jinming_wang@foxitsoftware.com>2016-03-07 22:58:03 +0800
committerjinming_wang <jinming_wang@foxitsoftware.com>2016-03-07 22:58:03 +0800
commit14e20b124744c3342d3ff0a288788e991087718b (patch)
tree3f3212f9fe9f4c6ec35ccd2c20de77bb80fa4ccd /xfa/src
parent5227e576a79e7c76aa0743930fd76bf340d36d41 (diff)
downloadpdfium-14e20b124744c3342d3ff0a288788e991087718b.tar.xz
Remove deprecated declarations
Remove deprecated declarations BUG=pdfium:356 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1769833002 .
Diffstat (limited to 'xfa/src')
-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
3 files changed, 37 insertions, 16 deletions
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()) {