You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid reference to SharedArrayBuffer in UTF8ArrayToString (#22844)
This allows program built with `SHARED_MEMORY` enabled to run in a
single threaded context where `SharedArrayBuffer` is not defined (i.e.
when crossOriginIsolated is false).
Fixes: #22837
# We specifically test that we can call UTF8ToString, which in older emscripten
12203
+
# versions had an instanceof check against SharedArrayBuffer which would cause
12204
+
# a crash when SharedArrayBuffer was undefined.
12205
+
create_file('pre.js', '''
12206
+
SharedArrayBuffer = undefined;
12207
+
Module.onRuntimeInitialized = () => {
12208
+
var addr = stringToNewUTF8("hello world string, longer than 16 chars");
12209
+
assert(addr);
12210
+
var str = UTF8ToString(addr);
12211
+
console.log("got: " + str);
12212
+
assert(str == "hello world string, longer than 16 chars");
12213
+
};''')
12214
+
expected = ['got: hello world string, longer than 16 chars', 'pthread_create: environment does not support SharedArrayBuffer, pthreads are not available']
0 commit comments