[whatwg/webidl] Expected behavior of SharedArrayBuffer with (BufferSource or DOMString) union type (Issue #1491)

annevk created an issue (whatwg/webidl#1491)

### What is the issue with the Web IDL Standard?

In trying to figure out [why WebKit is failing an XMLHttpRequest test](https://bugs.webkit.org/show_bug.cgi?id=254864) I realized that when we introduced SharedArrayBuffer as a standalone IDL type we changed the behavior of how it's handled in union types.

Say you have a method that takes (BufferSource or DOMString), you have these scenarios:

1. Pass a SharedArrayBuffer
2. Pass a view on a SharedArrayBuffer

I think as the specification stands today 1 yields a string and 2 yields a TypeError. Before https://github.com/whatwg/webidl/commit/c45a0f3820f706554284117cab1b479e4932b467 both would yield a TypeError.

I think the new behavior is okay, but we could special case SharedArrayBuffer as well I suppose.

This impacts https://wpt.fyi/results/xhr/send-data-sharedarraybuffer.any.html and possibly other tests.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1491
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1491@github.com>

Received on Friday, 23 May 2025 08:01:20 UTC