diff options
Diffstat (limited to 'fxjs/cjs_global.cpp')
-rw-r--r-- | fxjs/cjs_global.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp index e747d6205c..ea8694fe14 100644 --- a/fxjs/cjs_global.cpp +++ b/fxjs/cjs_global.cpp @@ -40,7 +40,7 @@ void JSSpecialPropQuery(const char*, if (!pRuntime) return; - CJS_Return result = + CJS_Result result = pObj->QueryProperty(PropFromV8Prop(info.GetIsolate(), property).c_str()); info.GetReturnValue().Set(!result.HasError() ? 4 : 0); @@ -58,7 +58,7 @@ void JSSpecialPropGet(const char* class_name, if (!pRuntime) return; - CJS_Return result = pObj->GetProperty( + CJS_Result result = pObj->GetProperty( pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str()); if (result.HasError()) { @@ -83,7 +83,7 @@ void JSSpecialPropPut(const char* class_name, if (!pRuntime) return; - CJS_Return result = pObj->SetProperty( + CJS_Result result = pObj->SetProperty( pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str(), value); if (result.HasError()) { @@ -104,7 +104,7 @@ void JSSpecialPropDel(const char* class_name, if (!pRuntime) return; - CJS_Return result = pObj->DelProperty( + CJS_Result result = pObj->DelProperty( pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str()); if (result.HasError()) { // TODO(dsinclair): Should this set the pRuntime->Error result? @@ -224,52 +224,52 @@ void CJS_Global::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) { UpdateGlobalPersistentVariables(); } -CJS_Return CJS_Global::QueryProperty(const wchar_t* propname) { +CJS_Result CJS_Global::QueryProperty(const wchar_t* propname) { if (WideString(propname) != L"setPersistent") - return CJS_Return::Failure(JSMessage::kUnknownProperty); - return CJS_Return::Success(); + return CJS_Result::Failure(JSMessage::kUnknownProperty); + return CJS_Result::Success(); } -CJS_Return CJS_Global::DelProperty(CJS_Runtime* pRuntime, +CJS_Result CJS_Global::DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname) { auto it = m_MapGlobal.find(WideString(propname).ToDefANSI()); if (it == m_MapGlobal.end()) - return CJS_Return::Failure(JSMessage::kUnknownProperty); + return CJS_Result::Failure(JSMessage::kUnknownProperty); it->second->bDeleted = true; - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJS_Global::GetProperty(CJS_Runtime* pRuntime, +CJS_Result CJS_Global::GetProperty(CJS_Runtime* pRuntime, const wchar_t* propname) { auto it = m_MapGlobal.find(WideString(propname).ToDefANSI()); if (it == m_MapGlobal.end()) - return CJS_Return::Success(); + return CJS_Result::Success(); JSGlobalData* pData = it->second.get(); if (pData->bDeleted) - return CJS_Return::Success(); + return CJS_Result::Success(); switch (pData->nType) { case JS_GlobalDataType::NUMBER: - return CJS_Return::Success(pRuntime->NewNumber(pData->dData)); + return CJS_Result::Success(pRuntime->NewNumber(pData->dData)); case JS_GlobalDataType::BOOLEAN: - return CJS_Return::Success(pRuntime->NewBoolean(pData->bData)); + return CJS_Result::Success(pRuntime->NewBoolean(pData->bData)); case JS_GlobalDataType::STRING: - return CJS_Return::Success(pRuntime->NewString( + return CJS_Result::Success(pRuntime->NewString( WideString::FromLocal(pData->sData.AsStringView()).AsStringView())); case JS_GlobalDataType::OBJECT: - return CJS_Return::Success( + return CJS_Result::Success( v8::Local<v8::Object>::New(pRuntime->GetIsolate(), pData->pData)); case JS_GlobalDataType::NULLOBJ: - return CJS_Return::Success(pRuntime->NewNull()); + return CJS_Result::Success(pRuntime->NewNull()); default: break; } - return CJS_Return::Failure(JSMessage::kObjectTypeError); + return CJS_Result::Failure(JSMessage::kObjectTypeError); } -CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime, +CJS_Result CJS_Global::SetProperty(CJS_Runtime* pRuntime, const wchar_t* propname, v8::Local<v8::Value> vp) { ByteString sPropName = WideString(propname).ToDefANSI(); @@ -298,23 +298,23 @@ CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime, } if (vp->IsUndefined()) { DelProperty(pRuntime, propname); - return CJS_Return::Success(); + return CJS_Result::Success(); } - return CJS_Return::Failure(JSMessage::kObjectTypeError); + return CJS_Result::Failure(JSMessage::kObjectTypeError); } -CJS_Return CJS_Global::setPersistent( +CJS_Result CJS_Global::setPersistent( CJS_Runtime* pRuntime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); auto it = m_MapGlobal.find(pRuntime->ToWideString(params[0]).ToDefANSI()); if (it == m_MapGlobal.end() || it->second->bDeleted) - return CJS_Return::Failure(JSMessage::kGlobalNotFoundError); + return CJS_Result::Failure(JSMessage::kGlobalNotFoundError); it->second->bPersistent = pRuntime->ToBoolean(params[1]); - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJS_Global::UpdateGlobalPersistentVariables() { @@ -497,7 +497,7 @@ void CJS_Global::DestroyGlobalPersisitentVariables() { m_MapGlobal.clear(); } -CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname, +CJS_Result CJS_Global::SetGlobalVariables(const ByteString& propname, JS_GlobalDataType nType, double dData, bool bData, @@ -505,7 +505,7 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname, v8::Local<v8::Object> pData, bool bDefaultPersistent) { if (propname.IsEmpty()) - return CJS_Return::Failure(JSMessage::kUnknownProperty); + return CJS_Result::Failure(JSMessage::kUnknownProperty); auto it = m_MapGlobal.find(propname); if (it != m_MapGlobal.end()) { @@ -533,9 +533,9 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname, case JS_GlobalDataType::NULLOBJ: break; default: - return CJS_Return::Failure(JSMessage::kObjectTypeError); + return CJS_Result::Failure(JSMessage::kObjectTypeError); } - return CJS_Return::Success(); + return CJS_Result::Success(); } auto pNewData = pdfium::MakeUnique<JSGlobalData>(); @@ -565,8 +565,8 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname, pNewData->bPersistent = bDefaultPersistent; break; default: - return CJS_Return::Failure(JSMessage::kObjectTypeError); + return CJS_Result::Failure(JSMessage::kObjectTypeError); } m_MapGlobal[propname] = std::move(pNewData); - return CJS_Return::Success(); + return CJS_Result::Success(); } |