Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Webassembly.compile() doesn't support SharedArrayBuffer in 138

  • 1 trả lời
  • 0 gặp vấn đề này
  • 11 lượt xem
  • Trả lời mới nhất được viết bởi TyDraniu

more options

Hello,

as per description I noticed that firefox version 138 requires an ArrayBuffer as the argument of WebAssembly.compile() and doesn't allow anymore (like in 137) a SharedArrayBuffer, is this intended or it will be fixed in the future? Follows a simple test case. Kind reagards.


--- index.html --- <title>Example</title> <script> let instance = undefined; async function loadWasm() { try { const response = await fetch('./sum.wasm'); const buffer = await response.arrayBuffer(); const sharedBuffer = new SharedArrayBuffer(buffer.byteLength); const tmpView = new Uint8Array(sharedBuffer); tmpView.set(new Uint8Array(buffer)); const module = await WebAssembly.compile(sharedBuffer); instance = await WebAssembly.instantiate(module); } catch (error) { alert(`failed to compile in wasm: ${error.message}`); } } loadWasm(); function testWasm() { if (instance) alert(`sum 1 + 2 = ${instance.exports.add(1, 2)}`); else alert('invalid instance, failed to compile'); } </script> <button onclick="testWasm()">Press to run wasm function (sum)</button> --- ---

--- sum.wat --- (to convert into .wasm using: wat2wasm sum.wat -o sum.wasm) (module (func $add (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add) (export "add" (func $add)) ) --- ---

Hello, as per description I noticed that firefox version 138 requires an ArrayBuffer as the argument of WebAssembly.compile() and doesn't allow anymore (like in 137) a SharedArrayBuffer, is this intended or it will be fixed in the future? Follows a simple test case. Kind reagards. --- index.html --- <!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <script> let instance = undefined; async function loadWasm() { try { const response = await fetch('./sum.wasm'); const buffer = await response.arrayBuffer(); const sharedBuffer = new SharedArrayBuffer(buffer.byteLength); const tmpView = new Uint8Array(sharedBuffer); tmpView.set(new Uint8Array(buffer)); const module = await WebAssembly.compile(sharedBuffer); instance = await WebAssembly.instantiate(module); } catch (error) { alert(`failed to compile in wasm: ${error.message}`); } } loadWasm(); function testWasm() { if (instance) alert(`sum 1 + 2 = ${instance.exports.add(1, 2)}`); else alert('invalid instance, failed to compile'); } </script> <button onclick="testWasm()">Press to run wasm function (sum)</button> </body> </html> --- --- --- sum.wat --- (to convert into .wasm using: ''wat2wasm sum.wat -o sum.wasm'') (module (func $add (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add) (export "add" (func $add)) ) --- ---

Tất cả các câu trả lời (1)

more options
  1. Please report this bug on https://bugzilla.mozilla.org .
  2. You can use mozregression to find a commit that broke it.

Hữu ích?

Đặt một câu hỏi

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.