Replace ReadOnlySharedMemoryRegion with WritableSharedMemoryRegion (see #3502)

Write access to the shared memory region is required because JavaScript lacks
the capability to create read-only ArrayBuffers. When a user attempts to modify
an ArrayBuffer that utilizes a ReadOnlySharedMemoryRegion as its BackingStore
it triggers an access violation.

Note that this pull request may be reverted in the future if JavaScript adds
read-only ArrayBuffer support.
This commit is contained in:
Nik Pavlov
2023-10-16 22:43:29 +00:00
committed by Marshall Greenblatt
parent f3e92b45fc
commit 8d7001adc3
16 changed files with 81 additions and 42 deletions

View File

@@ -289,7 +289,7 @@ void CefFrameImpl::SendProcessMessage(CefProcessId target_process,
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
[](const CefString& name, base::WritableSharedMemoryRegion region,
const BrowserFrameType& render_frame) {
render_frame->SendSharedMemoryRegion(name, std::move(region));
},
@@ -698,7 +698,7 @@ void CefFrameImpl::SendMessage(const std::string& name,
void CefFrameImpl::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
base::WritableSharedMemoryRegion region) {
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto handler = app->GetRenderProcessHandler()) {
CefRefPtr<CefProcessMessage> message(