Simplify CFXJSE_Engine::RemoveBuiltInObjs()
No harm in trying to remove a property that doesn't exist, so there
is no need to spend cycles checking for it first.
Change-Id: Ifeaa77882b7eca967495c95d1c256efaee7151fc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76015
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 73f5dfd..70dab0b 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -616,14 +616,9 @@
void CFXJSE_Engine::RemoveBuiltInObjs(CFXJSE_Context* pContext) {
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
- const ByteStringView kObjNames[2] = {"Number", "Date"};
v8::Local<v8::Object> pObject = pContext->GetGlobalObject();
- for (const auto& name : kObjNames) {
- if (!fxv8::ReentrantGetObjectPropertyHelper(GetIsolate(), pObject, name)
- .IsEmpty()) {
- fxv8::ReentrantDeleteObjectPropertyHelper(GetIsolate(), pObject, name);
- }
- }
+ fxv8::ReentrantDeleteObjectPropertyHelper(GetIsolate(), pObject, "Number");
+ fxv8::ReentrantDeleteObjectPropertyHelper(GetIsolate(), pObject, "Date");
}
bool CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,