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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11641005: Add cross-origin test with credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:collection'; 3 import 'dart:collection';
4 import 'dart:html_common'; 4 import 'dart:html_common';
5 import 'dart:indexed_db'; 5 import 'dart:indexed_db';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 import 'dart:json'; 7 import 'dart:json';
8 import 'dart:math'; 8 import 'dart:math';
9 import 'dart:svg' as svg; 9 import 'dart:svg' as svg;
10 import 'dart:web_audio' as web_audio; 10 import 'dart:web_audio' as web_audio;
(...skipping 24006 matching lines...) Expand 10 before | Expand all | Expand 10 after
24017 }; 24017 };
24018 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24018 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24019 // for details. All rights reserved. Use of this source code is governed by a 24019 // for details. All rights reserved. Use of this source code is governed by a
24020 // BSD-style license that can be found in the LICENSE file. 24020 // BSD-style license that can be found in the LICENSE file.
24021 24021
24022 24022
24023 class _HttpRequestUtils { 24023 class _HttpRequestUtils {
24024 24024
24025 // Helper for factory HttpRequest.get 24025 // Helper for factory HttpRequest.get
24026 static HttpRequest get(String url, 24026 static HttpRequest get(String url,
24027 onSuccess(HttpRequest request), 24027 onComplete(HttpRequest request),
24028 bool withCredentials) { 24028 bool withCredentials) {
24029 final request = new HttpRequest(); 24029 final request = new HttpRequest();
24030 request.open('GET', url, true); 24030 request.open('GET', url, true);
24031 24031
24032 request.withCredentials = withCredentials; 24032 request.withCredentials = withCredentials;
24033 24033
24034 // Status 0 is for local XHR request.
24035 request.on.readyStateChange.add((e) { 24034 request.on.readyStateChange.add((e) {
24036 if (request.readyState == HttpRequest.DONE && 24035 if (request.readyState == HttpRequest.DONE) {
24037 (request.status == 200 || request.status == 0)) { 24036 // TODO(efortuna): Previously HttpRequest.get only invoked the callback
24038 onSuccess(request); 24037 // when request.status was 0 or 200. This
24038 // causes two problems 1) request.status = 0 for ANY local XHR request
24039 // (file found or not found) 2) the user facing function claims that the
24040 // callback is called on completion of the request, regardless of
24041 // status. Because the new event model is coming in soon, rather than
24042 // fixing the callbacks version, we just need to revisit the desired
24043 // behavior when we're using streams/futures.
24044 // Status 0 is for local XHR request.
24045 onComplete(request);
24039 } 24046 }
24040 }); 24047 });
24041 24048
24042 request.send(); 24049 request.send();
24043 24050
24044 return request; 24051 return request;
24045 } 24052 }
24046 } 24053 }
24047 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24054 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24048 // for details. All rights reserved. Use of this source code is governed by a 24055 // for details. All rights reserved. Use of this source code is governed by a
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
25295 T next() { 25302 T next() {
25296 if (!hasNext) { 25303 if (!hasNext) {
25297 throw new StateError("No more elements"); 25304 throw new StateError("No more elements");
25298 } 25305 }
25299 return _array[_pos++]; 25306 return _array[_pos++];
25300 } 25307 }
25301 25308
25302 final List<T> _array; 25309 final List<T> _array;
25303 int _pos; 25310 int _pos;
25304 } 25311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698