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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/xmlhttprequest/XMLHttpRequest.h" | 47 #include "core/xmlhttprequest/XMLHttpRequest.h" |
48 #include <v8.h> | 48 #include <v8.h> |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 void V8XMLHttpRequest::responseTextAttributeGetterCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) | 52 void V8XMLHttpRequest::responseTextAttributeGetterCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
53 { | 53 { |
54 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toImpl(info.Holder()); | 54 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toImpl(info.Holder()); |
55 ExceptionState exceptionState(ExceptionState::GetterContext, "responseText",
"XMLHttpRequest", info.Holder(), info.GetIsolate()); | 55 ExceptionState exceptionState(ExceptionState::GetterContext, "responseText",
"XMLHttpRequest", info.Holder(), info.GetIsolate()); |
56 ScriptString text = xmlHttpRequest->responseText(exceptionState); | 56 ScriptString text = xmlHttpRequest->responseText(exceptionState); |
57 if (exceptionState.throwIfNeeded()) | |
58 return; | |
59 if (text.isEmpty()) { | 57 if (text.isEmpty()) { |
60 v8SetReturnValueString(info, emptyString(), info.GetIsolate()); | 58 v8SetReturnValueString(info, emptyString(), info.GetIsolate()); |
61 return; | 59 return; |
62 } | 60 } |
63 v8SetReturnValue(info, text.v8Value()); | 61 v8SetReturnValue(info, text.v8Value()); |
64 } | 62 } |
65 | 63 |
66 void V8XMLHttpRequest::responseAttributeGetterCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 64 void V8XMLHttpRequest::responseAttributeGetterCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
67 { | 65 { |
68 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toImpl(info.Holder()); | 66 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toImpl(info.Holder()); |
(...skipping 22 matching lines...) Expand all Loading... |
91 v8SetReturnValue(info, json); | 89 v8SetReturnValue(info, json); |
92 else | 90 else |
93 v8SetReturnValue(info, v8::Null(isolate)); | 91 v8SetReturnValue(info, v8::Null(isolate)); |
94 return; | 92 return; |
95 } | 93 } |
96 | 94 |
97 case XMLHttpRequest::ResponseTypeDocument: | 95 case XMLHttpRequest::ResponseTypeDocument: |
98 { | 96 { |
99 ExceptionState exceptionState(ExceptionState::GetterContext, "respon
se", "XMLHttpRequest", info.Holder(), info.GetIsolate()); | 97 ExceptionState exceptionState(ExceptionState::GetterContext, "respon
se", "XMLHttpRequest", info.Holder(), info.GetIsolate()); |
100 Document* document = xmlHttpRequest->responseXML(exceptionState); | 98 Document* document = xmlHttpRequest->responseXML(exceptionState); |
101 if (exceptionState.throwIfNeeded()) | |
102 return; | |
103 v8SetReturnValueFast(info, document, xmlHttpRequest); | 99 v8SetReturnValueFast(info, document, xmlHttpRequest); |
104 return; | 100 return; |
105 } | 101 } |
106 | 102 |
107 case XMLHttpRequest::ResponseTypeBlob: | 103 case XMLHttpRequest::ResponseTypeBlob: |
108 { | 104 { |
109 Blob* blob = xmlHttpRequest->responseBlob(); | 105 Blob* blob = xmlHttpRequest->responseBlob(); |
110 v8SetReturnValueFast(info, blob, xmlHttpRequest); | 106 v8SetReturnValueFast(info, blob, xmlHttpRequest); |
111 return; | 107 return; |
112 } | 108 } |
113 | 109 |
114 case XMLHttpRequest::ResponseTypeLegacyStream: | 110 case XMLHttpRequest::ResponseTypeLegacyStream: |
115 { | 111 { |
116 Stream* stream = xmlHttpRequest->responseLegacyStream(); | 112 Stream* stream = xmlHttpRequest->responseLegacyStream(); |
117 v8SetReturnValueFast(info, stream, xmlHttpRequest); | 113 v8SetReturnValueFast(info, stream, xmlHttpRequest); |
118 return; | 114 return; |
119 } | 115 } |
120 | 116 |
121 case XMLHttpRequest::ResponseTypeArrayBuffer: | 117 case XMLHttpRequest::ResponseTypeArrayBuffer: |
122 { | 118 { |
123 DOMArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); | 119 DOMArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); |
124 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest); | 120 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest); |
125 return; | 121 return; |
126 } | 122 } |
127 } | 123 } |
128 } | 124 } |
129 | 125 |
130 } // namespace blink | 126 } // namespace blink |
OLD | NEW |