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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 1094713003: Fix XMLHTTPRequest JS type in _loadHunk (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library _js_helper; 5 library _js_helper;
6 6
7 import 'dart:_async_await_error_codes' as async_error_codes; 7 import 'dart:_async_await_error_codes' as async_error_codes;
8 8
9 import 'dart:_js_embedded_names' show 9 import 'dart:_js_embedded_names' show
10 DEFERRED_LIBRARY_URIS, 10 DEFERRED_LIBRARY_URIS,
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after
3539 } 3539 }
3540 } else if (isWorker()) { 3540 } else if (isWorker()) {
3541 // We are in a web worker. Load the code with an XMLHttpRequest. 3541 // We are in a web worker. Load the code with an XMLHttpRequest.
3542 enterJsAsync(); 3542 enterJsAsync();
3543 Future<Null> leavingFuture = completer.future.whenComplete(() { 3543 Future<Null> leavingFuture = completer.future.whenComplete(() {
3544 leaveJsAsync(); 3544 leaveJsAsync();
3545 }); 3545 });
3546 3546
3547 int index = uri.lastIndexOf('/'); 3547 int index = uri.lastIndexOf('/');
3548 uri = '${uri.substring(0, index + 1)}$hunkName'; 3548 uri = '${uri.substring(0, index + 1)}$hunkName';
3549 var xhr = JS('dynamic', 'new XMLHttpRequest()'); 3549 var xhr = JS('var', 'new XMLHttpRequest()');
3550 JS('void', '#.open("GET", #)', xhr, uri); 3550 JS('void', '#.open("GET", #)', xhr, uri);
3551 JS('void', '#.addEventListener("load", #, false)', 3551 JS('void', '#.addEventListener("load", #, false)',
3552 xhr, convertDartClosureToJS((event) { 3552 xhr, convertDartClosureToJS((event) {
3553 if (JS('int', '#.status', xhr) != 200) { 3553 if (JS('int', '#.status', xhr) != 200) {
3554 failure(""); 3554 failure("");
3555 } 3555 }
3556 String code = JS('String', '#.responseText', xhr); 3556 String code = JS('String', '#.responseText', xhr);
3557 try { 3557 try {
3558 // Create a new function to avoid getting access to current function 3558 // Create a new function to avoid getting access to current function
3559 // context. 3559 // context.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
3976 // This is a function that will return a helper function that does the 3976 // This is a function that will return a helper function that does the
3977 // iteration of the sync*. 3977 // iteration of the sync*.
3978 // 3978 //
3979 // Each invocation should give a body with fresh state. 3979 // Each invocation should give a body with fresh state.
3980 final dynamic /* js function */ _outerHelper; 3980 final dynamic /* js function */ _outerHelper;
3981 3981
3982 SyncStarIterable(this._outerHelper); 3982 SyncStarIterable(this._outerHelper);
3983 3983
3984 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); 3984 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper));
3985 } 3985 }
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