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

Unified Diff: dart/sdk/lib/_internal/lib/async_patch.dart

Issue 23678006: Don't rely on script.async in deferred loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update status file Created 7 years, 4 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
« no previous file with comments | « no previous file | dart/tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/lib/async_patch.dart
diff --git a/dart/sdk/lib/_internal/lib/async_patch.dart b/dart/sdk/lib/_internal/lib/async_patch.dart
index 236ebfaa1232ea50fc9bfb736fce83ddfc0269a2..850d4e65ef42da763cf990ad0299767975cefeaa 100644
--- a/dart/sdk/lib/_internal/lib/async_patch.dart
+++ b/dart/sdk/lib/_internal/lib/async_patch.dart
@@ -71,9 +71,8 @@ Future<bool> _load(String libraryName, String uri) {
});
}
- Completer completer = new Completer<bool>();
- _loadedLibraries[libraryName] = completer.future;
- try {
+ return _loadedLibraries[libraryName] = new Future<bool>(() {
+ Completer completer = new Completer<bool>();
if (uri == null) {
uri = IsolateNatives.thisScript;
int index = uri.lastIndexOf('/');
@@ -83,16 +82,14 @@ Future<bool> _load(String libraryName, String uri) {
// Inject a script tag.
var script = JS('', 'document.createElement("script")');
JS('', '#.type = "text/javascript"', script);
- JS('', '#.async = "async"', script);
JS('', '#.src = #', script, uri);
var onLoad = JS('', '#.bind(null, #)',
DART_CLOSURE_TO_JS(_onDeferredLibraryLoad), completer);
JS('', '#.addEventListener("load", #, false)', script, onLoad);
JS('', 'document.body.appendChild(#)', script);
- } catch (e, trace) {
- completer.completeError(e, trace);
- }
- return completer.future;
+
+ return completer.future;
+ });
}
/// Used to implement deferred loading. Used as callback on "load"
« no previous file with comments | « no previous file | dart/tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698