Bug 171419

Summary: Serializing and deserializing SharedArrayBuffer
Product: WebKit Reporter: Anne van Kesteren <annevk>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, fpizlo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 228755    

Description Anne van Kesteren 2017-04-27 21:54:31 PDT
Tests are in web-platform-tests:

  html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/

Online version (times out at times, not sure what's up): https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/

Change to the standard which will land later today: https://github.com/whatwg/html/pull/2518

Once it lands, it's part of https://html.spec.whatwg.org/multipage/infrastructure.html#safe-passing-of-structured-data

(Note that quite a few tests might not be applicable due to various APIs not being supported by WebKit, but even so there's still bugs there as far as I could tell.)
Comment 1 Yusuke Suzuki 2021-09-09 03:39:08 PDT
@Chris
I opened https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-history.https.html and it said there is no SharedArrayBuffer.
Are some headers missing?
Comment 2 Chris Dumez 2021-09-09 07:26:15 PDT
(In reply to Yusuke Suzuki from comment #1)
> @Chris
> I opened
> https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> shared-array-buffers/serialization-via-history.https.html and it said there
> is no SharedArrayBuffer.
> Are some headers missing?

I see:
assert_throws_dom: function "() => { history[method](new SharedArrayBuffer(), "dummy title"); }" did not throw

The subtests are failing for me but not due to lack of SharedArrayBuffer support.

From Web Inspector, I can see that the test is serving the COOP+COEP headers:
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

@Yusuke, I've enabled COOP + COEP by default only very recently. Maybe you tested on a build that didn't have them enabled yet?
Comment 3 Yusuke Suzuki 2021-09-09 16:59:18 PDT
(In reply to Chris Dumez from comment #2)
> (In reply to Yusuke Suzuki from comment #1)
> > @Chris
> > I opened
> > https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> > shared-array-buffers/serialization-via-history.https.html and it said there
> > is no SharedArrayBuffer.
> > Are some headers missing?
> 
> I see:
> assert_throws_dom: function "() => { history[method](new
> SharedArrayBuffer(), "dummy title"); }" did not throw
> 
> The subtests are failing for me but not due to lack of SharedArrayBuffer
> support.
> 
> From Web Inspector, I can see that the test is serving the COOP+COEP headers:
> Cross-Origin-Embedder-Policy: require-corp
> Cross-Origin-Opener-Policy: same-origin
> 
> @Yusuke, I've enabled COOP + COEP by default only very recently. Maybe you
> tested on a build that didn't have them enabled yet?

Thanks!
Hmm, I've tried opening https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-history.https.html with WebKit r282238, but I'm getting an error

assert_throws_dom: function "() => { history[method](new SharedArrayBuffer(), "dummy title"); }" threw object "ReferenceError: Can't find variable: SharedArrayBuffer" that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25

I also opened the inspector, and it seems that SharedArrayBuffer is not defined.
Is some flag necessary?
Comment 4 Chris Dumez 2021-09-09 17:04:56 PDT
(In reply to Yusuke Suzuki from comment #3)
> (In reply to Chris Dumez from comment #2)
> > (In reply to Yusuke Suzuki from comment #1)
> > > @Chris
> > > I opened
> > > https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> > > shared-array-buffers/serialization-via-history.https.html and it said there
> > > is no SharedArrayBuffer.
> > > Are some headers missing?
> > 
> > I see:
> > assert_throws_dom: function "() => { history[method](new
> > SharedArrayBuffer(), "dummy title"); }" did not throw
> > 
> > The subtests are failing for me but not due to lack of SharedArrayBuffer
> > support.
> > 
> > From Web Inspector, I can see that the test is serving the COOP+COEP headers:
> > Cross-Origin-Embedder-Policy: require-corp
> > Cross-Origin-Opener-Policy: same-origin
> > 
> > @Yusuke, I've enabled COOP + COEP by default only very recently. Maybe you
> > tested on a build that didn't have them enabled yet?
> 
> Thanks!
> Hmm, I've tried opening
> https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> shared-array-buffers/serialization-via-history.https.html with WebKit
> r282238, but I'm getting an error
> 
> assert_throws_dom: function "() => { history[method](new
> SharedArrayBuffer(), "dummy title"); }" threw object "ReferenceError: Can't
> find variable: SharedArrayBuffer" that is not a DOMException DataCloneError:
> property "code" is equal to undefined, expected 25
> 
> I also opened the inspector, and it seems that SharedArrayBuffer is not
> defined.
> Is some flag necessary?

Oh, I had not correctly enabled the COEP feature. Fixed in https://commits.webkit.org/r282245.
Comment 5 Yusuke Suzuki 2021-09-09 18:50:08 PDT
(In reply to Chris Dumez from comment #4)
> (In reply to Yusuke Suzuki from comment #3)
> > (In reply to Chris Dumez from comment #2)
> > > (In reply to Yusuke Suzuki from comment #1)
> > > > @Chris
> > > > I opened
> > > > https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> > > > shared-array-buffers/serialization-via-history.https.html and it said there
> > > > is no SharedArrayBuffer.
> > > > Are some headers missing?
> > > 
> > > I see:
> > > assert_throws_dom: function "() => { history[method](new
> > > SharedArrayBuffer(), "dummy title"); }" did not throw
> > > 
> > > The subtests are failing for me but not due to lack of SharedArrayBuffer
> > > support.
> > > 
> > > From Web Inspector, I can see that the test is serving the COOP+COEP headers:
> > > Cross-Origin-Embedder-Policy: require-corp
> > > Cross-Origin-Opener-Policy: same-origin
> > > 
> > > @Yusuke, I've enabled COOP + COEP by default only very recently. Maybe you
> > > tested on a build that didn't have them enabled yet?
> > 
> > Thanks!
> > Hmm, I've tried opening
> > https://w3c-test.org/html/infrastructure/safe-passing-of-structured-data/
> > shared-array-buffers/serialization-via-history.https.html with WebKit
> > r282238, but I'm getting an error
> > 
> > assert_throws_dom: function "() => { history[method](new
> > SharedArrayBuffer(), "dummy title"); }" threw object "ReferenceError: Can't
> > find variable: SharedArrayBuffer" that is not a DOMException DataCloneError:
> > property "code" is equal to undefined, expected 25
> > 
> > I also opened the inspector, and it seems that SharedArrayBuffer is not
> > defined.
> > Is some flag necessary?
> 
> Oh, I had not correctly enabled the COEP feature. Fixed in
> https://commits.webkit.org/r282245.

Nice!!
Comment 6 Radar WebKit Bug Importer 2022-03-08 11:26:18 PST
<rdar://problem/89979253>