| Index: dart/lib/compiler/implementation/js_backend/emitter.dart
|
| diff --git a/dart/lib/compiler/implementation/js_backend/emitter.dart b/dart/lib/compiler/implementation/js_backend/emitter.dart
|
| index 85cd4919ed4fe15daf750437849cd527e5c07895..cab4254dae64991801d2c0a9604b651dbc42bc1c 100644
|
| --- a/dart/lib/compiler/implementation/js_backend/emitter.dart
|
| +++ b/dart/lib/compiler/implementation/js_backend/emitter.dart
|
| @@ -1226,15 +1226,31 @@ $mainEnsureGetter
|
| mainCall = '${namer.isolateAccess(main)}()';
|
| }
|
| buffer.add("""
|
| +
|
| +//
|
| +// BEGIN invoke [main].
|
| +//
|
| if (typeof document != 'undefined' && document.readyState != 'complete') {
|
| document.addEventListener('readystatechange', function () {
|
| if (document.readyState == 'complete') {
|
| - ${mainCall};
|
| + if (typeof dartMainRunner == 'function') {
|
| + dartMainRunner(function() { ${mainCall}; });
|
| + } else {
|
| + ${mainCall};
|
| + }
|
| }
|
| }, false);
|
| } else {
|
| - ${mainCall};
|
| + if (typeof dartMainRunner == 'function') {
|
| + dartMainRunner(function() { ${mainCall}; });
|
| + } else {
|
| + ${mainCall};
|
| + }
|
| }
|
| +//
|
| +// END invoke [main].
|
| +//
|
| +
|
| """);
|
| }
|
|
|
|
|