WebAssembly - App Restart gives "RuntimeError: abort(Module.arguments has been replaced with plain arguments_"

668 views Asked by At

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

Runtime Error

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 :

  1. modification 1
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.

0

There are 0 answers