| OLD | NEW |
| 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A utility for retrieving data from a URL. | 8 * A utility for retrieving data from a URL. |
| 9 * | 9 * |
| 10 * HttpRequest can be used to obtain data from http, ftp, and file | 10 * HttpRequest can be used to obtain data from http, ftp, and file |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 return completer.future; | 123 return completer.future; |
| 124 } | 124 } |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Checks to see if the Progress event is supported on the current platform. | 127 * Checks to see if the Progress event is supported on the current platform. |
| 128 */ | 128 */ |
| 129 static bool get supportsProgressEvent { | 129 static bool get supportsProgressEvent { |
| 130 $if DART2JS | 130 $if DART2JS |
| 131 var xhr = new HttpRequest(); | 131 var xhr = new HttpRequest(); |
| 132 return JS('bool', '("onprogress" in #)', xhr); | 132 return JS('bool', '"onprogress" in #', xhr); |
| 133 $else | 133 $else |
| 134 return true; | 134 return true; |
| 135 $endif | 135 $endif |
| 136 } | |
| 137 | |
| 138 /** | |
| 139 * Checks to see if the current platform supports making cross origin | |
| 140 * requests. | |
| 141 * | |
| 142 * Note that even if cross origin requests are supported, they still may fail | |
| 143 * if the destination server does not support CORS requests. | |
| 144 */ | |
| 145 static bool get supportsCrossOrigin { | |
| 146 $if DART2JS | |
| 147 var xhr = new HttpRequest(); | |
| 148 return JS('bool', '("withCredentials" in #)', xhr); | |
| 149 $else | |
| 150 return true; | |
| 151 $endif | |
| 152 } | 136 } |
| 153 | 137 |
| 154 /** | 138 /** |
| 155 * Checks to see if the LoadEnd event is supported on the current platform. | 139 * Checks to see if the LoadEnd event is supported on the current platform. |
| 156 */ | 140 */ |
| 157 static bool get supportsLoadEndEvent { | 141 static bool get supportsLoadEndEvent { |
| 158 $if DART2JS | 142 $if DART2JS |
| 159 var xhr = new HttpRequest(); | 143 var xhr = new HttpRequest(); |
| 160 return JS('bool', '("onloadend" in #)', xhr); | 144 return JS('bool', '"onloadend" in #', xhr); |
| 161 $else | 145 $else |
| 162 return true; | 146 return true; |
| 163 $endif | 147 $endif |
| 164 } | 148 } |
| 165 | 149 |
| 166 $!MEMBERS | 150 $!MEMBERS |
| 167 } | 151 } |
| OLD | NEW |