From d2f680e7a4eee462dd487e6482c8ee4c27f7c6bb Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 12 May 2011 15:10:11 -0700 Subject: [PATCH] clean up shell.js --- src/postamble.js | 9 ++++++++- src/shell.js | 11 +++++++++-- tests/runner.py | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/postamble.js b/src/postamble.js index cb0521aa5..4943b9e8d 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -21,6 +21,8 @@ Module.callMain = function callMain(args) { } function run(args) { + args = args || Module.arguments; + __initializeRuntime__(); var globalFuncs = []; @@ -39,8 +41,13 @@ Module['run'] = run; // {{PRE_RUN_ADDITIONS}} #if INVOKE_RUN -run(args); +#else +Module.noInitialRun = true; #endif +if (!Module.noInitialRun) { + run(); +} + // {{POST_RUN_ADDITIONS}} diff --git a/src/shell.js b/src/shell.js index 3b762e181..f18fc3cae 100644 --- a/src/shell.js +++ b/src/shell.js @@ -6,8 +6,15 @@ // args = args || []; // Runs much faster, for some reason -this['Module'] = {}; -var args = arguments; +if (!this['Module']) { + this['Module'] = {}; +} +try { + Module.arguments = arguments; +} catch(e) { + Module.arguments = []; +} + {{BODY}} // {{MODULE_ADDITIONS}} diff --git a/tests/runner.py b/tests/runner.py index 667fd16d7..ea9b2f941 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2411,7 +2411,7 @@ else: USE_CLOSURE_COMPILER = 1 - TEST_REPS = 10 + TEST_REPS = 3 TOTAL_TESTS = 4 tests_done = 0