From 14e20b124744c3342d3ff0a288788e991087718b Mon Sep 17 00:00:00 2001 From: jinming_wang Date: Mon, 7 Mar 2016 22:58:03 +0800 Subject: Remove deprecated declarations Remove deprecated declarations BUG=pdfium:356 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1769833002 . --- xfa.gyp | 6 ------ xfa/src/fxjse/src/class.cpp | 9 +++++++-- xfa/src/fxjse/src/context.cpp | 16 +++++++++++----- xfa/src/fxjse/src/value.cpp | 28 +++++++++++++++++++--------- 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 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 local_str = + info.This() + ->ObjectProtoToString(info.GetIsolate()->GetCurrentContext()) + .FromMaybe(v8::Local()); + 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 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 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()->Get(3)->ToInt32()->Value(); - nCol = hValue.As()->Get(5)->ToInt32()->Value(); + v8::MaybeLocal maybe_int = + hValue.As()->Get(3)->ToInt32(pIsolate->GetCurrentContext()); + nLine = maybe_int.FromMaybe(v8::Local())->Value(); + maybe_int = + hValue.As()->Get(5)->ToInt32(pIsolate->GetCurrentContext()); + nCol = maybe_int.FromMaybe(v8::Local())->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()->HasRealNamedProperty(hKey) || - (bUseTypeGetter && hObject.As()->HasOwnProperty(hKey)); + (bUseTypeGetter && + hObject.As() + ->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 hValue = v8::Local::New(m_pIsolate, lpPropValue->m_hValue); - return hObject.As()->ForceSet( - v8::String::NewFromUtf8(m_pIsolate, szPropName.GetCStr(), - v8::String::kNormalString, - szPropName.GetLength()), - hValue); + return hObject.As() + ->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 maybe_retvalue = + hFunctionObject->CallAsConstructor(m_pIsolate->GetCurrentContext(), + nArgCount, lpLocalArgs); + hReturnValue = maybe_retvalue.FromMaybe(v8::Local()); } else { v8::Local 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 maybe_retvalue = hFunctionObject->CallAsFunction( + m_pIsolate->GetCurrentContext(), hReceiver, nArgCount, lpLocalArgs); + hReturnValue = maybe_retvalue.FromMaybe(v8::Local()); } if (trycatch.HasCaught()) { -- cgit v1.2.3