github web-platform-tests/wpt merge_pr_48613

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
10 months ago

webusb: Use [PassAsSpan] to handle BufferSource arguments

This change simplifies the implementation of WebUSB methods which accept
a BufferSource argument by using the [PassAsSpan] WebIDL attribute.

Using this requires a behavior change: Passing a detached buffer is now
no longer fatal (except when it causes other argument validation errors)
because a detached buffer turns into an empty span. I think this is a
safe change to make because it matches the WebIDL rules for handling
detached buffers (throwing a specific error was unspecified behavior)
and this case is developer error, so sites shouldn't be depending on it.

Change-Id: I8af158d51b1760625984f697eac880ecd808d13b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5924242
Commit-Queue: Reilly Grant reillyg@chromium.org
Auto-Submit: Reilly Grant reillyg@chromium.org
Reviewed-by: Matt Reynolds mattreynolds@chromium.org
Cr-Commit-Position: refs/heads/main@{#1372209}

Don't miss a new wpt release

NewReleases is sending notifications on new releases.