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

Side by Side Diff: lib/dom/src/_XMLHttpRequestUtils.dart

Issue 10831314: Don't auto-send credentials on XHR.get (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test status for dart2js Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 class _XMLHttpRequestUtils { 5 class _XMLHttpRequestUtils {
6 6
7 // Helper for factory XMLHttpRequest.get 7 // Helper for factory XMLHttpRequest.get
8 static XMLHttpRequest get(String url, 8 static XMLHttpRequest get(String url,
9 onSuccess(XMLHttpRequest request)) { 9 onSuccess(XMLHttpRequest request),
10 bool withCredentials) {
10 final request = new XMLHttpRequest(); 11 final request = new XMLHttpRequest();
11 request.open('GET', url, true); 12 request.open('GET', url, true);
12 13
13 // TODO(terry): Validate after client login added if necessary to forward 14 request.withCredentials = withCredentials;
14 // cookies to server.
15 request.withCredentials = true;
16 15
17 // Status 0 is for local XHR request. 16 // Status 0 is for local XHR request.
18 request.on.readyStateChange.add((e) { 17 request.on.readyStateChange.add((e) {
19 if (request.readyState == XMLHttpRequest.DONE && 18 if (request.readyState == XMLHttpRequest.DONE &&
20 (request.status == 200 || request.status == 0)) { 19 (request.status == 200 || request.status == 0)) {
21 onSuccess(request); 20 onSuccess(request);
22 } 21 }
23 }); 22 });
24 23
25 request.send(); 24 request.send();
26 25
27 return request; 26 return request;
28 } 27 }
29 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698