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

Side by Side Diff: Source/WebCore/bindings/dart/custom/DartXMLHttpRequestCustom.cpp

Issue 10224007: Port XMLHttpRequest.response. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 responseTextGetter(args);
podivilov 2012/04/26 15:12:57 What if responseTextGetter will throw an exception
Anton Muhin 2012/04/26 16:35:17 Thanks a lot for spotting, fixed. On 2012/04/26 1
231 return;
232
233 case XMLHttpRequest::ResponseTypeDocument:
234 {
235 ExceptionCode ec = 0;
236 Document* document = receiver->responseXML(ec);
237 if (UNLIKELY(ec)) {
238 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ;
239 goto fail;
240 }
241 DartDOMWrapper::returnValue<DartDocument>(args, document);
242 return;
243 }
244
245 case XMLHttpRequest::ResponseTypeBlob:
246 #if ENABLE(XHR_RESPONSE_BLOB)
247 {
248 ExceptionCode ec = 0;
249 Blob* blob = receiver->responseBlob(ec);
250 if (UNLIKELY(ec)) {
251 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ;
252 goto fail;
253 }
254 DartDOMWrapper::returnValue<DartBlob>(args, blob);
255 return;
256 }
257 #else
258 return v8::Undefined();
podivilov 2012/04/26 15:12:57 Huh?
Anton Muhin 2012/04/26 16:35:17 D'oh, done.
259 #endif
260
261 case XMLHttpRequest::ResponseTypeArrayBuffer:
262 {
263 ExceptionCode ec = 0;
264 ArrayBuffer* arrayBuffer = receiver->responseArrayBuffer(ec);
265 if (UNLIKELY(ec)) {
266 exception = DartDOMWrapper::exceptionCodeToDartException(ec) ;
267 goto fail;
268 }
269 DartDOMWrapper::returnValue<DartArrayBuffer>(args, arrayBuffer);
270 return;
271 }
272 }
273
274 return;
275 }
276
277 fail:
278 Dart_ThrowException(exception);
279 ASSERT_NOT_REACHED();
224 } 280 }
225 281
226 } // DartXMLHttpRequestInternal 282 } // DartXMLHttpRequestInternal
227 283
228 } // WebCore 284 } // WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698