Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: dart/lib/compiler/implementation/js_backend/emitter.dart

Issue 10919098: Run dart2js tests unmodified in browser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use messages Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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].
+//
+
""");
}

Powered by Google App Engine
This is Rietveld 408576698