OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 class _XMLHttpRequestUtils { | |
6 | |
7 // Helper for factory XMLHttpRequest.getTEMPNAME | |
8 static XMLHttpRequest getTEMPNAME(String url, | |
9 onSuccess(XMLHttpRequest request)) { | |
10 final request = new XMLHttpRequest(); | |
11 request.open('GET', url, true); | |
12 | |
13 // TODO(terry): Validate after client login added if necessary to forward | |
14 // cookies to server. | |
15 request.withCredentials = true; | |
16 | |
17 // Status 0 is for local XHR request. | |
18 request.on.readyStateChange.add((e) { | |
19 if (request.readyState == XMLHttpRequest.DONE && | |
20 (request.status == 200 || request.status == 0)) { | |
21 onSuccess(request); | |
22 } | |
23 }); | |
24 | |
25 request.send(); | |
26 | |
27 return request; | |
28 } | |
29 } | |
OLD | NEW |