Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAudio/OrientationSensor/Portals: use Wasm to get a SharedArrayBuff… #22363

Merged
merged 1 commit into from Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion orientation-sensor/orientation-sensor-tests.js
Expand Up @@ -42,7 +42,9 @@ async function checkPopulateMatrix(t, sensorProvider, sensorType) {

// Throws if passed SharedArrayBuffer view.
assert_throws_js(TypeError,
() => sensor.populateMatrix(new Float32Array(new SharedArrayBuffer(16))));
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
// WebAssembly.Memory's size is in multiples of 64 KiB
() => sensor.populateMatrix(new Float32Array(new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer)));

sensor.start();

Expand Down
3 changes: 2 additions & 1 deletion portals/portal-activate-data.html
Expand Up @@ -74,7 +74,8 @@
const w = await openBlankPortalHost();
await promise_rejects_dom(
t, 'DataCloneError', w.DOMException,
openPortalAndActivate('', {data: new SharedArrayBuffer}, w));
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
openPortalAndActivate('', {data: new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer}, w));
}, "A SharedArrayBuffer cannot be passed through activate data.");

promise_test(async t => {
Expand Down
Expand Up @@ -149,7 +149,9 @@
buffer.copyFromChannel(x, 3);
}, '7: buffer.copyFromChannel(x, 3)').throw(DOMException, 'IndexSizeError');

let shared_buffer = new Float32Array(new SharedArrayBuffer(32));
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
// WebAssembly.Memory's size is in multiples of 64 KiB
const shared_buffer = new Float32Array(new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer);
should(
() => {
buffer.copyFromChannel(shared_buffer, 0);
Expand Down Expand Up @@ -202,7 +204,9 @@
buffer.copyToChannel(x, 3);
}, '6: buffer.copyToChannel(x, 3)').throw(DOMException, 'IndexSizeError');

let shared_buffer = new Float32Array(new SharedArrayBuffer(32));
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
// WebAssembly.Memory's size is in multiples of 64 KiB
const shared_buffer = new Float32Array(new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer);
should(
() => {
buffer.copyToChannel(shared_buffer, 0);
Expand Down