Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 return; | 212 return; |
| 213 } | 213 } |
| 214 | 214 |
| 215 fail: | 215 fail: |
| 216 Dart_ThrowException(exception); | 216 Dart_ThrowException(exception); |
| 217 ASSERT_NOT_REACHED(); | 217 ASSERT_NOT_REACHED(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void responseGetter(Dart_NativeArguments args) | 220 void responseGetter(Dart_NativeArguments args) |
| 221 { | 221 { |
| 222 // FIXME: implement. | 222 DartApiScope dartApiScope; |
| 223 DART_UNIMPLEMENTED(); | 223 Dart_Handle exception; |
| 224 { | |
| 225 XMLHttpRequest* receiver = DartDOMWrapper::receiver<XMLHttpRequest>(args ); | |
| 226 | |
| 227 switch (receiver->responseTypeCode()) { | |
| 228 case XMLHttpRequest::ResponseTypeDefault: | |
| 229 case XMLHttpRequest::ResponseTypeText: | |
| 230 { | |
| 231 ExceptionCode ec = 0; | |
| 232 String result = receiver->responseText(ec); | |
| 233 if (UNLIKELY(ec)) { | |
| 234 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ; | |
| 235 goto fail; | |
| 236 } | |
| 237 Dart_SetReturnValue(args, DartUtilities::stringToDart(result)); | |
| 238 return; | |
| 239 } | |
| 240 | |
| 241 case XMLHttpRequest::ResponseTypeDocument: | |
| 242 { | |
| 243 ExceptionCode ec = 0; | |
| 244 Document* document = receiver->responseXML(ec); | |
| 245 if (UNLIKELY(ec)) { | |
| 246 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ; | |
| 247 goto fail; | |
| 248 } | |
| 249 DartDOMWrapper::returnValue<DartDocument>(args, document); | |
| 250 return; | |
| 251 } | |
| 252 | |
| 253 case XMLHttpRequest::ResponseTypeBlob: | |
| 254 #if ENABLE(XHR_RESPONSE_BLOB) | |
| 255 { | |
| 256 ExceptionCode ec = 0; | |
| 257 Blob* blob = receiver->responseBlob(ec); | |
| 258 if (UNLIKELY(ec)) { | |
| 259 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ; | |
| 260 goto fail; | |
| 261 } | |
| 262 DartDOMWrapper::returnValue<DartBlob>(args, blob); | |
| 263 return; | |
| 264 } | |
| 265 #else | |
|
podivilov
2012/04/26 18:02:54
Please replace #else with #endif.
Anton Muhin
2012/04/26 18:35:05
Done.
| |
| 266 return; | |
| 267 #endif | |
| 268 | |
| 269 case XMLHttpRequest::ResponseTypeArrayBuffer: | |
| 270 { | |
| 271 ExceptionCode ec = 0; | |
| 272 ArrayBuffer* arrayBuffer = receiver->responseArrayBuffer(ec); | |
| 273 if (UNLIKELY(ec)) { | |
| 274 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ; | |
| 275 goto fail; | |
| 276 } | |
| 277 DartDOMWrapper::returnValue<DartArrayBuffer>(args, arrayBuffer); | |
| 278 return; | |
| 279 } | |
| 280 } | |
| 281 | |
| 282 return; | |
| 283 } | |
| 284 | |
| 285 fail: | |
| 286 Dart_ThrowException(exception); | |
| 287 ASSERT_NOT_REACHED(); | |
| 224 } | 288 } |
| 225 | 289 |
| 226 } // DartXMLHttpRequestInternal | 290 } // DartXMLHttpRequestInternal |
| 227 | 291 |
| 228 } // WebCore | 292 } // WebCore |
| OLD | NEW |