aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/preamble.js3
-rwxr-xr-xtests/runner.py6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index fa86fca6..cb01994f 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -871,7 +871,8 @@ function removeRunDependency(id) {
clearInterval(runDependencyWatcher);
runDependencyWatcher = null;
}
- if (!calledRun) run();
+ // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
+ if (!calledRun && shouldRunNow) run();
}
}
Module['removeRunDependency'] = removeRunDependency;
diff --git a/tests/runner.py b/tests/runner.py
index 2d4146a9..2ba1ede1 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8788,9 +8788,13 @@ f.close()
self.assertNotContained('pre-run\nhello from main\npost-run\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
# noInitialRun prevents run
- for no_initial_run in [0, 1]:
+ for no_initial_run, run_dep in [(0, 0), (1, 0), (0, 1), (1, 1)]:
+ print no_initial_run, run_dep
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')]).communicate()
src = 'var Module = { noInitialRun: %d };\n' % no_initial_run + open(os.path.join(self.get_dir(), 'a.out.js')).read()
+ if run_dep:
+ src = src.replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\naddRunDependency("test");') \
+ .replace('// {{POST_RUN_ADDITIONS}}', '// {{POST_RUN_ADDITIONS}}\nremoveRunDependency("test");')
open(os.path.join(self.get_dir(), 'a.out.js'), 'w').write(src)
assert ('hello from main' in run_js(os.path.join(self.get_dir(), 'a.out.js'))) != no_initial_run, 'only run if no noInitialRun'