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

Side by Side Diff: lib/compiler/implementation/emitter.dart

Issue 10763002: Revert "Make sure we do not try to run main() before the document has been fully loaded." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 String mainCall = null; 981 String mainCall = null;
982 if (compiler.isolateLibrary != null) { 982 if (compiler.isolateLibrary != null) {
983 Element isolateMain = 983 Element isolateMain =
984 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); 984 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE);
985 mainCall = buildIsolateSetup(buffer, main, isolateMain); 985 mainCall = buildIsolateSetup(buffer, main, isolateMain);
986 } else { 986 } else {
987 mainCall = '${namer.isolateAccess(main)}()'; 987 mainCall = '${namer.isolateAccess(main)}()';
988 } 988 }
989 buffer.add(""" 989 buffer.add("""
990 if (typeof window != 'undefined' && typeof document != 'undefined' && 990 if (typeof window != 'undefined' && typeof document != 'undefined' &&
991 window.addEventListener && document.readyState != 'complete') { 991 window.addEventListener && document.readyState == 'loading') {
992 window.addEventListener('DOMContentLoaded', function(e) { 992 window.addEventListener('DOMContentLoaded', function(e) {
993 ${mainCall}; 993 ${mainCall};
994 }); 994 });
995 } else { 995 } else {
996 ${mainCall}; 996 ${mainCall};
997 } 997 }
998 """); 998 """);
999 } 999 }
1000 1000
1001 String assembleProgram() { 1001 String assembleProgram() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 null, sourceMap, new api.Diagnostic(-1, 'source map')); 1055 null, sourceMap, new api.Diagnostic(-1, 'source map'));
1056 } 1056 }
1057 }); 1057 });
1058 return compiler.assembledCode; 1058 return compiler.assembledCode;
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 typedef void DefineMemberFunction(String invocationName, 1062 typedef void DefineMemberFunction(String invocationName,
1063 String definition, 1063 String definition,
1064 [List<SourceMappingEntry> sourceMappings]); 1064 [List<SourceMappingEntry> sourceMappings]);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698