title: WebAssembly - App Restart gives "RuntimeError: abort(Module.arguments has been replaced with plain arguments_"
body: <p>I am trying to use the following WebAssembly module configuration :</p>
  <pre><code>restartMode: &quot;RestartOnExit&quot;,
  restartType: &quot;RestartModule&quot;,
  restartLimit: 10000
  </code></pre>
  <p>I freshly created a new Qt Quick Empty Application using Qt Creator.
  I only added this to main.cpp :</p>
  <pre><code>QObject::connect(&amp;engine, &amp;QQmlApplicationEngine::quit, &amp;QGuiApplication::quit);
  </code></pre>
  <p>this to main.qml :</p>
  <pre><code>Button {
          anchors.centerIn: parent
          text: &quot;Quit App&quot;
          onClicked: {
              Qt.callLater(Qt.quit)
          }
      }
  </code></pre>
  <p>and this to CMakeLists.txt :</p>
  <pre><code>#This comes after the `qt_finalize_executable` call : 
  
  #Update the *.html, to configure `restartMode: &quot;RestartOnExit&quot;`, and `restartType: &quot;RestartModule&quot;1, and restartLimit: 10000`
  FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html WASM_RESTART_HTML)
  STRING(REGEX REPLACE &quot;canvasElements&quot; &quot;restartMode: \&quot;RestartOnExit\&quot;, restartType: \&quot;RestartModule\&quot;, restartLimit: 10000, canvasElements&quot; UPDATED_WASM_RESTART_HTML &quot;${WASM_RESTART_HTML}&quot;)
  FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/WasmRestart.html &quot;${UPDATED_WASM_RESTART_HTML}&quot;)
  </code></pre>
  <p>When I Build&amp;Run it for WebAssembly,
  the <strong>Actual behaviour</strong> : after pressing on the &quot;Quit App&quot; button, the application is <strong>giving a Runtime Error</strong> :</p>
  <pre><code>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 &amp;#40;eval at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14&amp;#41;, :256:11) at eval &amp;#40;&amp;#41; at completeLoadEmscriptenModule (http://localhost:30002/qtloader.js:443:14) at http://localhost:30002/qtloader.js:332:13
  </code></pre>
  <p><a href="https://i.stack.imgur.com/jRS2S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jRS2S.png" alt="Runtime Error" /></a></p>
  <p><strong>Expected behaviour</strong> would be : after pressing on the &quot;Quit App&quot; button, the application should successfully restart.</p>
  <p>Side note : It works with <code>restartType: &quot;ReloadPage&quot;</code>, but I would like to avoid having to reload the page.</p>
  <p>Side note 2 : It also works in case if I apply the following modifications on the WasmRestart.js file :</p>
  <ol>
  <li><a href="https://i.stack.imgur.com/c48oS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c48oS.png" alt="modification 1" /></a></li>
  <li></li>
  </ol>
  <pre><code>var calledRun;
   =&gt;
  var calledRun = false;
  </code></pre>
  <ol start="3">
  <li></li>
  </ol>
  <pre><code>  function findEventTarget(target) {
        target = maybeCStringToJsString(target);
        if (target.length == 0) {
          return null
        }
  </code></pre>
  <ol start="4">
  <li></li>
  </ol>
  <pre><code>  function exposePublicSymbol(name, value, numArguments) {
        if (Module.hasOwnProperty(name)) {
            if (undefined === numArguments || (undefined !== Module[name].overloadTable &amp;&amp; undefined !== Module[name].overloadTable[numArguments])) {
                // throwBindingError(&quot;Cannot register public name '&quot; + name + &quot;' twice&quot;);
  </code></pre>
  <p>But I guess that these modifications could cause some issues.</p>