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
misc/wasm: unable to pass extra flags like "--no-sandbox" while executing in Electron #29404
Comments
The nodeJS part of wasm_exec.js is just a simple wrapper to call the wasm binary. Even the usage is /cc @neelance |
I don't understand this issue. Why are you passing |
I want to use wasm in electron which integrates the node.js environment. it's catch error when loading *.wasm file. I'm using wasm_exec.js to start wasm, but the process.arg[2] would be a flag named "--no-sandbox", not a file name. so,the follow code catch error: |
You still haven't told me how exactly you're loading |
loading wasm_exec.js in index.html like this: ` <title>go wasm</title> <script src="wasm_exec.js"></script> <script src="index.js"></script> Button `and in index.js: const go = new Go(); WebAssembly.instantiateStreaming( async function run() { |
Okay, looks like this use case is not yet covered by Line 442 in 3b66c00
|
the error does not catch using the new wasm_exec.js. But new problems arise.: WebAssembly.instantiateStreaming.then.catch | @ | index.js:14 Do I need a new version compiler? by the way, using old wasm_exec.js and changing isNodeJS && require.main === module, still catch error. |
By "new", if you mean the wasm_exec.js found in the master branch, then you need to use the Go binary compiled using the master branch. Could you try that ? You can download and build the Go master branch using gotip. |
thanks, I would try it out. |
The master tree don't catch the error without changing isNodeJS to isNodeJS && require.main === module! The error may be only in version 1.11.4. |
Did you mean "with changing ..." ? |
I mean without changing.I compare the master tree with 1.11.4(wasm_exec.js), there are some differents between them. And the master tree did not catche error any more. |
Ah I see. So the master branch does not catch the error by default. Interesting. @neelance - thoughts ? |
With 1.11 it was
now it is
That's probably enough for your case to have |
os package really doesn't work. |
Yes, in your case the check |
@gtd138 Could you please give this branch a try? https://github.com/neelance/go/blob/wasm-exec/misc/wasm/wasm_exec.js |
I changed how the bundling works and don't have the same problem anymore; it's been a while, so I'm afraid I don't remember what the other problem was or how to reproduce it. Sorry. |
@neelance
|
So this means that |
Yes, |
This is unexpected, but it is JavaScript after all... So maybe we should keep the |
I found it from Electron's official website. It is |
I have updated the branch https://github.com/neelance/go/blob/wasm-exec/misc/wasm/wasm_exec.js. Does this work for you? |
It works! The os package works, too. Thanks. |
Great. I'll create a CL in the next cycle. |
Ok. Does it mean it will be supported in 1.12? |
No, the next cycle is 1.13. 1.12 is feature frozen. |
Ah,I see. |
Change https://golang.org/cl/164665 mentions this issue: |
go version 1.11.4
electron is a mudule in node.js. when run wasm_exe in electron,catch error:
the code which in wasm_exe.js
process.argv[2] == "--no-sandbox" not a file!
I have to fix it like this:
if (process.argv[2] == "--no-sandbox") {
return;
}
I don't think it is a good idea. would you please fix it?
GoWebassembly.zip
The text was updated successfully, but these errors were encountered: