OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Google Inc. 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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "V8XMLHttpRequest.h" | 32 #include "V8XMLHttpRequest.h" |
33 | 33 |
34 #include "V8ArrayBufferView.h" | 34 #include "V8ArrayBufferView.h" |
35 #include "V8Blob.h" | 35 #include "V8Blob.h" |
36 #include "V8Document.h" | 36 #include "V8Document.h" |
37 #include "V8FormData.h" | 37 #include "V8FormData.h" |
38 #include "V8HTMLDocument.h" | 38 #include "V8HTMLDocument.h" |
| 39 #include "V8Stream.h" |
39 #include "bindings/v8/V8Binding.h" | 40 #include "bindings/v8/V8Binding.h" |
40 #include "bindings/v8/V8Utilities.h" | 41 #include "bindings/v8/V8Utilities.h" |
41 #include "bindings/v8/custom/V8ArrayBufferCustom.h" | 42 #include "bindings/v8/custom/V8ArrayBufferCustom.h" |
42 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
| 44 #include "core/fileapi/Stream.h" |
43 #include "core/inspector/InspectorInstrumentation.h" | 45 #include "core/inspector/InspectorInstrumentation.h" |
44 #include "core/page/Frame.h" | 46 #include "core/page/Frame.h" |
45 #include "core/workers/WorkerGlobalScope.h" | 47 #include "core/workers/WorkerGlobalScope.h" |
46 #include "core/xml/XMLHttpRequest.h" | 48 #include "core/xml/XMLHttpRequest.h" |
47 #include "wtf/ArrayBuffer.h" | 49 #include "wtf/ArrayBuffer.h" |
48 | 50 |
49 namespace WebCore { | 51 namespace WebCore { |
50 | 52 |
51 void V8XMLHttpRequest::constructorCustom(const v8::FunctionCallbackInfo<v8::Valu
e>& args) | 53 void V8XMLHttpRequest::constructorCustom(const v8::FunctionCallbackInfo<v8::Valu
e>& args) |
52 { | 54 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ExceptionCode ec = 0; | 110 ExceptionCode ec = 0; |
109 Blob* blob = xmlHttpRequest->responseBlob(ec); | 111 Blob* blob = xmlHttpRequest->responseBlob(ec); |
110 if (ec) { | 112 if (ec) { |
111 setDOMException(ec, info.GetIsolate()); | 113 setDOMException(ec, info.GetIsolate()); |
112 return; | 114 return; |
113 } | 115 } |
114 v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest)); | 116 v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest)); |
115 return; | 117 return; |
116 } | 118 } |
117 | 119 |
| 120 case XMLHttpRequest::ResponseTypeStream: |
| 121 { |
| 122 ExceptionCode ec = 0; |
| 123 Stream* stream = xmlHttpRequest->responseStream(ec); |
| 124 if (ec) { |
| 125 setDOMException(ec, info.GetIsolate()); |
| 126 return; |
| 127 } |
| 128 v8SetReturnValue(info, toV8Fast(stream, info, xmlHttpRequest)); |
| 129 return; |
| 130 } |
| 131 |
118 case XMLHttpRequest::ResponseTypeArrayBuffer: | 132 case XMLHttpRequest::ResponseTypeArrayBuffer: |
119 { | 133 { |
120 ExceptionCode ec = 0; | 134 ExceptionCode ec = 0; |
121 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec); | 135 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec); |
122 if (ec) { | 136 if (ec) { |
123 setDOMException(ec, info.GetIsolate()); | 137 setDOMException(ec, info.GetIsolate()); |
124 return; | 138 return; |
125 } | 139 } |
126 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { | 140 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { |
127 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb
server::instance()); | 141 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb
server::instance()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); | 240 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); |
227 } | 241 } |
228 | 242 |
229 if (!ec) | 243 if (!ec) |
230 return; | 244 return; |
231 | 245 |
232 setDOMException(ec, args.GetIsolate()); | 246 setDOMException(ec, args.GetIsolate()); |
233 } | 247 } |
234 | 248 |
235 } // namespace WebCore | 249 } // namespace WebCore |
OLD | NEW |