92 questions
3
votes
0
answers
162
views
Do methods on the ECMAScript Atomics object enforce that all prior shared memory operations are completed first?
The ECMAScript Language Specification states:
Atomics are carved in stone: Program transformations must not cause any Shared Data Block events whose [[Order]] is seq-cst to be removed from the is-...
2
votes
2
answers
281
views
Type narrowing of Uint8Array<ArrayBufferLike> to Uint8Array<ArrayBuffer>
Since TypeScript 5.9 we have (roughly speaking) Uint8Array = Uint8Array<ArrayBufferLike> = Uint8Array<ArrayBuffer | SharedArrayBuffer>. Now I am looking for a clean and idiomatic way to ...
2
votes
0
answers
50
views
How to share a single WebAssembly.Memory instance between multiple ESM worker threads in Node.js 22?
I am working with Node.js 22 using native ESM and Worker Threads, I'm trying to share a single WebAssembly.Memory instance across multiple workers to avoid duplicating memory.
// main.mjs
import { ...
4
votes
1
answer
179
views
How is this seemingly airtight synchronous SharedArrayBuffer setup manifesting corruption?
I have a setup where I have a couple dozen web workers postMessage requests to the main thread and then synchronously block for the response:
Since this is synchronous, the web worker never makes a ...
1
vote
2
answers
236
views
What results in TextEncoder.encode() using a buffer of a given type?
The return value of TextEncoder.encode() is Uint8Array<ArrayBufferLike>. The ArrayBufferLike type includes ArrayBuffer and SharedArrayBuffer. How to know which type of array buffer encode() will ...
0
votes
1
answer
188
views
Visibility of data in shared array buffer after using postMessage() with web worker
I am using a web worker to process some data for me. The flow goes like this: main thread writes to a shared array buffer, then once done writing, uses postMessage to send the buffer to the webworker. ...
0
votes
1
answer
579
views
Error loading FFmpeg: ReferenceError: SharedArrayBuffer is not defined - Angular 18.2.3
Question:
I am working on an Angular project (version 18.2.3) where I use ffmpeg.wasm to trim videos and extract frames. However, when trying to load FFmpeg, I am encountering the following error in ...
0
votes
0
answers
568
views
RangeError: Array buffer allocation failed after multiple page refreshes despite sufficient memory
I'm encountering a RangeError: Array buffer allocation failed error in my JavaScript application after refreshing the page multiple times. The error occurs even though the memory usage appears to be ...
1
vote
1
answer
337
views
How to used SharedArrayBuffer in iframe without iframe unsandboxing itself
I want to allow a sandboxed iframe to use SharedArrayBuffer with web workers created by the iframe. To use SharedArrayBuffer I have to set the following headers
Cross-Origin-Opener-Policy: same-origin
...
-1
votes
1
answer
519
views
Cross origin isolation and SharedArrayBuffer issue in godot4 game on iframe load
I have built a game using godot4 and hosted it on a Linux server.
In-game server .htacess
Header set Cross-Origin-Opener-Policy: "same-origin"
Header set Cross-Origin-Resource-Policy "...
-1
votes
1
answer
461
views
Shared Array Buffer in firebase using CORS headers
I am setting up a Firebase Web App and am unsure how to setup CORS headers for SharedArrayBuffer and if there is anything else I need to do for the SharedArrayBuffer. You can check the website if you ...
0
votes
1
answer
59
views
Sharing a TypedArray view of a SharedArrayBuffer with a worker - is the full SharedArrayBuffer accessible?
If I create a SharedArrayBuffer, and then create a 'view' of said buffer via a TypedArray, and then send that TypedArray to a Worker via postMessage, is the worker able to access the full data of the ...
3
votes
1
answer
831
views
Trouble with Cross-Origin Headers: Stripe and ffmpeg Integration in Next.js
I'm using this excellent template from vercel as a base for my project :
https://vercel.com/templates/next.js/subscription-starter
I've used it for many projects and the Stripe integration works ...
1
vote
0
answers
430
views
Google oauth button issue with COOP
The issue is: since i locked my page up in order to use sharedArrayBuffer (and other perks) google auth throws an error at posting a message between windows:
m=credential_page_library:210 Uncaught ...
1
vote
0
answers
1k
views
Setting Cross-origin-Embedder-Policy and Cross-origin-Opener-Policy headers in Express
I've been developing a website using Express for the backend and React for the frontend. I've come across the issue where my application won't work on Firefox due to this error: 'ReferenceError: ...
0
votes
1
answer
1k
views
Fixing Cross Origin Isolation and SharedArray Buffer for Godot game hosted on Firebase?
I have tried multiple different solutions found online, but I keep running into the same error:
The following features required to run Godot projects on the Web are missing:
Cross Origin Isolation - ...
0
votes
2
answers
554
views
Is it possible to Export Memory as Shared in WebAssembly?
(module
(memory (export "memory") 1)
(data (i32.const 0) "Hello World!")
)
fetch('hello.wasm')
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly....
2
votes
0
answers
698
views
Is it possible to share memory between the main and the render process in Electron?
I'm working on an application that needs to transfer lots of binary data (chunks of 10-100 MB) as fast as possible, and the ipc api and/or http requests are simply not fast enough (~50-200 MB/s). The ...
0
votes
2
answers
2k
views
How to resolve the issue of FFmpeg.wasm not working about SharedArrayBuffer error properly when using Nginx as a server and use Vite no error?
I am using FFmpeg.wasm for some frontend transcoding work. I know that due to certain browser policies, I need to configure some response headers in the Vite server options:
server: { headers: { '...
0
votes
1
answer
975
views
WebAudioWorklet in webassembly Shared Array Buffer not defined
I ma trying to understand how to compile an Audio Worklet in webassembly using the Wasm Audio Worklets API of the emscripten.
Using the code listed in the tutorial on the API reference here and ...
10
votes
5
answers
6k
views
How to Play a Godot 4 HTML Project Locally?
I have exported the web version of my Godot 4, it is in a folder on my local drive.
Because of the SharedArrayBuffer dependency I can not just double-click in the index.html file. If I do so I see ...
3
votes
1
answer
209
views
Cross-origin isolation in a Firefox extension
In Chrome, one can make an extension cross-origin isolated by adding the following to manifest.json:
{
...
"cross_origin_embedder_policy": {
"value": "require-...
0
votes
1
answer
374
views
How do I check if a value is a `SharedArrayBuffer` view, in Javascript?
The ArrayBuffer.isView() static method checks if it's one of the ArrayBuffer views, such as TypedArray objects or a DataView.
How do you check if it's a view of a SharedArrayBuffer?
It's been a quite ...
2
votes
1
answer
2k
views
Enabling cross-origin isolation on the apache2 web server
My system is Ubuntu and i use the apache2 web server. I need SharedArrayBuffer in my site. But when I call my page I get the error:
"Uncaught (in promise) ReferenceError: SharedArrayBuffer is not ...
5
votes
0
answers
647
views
Is it possible to use Firebase auth with cross origin isolation without using Firebase Hosting?
I've added a feature to my web app that requires using SharedArrayBuffer. To access shared SharedArrayBuffer my site needs to be cross origin isolated.
I have added the required headers
Cross-Origin-...
3
votes
1
answer
2k
views
Cannot get SharedArrayBuffer to work in android webview, although it works in both chrome and firefox on both android and desktops
I am trying to run mupdf built as web assembly in a webview on Android.
I have set the response headers correctly as far as I know, and this is illustrated by the fact that the web page using the web ...
1
vote
1
answer
440
views
Unhandled JS Exception: Can't find variable: SharedArrayBuffer
I'm starting my react-native project using expo in the iOS version and getting this obscure error which is blocking development progress. I've only started to see this error after trying to setup the ...
0
votes
1
answer
1k
views
"SharedArrayBuffer is not defined" error in cloud server but working in localhost
I have enable SharedArrayBuffer and was working in my localhost but once i pushed it to testing environment it is not working.
I added these cors headers to enable SharedArrayBuffer
Cross-Origin-...
0
votes
1
answer
679
views
Analytics with Cross-Origin-Opener-Policy?
I have one page on my site that uses SharedArrayBuffer, which means I need to use Cross-Origin-Opener-Policy - but this also means I can't use analytics to see if anyone actually uses that page or not....
1
vote
1
answer
1k
views
304 ERR_BLOCKED_BY_RESPONSE for web worker file after enabling same-origin CORS to allow SharedArrayBuffer
I'm looking to do some multithreading for my web application to improve performance and I've stumbled upon a head-scratcher. I'm currently developing on localhost (vite server) on Chrome.
Basically I ...
1
vote
1
answer
2k
views
Enable Shared Array Buffer in Cross-Domain
I am facing a problem, SAB(SharedArrayBuffer) does not work in cross-domain environment. Target IFrame's source is on another domain, I added aliases to hosts file(Windows OS). I am sending SAB ...
6
votes
3
answers
2k
views
JavaScript: TextDecoder on SharedArrayBuffer
I am facing a problem with decode() on SharedArrayBuffer.
Code:
var sharedArrayBuffer = new SharedArrayBuffer(2);
var uint8Array = new Uint8Array(sharedArrayBuffer);
uint8Array[0] = 20;
var ...
2
votes
1
answer
1k
views
Is web worker unavailable when cross-origin isolation is enabled
Here are my two files, test.js and test.php.
test.js:
console.log("test.js is loaded")
test.php:
<?php
header('Content-Type: text/html; charset=UTF-8');
//header('Cross-Origin-Embedder-...
0
votes
0
answers
696
views
NodeJS Worker Thread use SharedArrayBuffer final result incorrect value
I was just tinkering and messing around with worker thread in NodeJS and managed to do so in a fundamental way. But running the child process and expecting result to be "30,000" after ...
2
votes
1
answer
604
views
SharedArrayBuffer, Github pages and DNS [duplicate]
Buon giorno, here is the situation:
A git repo hosted through Github pages: https://github.com/ossia/score-web ; I configured Github to put it behind the domain https://ossia.io thus at the address ...
1
vote
1
answer
1k
views
How Can I Configure Storybook to Use React-App-Rewired?
I'm working on a project that implements react-app-rewired to send headers to the server in order to bypass ReferenceError: SharedArrayBuffer is not defined (I'm getting this error from using the @...
1
vote
1
answer
763
views
Is passing Int32Array instead of SharedArrayBuffer supposed to work?
I have some code that creates a shared array buffer and passes the Int32Array and NOT the SharedArrayBuffer to the worker:
let worker = new Worker(...);
worker.postMessage({
position: {
x: ...
3
votes
0
answers
277
views
Google Drive Picker failing with "docs.google.com refused to connect" after setting Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy
To support usage of SharedArrayBuffer in our web app we had to add the response headers:
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
We have also tried:
Cross-...
1
vote
1
answer
2k
views
How to post a message from a web worker to another web worker Javascript
I am trying to send a message from one worker to the other (and then respond back through a SharedArrayBuffer). But I can't find any information on posting a message to another worker from within a ...
1
vote
0
answers
245
views
How to move local File object in and out of Shared Array Buffers JS
I have a web worker running in a while(true) loop, the code is too deep to change it at this point in time. The worker can access a Shared Array Buffer, I have a means to signal that there is data ...
1
vote
1
answer
1k
views
Sharing array of nested objects between workers
I have an array of objects which contains more objects as values. I'm working with Web Workers and I need to use this exact array of objects (or another object) in worker file. Problem is I couldn't ...
6
votes
2
answers
3k
views
Use ShareArrayBuffer from an electron app
We have an electron app which uses ShareArrayBuffer. It was written with a very old version of electron. When we updated the electron version in order to use SIMD instructions in WASM, it started ...
8
votes
1
answer
3k
views
Can you store a JS object in a SharedArrayBuffer?
I need to share an object between a client side application and a web worker and I heard about SharedArrayBuffers. This is what I'd like to do.
main.js
let myWorker = new Worker('/worker.js')
let ...
6
votes
1
answer
4k
views
Running ServiceWorker in Capacitor App on iOS
tl;dr
Essentially i need to set COOP/COEP headers to enable SharedArrayBuffer functionality in my Capacitor v3 iOS App and running a ServiceWorker to set the headers is the only solution i have found ...
3
votes
2
answers
1k
views
SharedArrayBuffer not defined when using Cypress
I'm using Vite and Cypress for dev and testing
I'm loading ffmpeg, it loads fine on Chrome but on Cypress, it gives this error
ReferenceError: SharedArrayBuffer is not defined
Apparently, it's caused ...
6
votes
2
answers
8k
views
Enable SharedArrayBuffer on localhost
I keep getting a 'SharedArrayBuffer is not defined' error when trying to run ffmpeg.wasm. It appears this is on the Webassembly side. Regardless, I know this is an issue that can be overcome with ...
4
votes
2
answers
13k
views
How to enable sharedArrayBuffer in chrome without cross-origin isolation
I have this experiment which I only run on my local machine: I load an external webpage from, for example https://example.com and the with puppeteer I inject a javascript file which is served from ...
1
vote
1
answer
2k
views
How to enable SharedArrayBuffer in Microsoft Edge Javascript
So the other day, I asked this question about javascript webworkers:
Javascript Webworker how to put json information into array buffer. One of the answers I received was to use a SharedArrayBuffer to ...
0
votes
0
answers
323
views
WebAssembly/SharedArrayBuffer support in recent browsers for network appliance?
About a year ago, I wrote a video player for a proprietary video format that uses WebAssembly, WebGL, and WebSockets. It was working great until the most recent versions of Chrome, which disable ...
1
vote
0
answers
187
views
Can a SharedArrayBuffer be picked up by garbage collection in Node?
I'm trying to build a Node application using worker threads, divided into three parts.
The primary thread that delegates tasks
A dedicated worker thread that updates shared data
A pool of worker ...