WebAssembly - 应用程序重新启动给出“运行时错误:中止(Module.arguments 已替换为普通参数_”)
我正在尝试使用以下 WebAssembly 模块配置:
restartMode: "RestartOnExit",
restartType: "RestartModule",
restartLimit: 10000
我使用 Qt Creator 新创建了一个新的 Qt Quick Empty 应用程序。 我只将其添加到 main.cpp :
QObject::connect(&engine, &QQmlApplicationEngine::quit, &QGuiApplication::quit);
将其添加到 main.qml :
Button {
anchors.centerIn: parent
text: "Quit App"
onClicked: {
Qt.callLater(Qt.quit)
}
}
将其添加到 CMakeLists.txt :
#This comes after the `qt_finalize_executable` call :
#Update the *.html, to configure `restartMode: "RestartOnExit"`, and `restartType: "RestartModule"1, and restartLimit: 10000`
FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html WASM_RESTART_HTML)
STRING(REGEX REPLACE "canvasElements" "restartMode: \"RestartOnExit\", restartType: \"RestartModule\", restartLimit: 10000, canvasElements" UPDATED_WASM_RESTART_HTML "${WASM_RESTART_HTML}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html "${UPDATED_WASM_RESTART_HTML}")
当我为 WebAssembly 构建并运行它时, 实际行为:按下“退出应用程序”按钮后,应用程序给出运行时错误:
RuntimeError: abort(Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)) at Error at jsStackTrace (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1827:19) at stackTrace (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1844:16) at abort (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1530:44) at Object.get (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :261:7) at eval (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :256:11) at eval () at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14) at http://localhost:30002/qtloader.js:332:13
预期行为 会be :按下“退出应用程序”按钮后,应用程序应该成功重新启动。
旁注:它适用于 restartType: "ReloadPage"
,但我想避免重新加载页面。
旁注 2:如果我对 WasmRestart.js 文件进行以下修改,它也适用:
var calledRun;
=>
var calledRun = false;
function findEventTarget(target) {
target = maybeCStringToJsString(target);
if (target.length == 0) {
return null
}
function exposePublicSymbol(name, value, numArguments) {
if (Module.hasOwnProperty(name)) {
if (undefined === numArguments || (undefined !== Module[name].overloadTable && undefined !== Module[name].overloadTable[numArguments])) {
// throwBindingError("Cannot register public name '" + name + "' twice");
但我认为这些修改可能会导致一些问题。
I am trying to use the following WebAssembly module configuration :
restartMode: "RestartOnExit",
restartType: "RestartModule",
restartLimit: 10000
I freshly created a new Qt Quick Empty Application using Qt Creator.
I only added this to main.cpp :
QObject::connect(&engine, &QQmlApplicationEngine::quit, &QGuiApplication::quit);
this to main.qml :
Button {
anchors.centerIn: parent
text: "Quit App"
onClicked: {
Qt.callLater(Qt.quit)
}
}
and this to CMakeLists.txt :
#This comes after the `qt_finalize_executable` call :
#Update the *.html, to configure `restartMode: "RestartOnExit"`, and `restartType: "RestartModule"1, and restartLimit: 10000`
FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html WASM_RESTART_HTML)
STRING(REGEX REPLACE "canvasElements" "restartMode: \"RestartOnExit\", restartType: \"RestartModule\", restartLimit: 10000, canvasElements" UPDATED_WASM_RESTART_HTML "${WASM_RESTART_HTML}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html "${UPDATED_WASM_RESTART_HTML}")
When I Build&Run it for WebAssembly,
the Actual behaviour : after pressing on the "Quit App" button, the application is giving a Runtime Error :
RuntimeError: abort(Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)) at Error at jsStackTrace (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1827:19) at stackTrace (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1844:16) at abort (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :1530:44) at Object.get (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :261:7) at eval (eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14), :256:11) at eval () at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14) at http://localhost:30002/qtloader.js:332:13
Expected behaviour would be : after pressing on the "Quit App" button, the application should successfully restart.
Side note : It works with restartType: "ReloadPage"
, but I would like to avoid having to reload the page.
Side note 2 : It also works in case if I apply the following modifications on the WasmRestart.js file :
var calledRun;
=>
var calledRun = false;
function findEventTarget(target) {
target = maybeCStringToJsString(target);
if (target.length == 0) {
return null
}
function exposePublicSymbol(name, value, numArguments) {
if (Module.hasOwnProperty(name)) {
if (undefined === numArguments || (undefined !== Module[name].overloadTable && undefined !== Module[name].overloadTable[numArguments])) {
// throwBindingError("Cannot register public name '" + name + "' twice");
But I guess that these modifications could cause some issues.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论