Resolve an old TODO() about non-v8 build using |JS_| functions.
Remove the JS_ prefix in the SubmitForm() case, as it is not
directly called from fxjs. Remove the JS_ prefix in the
GetFilePath() case, but also provide a JS_ wrapper. Ideally,
all of the JS_ functions would be declared as an interface
in fxjs itself, so this helps keep that consistent.
-- Make SubmitForm() take a span.
Change-Id: I79c3472fa7338112fede7965f5dfa014dad781df
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/58970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 49d83c0..4f46db4 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -216,9 +216,13 @@
}
m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
}
-#endif // PDF_ENABLE_V8
WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
+ return GetFilePath();
+}
+#endif // PDF_ENABLE_V8
+
+WideString CPDFSDK_FormFillEnvironment::GetFilePath() const {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_getFilePath) {
return WideString();
@@ -238,16 +242,16 @@
return WideString::FromDefANSI(ByteStringView(pBuff));
}
-void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
- int length,
- const WideString& URL) {
+void CPDFSDK_FormFillEnvironment::SubmitForm(pdfium::span<uint8_t> form_data,
+ const WideString& URL) {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_submitForm) {
return;
}
ByteString bsUrl = URL.ToUTF16LE();
- m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData,
- length, AsFPDFWideString(&bsUrl));
+ m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform,
+ form_data.data(), form_data.size(),
+ AsFPDFWideString(&bsUrl));
}
IJS_Runtime* CPDFSDK_FormFillEnvironment::GetIJSRuntime() {