Automatic update from web-platform-tests bindings: add checks for whether underlying array buffer is shared when converting array views Fixed: 513773313 Change-Id: Ie845dfd6edef361715654644be65c2e4720795f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7869251 Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1635059} -- wpt-commits: 6a34ac284642b7614d502eed463b61c22b99c5a0 wpt-pr: 60117
30 lines
1.0 KiB
HTML
30 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>WebIDL [AllowShared] semantics</title>
|
|
<link rel="help" href="https://webidl.spec.whatwg.org/#AllowShared">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/common/sab.js"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
test(t => {
|
|
// Create a standard SharedArrayBuffer (safe even without COOP/COEP headers)
|
|
const sab = createBuffer('SharedArrayBuffer', 128);
|
|
const arr = new Uint8Array(sab);
|
|
arr.fill(42);
|
|
assert_equals(sab.constructor.name, 'SharedArrayBuffer');
|
|
new ImageDecoder({
|
|
data: arr,
|
|
// We don't really need encoding to succeed, just for argument conversion before the native call.
|
|
type: "invalid"
|
|
});
|
|
|
|
assert_throws_js(TypeError, () => {
|
|
new MIDIMessageEvent('message', { data: arr });
|
|
}, "An attempt to pass a view backed by a shared array buffer should throw");
|
|
|
|
}, "APIs without [AllowShared] do not accept SharedArrayBuffer-backed views with pre-existing wrapper");
|
|
|
|
</script>
|