Hide FPDF_GetArrayBufferAllocatorSharedInstance() for incompatible V8
Prevent incorrect builds when V8 has out-evolved FXJS. Makes
the issue in the linked bug visible during builds.
Requires https://crrev.com/c/4156628 before landing.
Bug: chromium:1325244
Change-Id: I5794ab3633c838331bdd63710bd096a0723b7f3c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103210
Reviewed-by: K. Moon <kmoon@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index a93cf95..02f58ac 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -1106,10 +1106,13 @@
return "--jitless";
}
+#ifndef V8_ENABLE_SANDBOX
+// TODO(crbug.com/1325244): support the v8 sandbox case.
FPDF_EXPORT void* FPDF_CALLCONV FPDF_GetArrayBufferAllocatorSharedInstance() {
static pdfium::base::NoDestructor<CFX_V8ArrayBufferAllocator> allocator;
return allocator.get();
}
+#endif // V8_ENABLE_SANDBOX
#endif // PDF_ENABLE_V8
#ifdef PDF_ENABLE_XFA
diff --git a/public/fpdfview.h b/public/fpdfview.h
index 32db6d1..f00c596 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -1414,6 +1414,8 @@
// The caller must not attempt to modify or free the result.
FPDF_EXPORT const char* FPDF_CALLCONV FPDF_GetRecommendedV8Flags();
+#ifndef V8_ENABLE_SANDBOX
+// TODO(crbug.com/1325244): support the v8 sandbox case.
// Experimental API.
// Function: FPDF_GetArrayBufferAllocatorSharedInstance()
// Helper function for initializing V8 isolates that will
@@ -1428,6 +1430,7 @@
// matching the ones PDFium will make when none is provided
// via |FPDF_LIBRARY_CONFIG::m_pIsolate|.
FPDF_EXPORT void* FPDF_CALLCONV FPDF_GetArrayBufferAllocatorSharedInstance();
+#endif // V8_ENABLE_SANDBOX
#endif // PDF_ENABLE_V8
#ifdef PDF_ENABLE_XFA