diff --git a/js-assembler/package.rkt b/js-assembler/package.rkt index f73845c..14391cc 100644 --- a/js-assembler/package.rkt +++ b/js-assembler/package.rkt @@ -267,16 +267,14 @@ MACHINE.modules[~s] = (") (assemble/write-invoke stmts op) (fprintf op ")(MACHINE, - function() { - if (window.console && window.console.log) { - window.console.log('loaded ' + ~s); - } - plt.runtime.setReadyTrue(); - }, - function(err) { - alert(err.message) - }, - PARAMS); + function() { + if (window.console && window.console.log) { + window.console.log('loaded ' + ~s); + } + plt.runtime.setReadyTrue(); + }, + FAIL, + PARAMS); });\n" (format "~a" (source-name src))) (define stop-time (current-inexact-milliseconds)) @@ -289,8 +287,11 @@ MACHINE.modules[~s] = (define (on-last-src) - (fprintf op "plt.runtime.setReadyTrue();") - (fprintf op "SUCCESS();")) + (fprintf op "plt.runtime.ready( + function() { + plt.runtime.setReadyTrue(); + SUCCESS(); + });")) (define packaging-configuration @@ -310,7 +311,7 @@ MACHINE.modules[~s] = (fprintf op "var invoke = (function(MACHINE, SUCCESS, FAIL, PARAMS) {") (fprintf op " plt.runtime.ready(function() {") - (fprintf op "plt.runtime.setReadyFalse();") + (fprintf op " plt.runtime.setReadyFalse();") (make (list (make-MainModuleSource source-code)) packaging-configuration) (fprintf op " });"); diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index 2fb936b..030b441 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -585,7 +585,7 @@ // setReadyTrue is called. var ready, setReadyTrue, setReadyFalse; (function() { - var runtimeIsReady = false; + var runtimeIsReady = true; var readyWaiters = []; var notifyWaiter = function(w) { w(); diff --git a/tests/browser-harness.rkt b/tests/browser-harness.rkt index eb5ed9d..1f25cf4 100644 --- a/tests/browser-harness.rkt +++ b/tests/browser-harness.rkt @@ -42,8 +42,12 @@ return (function(succ, fail, params) { } }; return innerInvoke(machine, - function() { plt.runtime.invokeMains(machine, succ, fail); }, - function(MACHINE, e) { fail(e); }, + function() { + plt.runtime.invokeMains(machine, succ, fail); + }, + function(MACHINE, e) { + return fail(e); + }, myParams); }); }); diff --git a/tests/test-browser-evaluate.rkt b/tests/test-browser-evaluate.rkt index 38232bd..7f36949 100644 --- a/tests/test-browser-evaluate.rkt +++ b/tests/test-browser-evaluate.rkt @@ -26,11 +26,12 @@ (fprintf op #<