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

Side by Side Diff: sdk/lib/html/dartium/html_dartium.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:nativewrappers'; 8 import 'dart:nativewrappers';
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 28626 matching lines...) Expand 10 before | Expand all | Expand 10 after
28637 }; 28637 };
28638 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 28638 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
28639 // for details. All rights reserved. Use of this source code is governed by a 28639 // for details. All rights reserved. Use of this source code is governed by a
28640 // BSD-style license that can be found in the LICENSE file. 28640 // BSD-style license that can be found in the LICENSE file.
28641 28641
28642 28642
28643 class _HttpRequestUtils { 28643 class _HttpRequestUtils {
28644 28644
28645 // Helper for factory HttpRequest.get 28645 // Helper for factory HttpRequest.get
28646 static HttpRequest get(String url, 28646 static HttpRequest get(String url,
28647 onSuccess(HttpRequest request), 28647 onComplete(HttpRequest request),
28648 bool withCredentials) { 28648 bool withCredentials) {
28649 final request = new HttpRequest(); 28649 final request = new HttpRequest();
28650 request.open('GET', url, true); 28650 request.open('GET', url, true);
28651 28651
28652 request.withCredentials = withCredentials; 28652 request.withCredentials = withCredentials;
28653 28653
28654 // Status 0 is for local XHR request.
28655 request.on.readyStateChange.add((e) { 28654 request.on.readyStateChange.add((e) {
28656 if (request.readyState == HttpRequest.DONE && 28655 if (request.readyState == HttpRequest.DONE) {
28657 (request.status == 200 || request.status == 0)) { 28656 // TODO(efortuna): Previously HttpRequest.get only invoked the callback
28658 onSuccess(request); 28657 // when request.status was 0 or 200. This
28658 // causes two problems 1) request.status = 0 for ANY local XHR request
28659 // (file found or not found) 2) the user facing function claims that the
28660 // callback is called on completion of the request, regardless of
28661 // status. Because the new event model is coming in soon, rather than
28662 // fixing the callbacks version, we just need to revisit the desired
28663 // behavior when we're using streams/futures.
28664 // Status 0 is for local XHR request.
28665 onComplete(request);
28659 } 28666 }
28660 }); 28667 });
28661 28668
28662 request.send(); 28669 request.send();
28663 28670
28664 return request; 28671 return request;
28665 } 28672 }
28666 } 28673 }
28667 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 28674 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
28668 // for details. All rights reserved. Use of this source code is governed by a 28675 // for details. All rights reserved. Use of this source code is governed by a
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
29754 bool get isEmpty => Maps.isEmpty(this); 29761 bool get isEmpty => Maps.isEmpty(this);
29755 } 29762 }
29756 29763
29757 get _printClosure => (s) { 29764 get _printClosure => (s) {
29758 try { 29765 try {
29759 window.console.log(s); 29766 window.console.log(s);
29760 } catch (_) { 29767 } catch (_) {
29761 _Utils.print(s); 29768 _Utils.print(s);
29762 } 29769 }
29763 }; 29770 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698