Bug 220364

Summary: Should SharedArrayBuffer/WebAssembly.Memory really throw?
Product: WebKit Reporter: Sam Sneddon [:gsnedders] <gsnedders>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: clopez, eric.carlson, ews-watchlist, glenn, jer.noble, keith_miller, mark.lam, msaboff, philipj, saam, sergio, simon.fraser, tzagallo, webkit-bug-importer, youennf, ysuzuki
Priority: P2 Keywords: InRadar, WPTImpact
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218944
https://bugs.webkit.org/show_bug.cgi?id=219076
https://bugs.webkit.org/show_bug.cgi?id=218693
https://github.com/web-platform-tests/wpt/issues/27065
Attachments:
Description Flags
Patch
mark.lam: review+, ews-feeder: commit-queue-
Patch none

Description Sam Sneddon [:gsnedders] 2021-01-06 08:37:54 PST
Currently in ToT (and STP 117+), trying to create a SharedArrayBuffer throws with "Shared WebAssembly.Memory and SharedArrayBuffer are not enabled".

This has caused a variety of WPT tests to regress (e.g., many encoding tests), due to https://github.com/web-platform-tests/wpt/blob/master/common/sab.js silently creating a non-shared WebAssembly.Memory (as would be expected of an unsupported option) previously but now throwing with that TypeError.
Comment 1 Radar WebKit Bug Importer 2021-01-13 08:38:11 PST
<rdar://problem/73152534>
Comment 2 Yusuke Suzuki 2021-01-22 18:13:10 PST
Created attachment 418204 [details]
Patch
Comment 4 Mark Lam 2021-01-22 19:20:26 PST
Comment on attachment 418204 [details]
Patch

r=me if EWS bots are green.
Comment 5 Yusuke Suzuki 2021-01-22 19:41:46 PST
I'll only update sab.js and wasm for now.
Comment 6 Yusuke Suzuki 2021-01-22 19:43:54 PST
Created attachment 418208 [details]
Patch
Comment 7 Yusuke Suzuki 2021-01-22 20:40:24 PST
Debug failure http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html is flaky and unrelated to wpt / wasm
Comment 8 Yusuke Suzuki 2021-01-22 20:58:54 PST
Committed r271774: <https://trac.webkit.org/changeset/271774>
Comment 9 Simon Fraser (smfr) 2021-01-23 11:12:36 PST
Comment on attachment 418208 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=418208&action=review

> Source/JavaScriptCore/ChangeLog:8
> +        Not accessing "shared" field if Options::useSharedArrayBuffer() is false.

This doesn't tell me the answer to the question in the title.
Comment 10 Mark Lam 2021-01-23 11:37:01 PST
(In reply to Simon Fraser (smfr) from comment #9)
> Comment on attachment 418208 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=418208&action=review
> 
> > Source/JavaScriptCore/ChangeLog:8
> > +        Not accessing "shared" field if Options::useSharedArrayBuffer() is false.
> 
> This doesn't tell me the answer to the question in the title.

The answer is no.  The above comment was trying to say, "we should not access the `shared` field if Options::useSharedArrayBuffer() is false".
Comment 12 Sam Sneddon [:gsnedders] 2021-05-14 06:52:06 PDT
Filed https://github.com/web-platform-tests/wpt/pull/28998 to workaround the constructor unexpectedly throwing.