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