summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_class.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-12-04 15:14:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-04 15:14:05 +0000
commit85caeb903c239d0c80aec86241885eabc1de71fb (patch)
tree43f1175aab8c758a722641005725ba41deba05c0 /fxjs/cfxjse_class.cpp
parent703b6f08a23a1e1d87c41266f92827ae28bf994d (diff)
downloadpdfium-85caeb903c239d0c80aec86241885eabc1de71fb.tar.xz
Remove unused XFA code
Change-Id: Iea75ce6b3a7e06b7977491a89e7a31755f038312 Reviewed-on: https://pdfium-review.googlesource.com/20191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_class.cpp')
-rw-r--r--fxjs/cfxjse_class.cpp131
1 files changed, 3 insertions, 128 deletions
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp
index b2e747b4fd..09976d1aa5 100644
--- a/fxjs/cfxjse_class.cpp
+++ b/fxjs/cfxjse_class.cpp
@@ -34,57 +34,6 @@ void V8FunctionCallback_Wrapper(
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
}
-void V8ClassGlobalConstructorCallback_Wrapper(
- const v8::FunctionCallbackInfo<v8::Value>& info) {
- const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition =
- static_cast<FXJSE_CLASS_DESCRIPTOR*>(
- info.Data().As<v8::External>()->Value());
- if (!lpClassDefinition)
- return;
-
- ByteStringView szFunctionName(lpClassDefinition->name);
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- lpThisValue->ForceSetValue(info.Holder());
- auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- CFXJSE_Arguments impl(&info, lpRetValue.get());
- lpClassDefinition->constructor(lpThisValue.get(), szFunctionName, impl);
- if (!lpRetValue->DirectGetValue().IsEmpty())
- info.GetReturnValue().Set(lpRetValue->DirectGetValue());
-}
-
-void V8GetterCallback_Wrapper(v8::Local<v8::String> property,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
- const FXJSE_PROPERTY_DESCRIPTOR* lpPropertyInfo =
- static_cast<FXJSE_PROPERTY_DESCRIPTOR*>(
- info.Data().As<v8::External>()->Value());
- if (!lpPropertyInfo)
- return;
-
- ByteStringView szPropertyName(lpPropertyInfo->name);
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- lpThisValue->ForceSetValue(info.Holder());
- lpPropertyInfo->getProc(lpThisValue.get(), szPropertyName, lpPropValue.get());
- info.GetReturnValue().Set(lpPropValue->DirectGetValue());
-}
-
-void V8SetterCallback_Wrapper(v8::Local<v8::String> property,
- v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<void>& info) {
- const FXJSE_PROPERTY_DESCRIPTOR* lpPropertyInfo =
- static_cast<FXJSE_PROPERTY_DESCRIPTOR*>(
- info.Data().As<v8::External>()->Value());
- if (!lpPropertyInfo)
- return;
-
- ByteStringView szPropertyName(lpPropertyInfo->name);
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- lpThisValue->ForceSetValue(info.Holder());
- lpPropValue->ForceSetValue(value);
- lpPropertyInfo->setProc(lpThisValue.get(), szPropertyName, lpPropValue.get());
-}
-
void V8ConstructorCallback_Wrapper(
const v8::FunctionCallbackInfo<v8::Value>& info) {
if (!info.IsConstructCall())
@@ -202,22 +151,6 @@ bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
return nPropType != FXJSE_ClassPropType_None;
}
-bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
- CFXJSE_Value* pObject,
- const ByteStringView& szPropName) {
- ASSERT(lpClass);
- int32_t nPropType =
- lpClass->dynPropTypeGetter == nullptr
- ? FXJSE_ClassPropType_Property
- : lpClass->dynPropTypeGetter(pObject, szPropName, false);
- if (nPropType != FXJSE_ClassPropType_Method) {
- if (lpClass->dynPropDeleter)
- return lpClass->dynPropDeleter(pObject, szPropName);
- return nPropType != FXJSE_ClassPropType_Property;
- }
- return false;
-}
-
void NamedPropertyQueryCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Integer>& info) {
@@ -238,22 +171,6 @@ void NamedPropertyQueryCallback(
info.GetReturnValue().Set(iV8Absent);
}
-void NamedPropertyDeleterCallback(
- v8::Local<v8::Name> property,
- const v8::PropertyCallbackInfo<v8::Boolean>& info) {
- v8::Local<v8::Object> thisObject = info.Holder();
- const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
- info.Data().As<v8::External>()->Value());
- v8::Isolate* pIsolate = info.GetIsolate();
- v8::HandleScope scope(pIsolate);
- v8::String::Utf8Value szPropName(property);
- ByteStringView szFxPropName(*szPropName, szPropName.length());
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- lpThisValue->ForceSetValue(thisObject);
- info.GetReturnValue().Set(
- !!DynPropDeleterAdapter(lpClass, lpThisValue.get(), szFxPropName));
-}
-
void NamedPropertyGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -291,15 +208,7 @@ void NamedPropertySetterCallback(
void NamedPropertyEnumeratorCallback(
const v8::PropertyCallbackInfo<v8::Array>& info) {
- const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
- info.Data().As<v8::External>()->Value());
- v8::Isolate* pIsolate = info.GetIsolate();
- v8::Local<v8::Array> newArray = v8::Array::New(pIsolate, lpClass->propNum);
- for (int i = 0; i < lpClass->propNum; i++) {
- newArray->Set(
- i, v8::String::NewFromUtf8(pIsolate, lpClass->properties[i].name));
- }
- info.GetReturnValue().Set(newArray);
+ info.GetReturnValue().Set(v8::Array::New(info.GetIsolate()));
}
} // namespace
@@ -333,20 +242,6 @@ CFXJSE_Class* CFXJSE_Class::Create(
hFunctionTemplate->InstanceTemplate();
SetUpNamedPropHandler(pIsolate, hObjectTemplate, lpClassDefinition);
- if (lpClassDefinition->propNum) {
- for (int32_t i = 0; i < lpClassDefinition->propNum; i++) {
- hObjectTemplate->SetNativeDataProperty(
- v8::String::NewFromUtf8(pIsolate,
- lpClassDefinition->properties[i].name),
- lpClassDefinition->properties[i].getProc ? V8GetterCallback_Wrapper
- : nullptr,
- lpClassDefinition->properties[i].setProc ? V8SetterCallback_Wrapper
- : nullptr,
- v8::External::New(pIsolate, const_cast<FXJSE_PROPERTY_DESCRIPTOR*>(
- lpClassDefinition->properties + i)),
- static_cast<v8::PropertyAttribute>(v8::DontDelete));
- }
- }
if (lpClassDefinition->methNum) {
for (int32_t i = 0; i < lpClassDefinition->methNum; i++) {
v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(
@@ -360,26 +255,7 @@ CFXJSE_Class* CFXJSE_Class::Create(
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
}
}
- if (lpClassDefinition->constructor) {
- if (bIsJSGlobal) {
- hObjectTemplate->Set(
- v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name),
- v8::FunctionTemplate::New(
- pIsolate, V8ClassGlobalConstructorCallback_Wrapper,
- v8::External::New(pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(
- lpClassDefinition))),
- static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
- } else {
- v8::Local<v8::Context> hLocalContext = lpContext->GetContext();
- FXJSE_GetGlobalObjectFromContext(hLocalContext)
- ->Set(v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name),
- v8::Function::New(
- pIsolate, V8ClassGlobalConstructorCallback_Wrapper,
- v8::External::New(pIsolate,
- const_cast<FXJSE_CLASS_DESCRIPTOR*>(
- lpClassDefinition))));
- }
- }
+
if (bIsJSGlobal) {
v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(
pIsolate, Context_GlobalObjToString,
@@ -402,8 +278,7 @@ void CFXJSE_Class::SetUpNamedPropHandler(
v8::NamedPropertyHandlerConfiguration configuration(
lpClassDefinition->dynPropGetter ? NamedPropertyGetterCallback : 0,
lpClassDefinition->dynPropSetter ? NamedPropertySetterCallback : 0,
- lpClassDefinition->dynPropTypeGetter ? NamedPropertyQueryCallback : 0,
- lpClassDefinition->dynPropDeleter ? NamedPropertyDeleterCallback : 0,
+ lpClassDefinition->dynPropTypeGetter ? NamedPropertyQueryCallback : 0, 0,
NamedPropertyEnumeratorCallback,
v8::External::New(pIsolate,
const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)),