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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Four cases: | 157 // Four cases: |
158 // open(method, url) | 158 // open(method, url) |
159 // open(method, url, async) | 159 // open(method, url, async) |
160 // open(method, url, async, user) | 160 // open(method, url, async, user) |
161 // open(method, url, async, user, passwd) | 161 // open(method, url, async, user, passwd) |
162 | 162 |
163 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "XML
HttpRequest", info.Holder(), info.GetIsolate()); | 163 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "XML
HttpRequest", info.Holder(), info.GetIsolate()); |
164 | 164 |
165 if (info.Length() < 2) { | 165 if (info.Length() < 2) { |
166 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 166 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
167 } else { | 167 exceptionState.throwIfNeeded(); |
168 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder(
)); | 168 return; |
| 169 } |
169 | 170 |
170 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, method, info[0]
); | 171 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); |
171 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, urlstring, info
[1]); | |
172 | 172 |
173 ExecutionContext* context = getExecutionContext(); | 173 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, method, info[0]); |
174 KURL url = context->completeURL(urlstring); | 174 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, urlstring, info[1])
; |
175 | 175 |
176 if (info.Length() >= 3) { | 176 ExecutionContext* context = getExecutionContext(); |
177 bool async = info[2]->BooleanValue(); | 177 KURL url = context->completeURL(urlstring); |
178 | 178 |
179 if (info.Length() >= 4 && !info[3]->IsUndefined()) { | 179 if (info.Length() >= 3) { |
180 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCh
eck>, user, info[3]); | 180 bool async = info[2]->BooleanValue(); |
181 | 181 |
182 if (info.Length() >= 5 && !info[4]->IsUndefined()) { | 182 if (info.Length() >= 4 && !info[3]->IsUndefined()) { |
183 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNu
llCheck>, password, info[4]); | 183 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>
, user, info[3]); |
184 xmlHttpRequest->open(method, url, async, user, password, exc
eptionState); | 184 |
185 } else { | 185 if (info.Length() >= 5 && !info[4]->IsUndefined()) { |
186 xmlHttpRequest->open(method, url, async, user, exceptionStat
e); | 186 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCh
eck>, password, info[4]); |
187 } | 187 xmlHttpRequest->open(method, url, async, user, password, excepti
onState); |
188 } else { | 188 } else { |
189 xmlHttpRequest->open(method, url, async, exceptionState); | 189 xmlHttpRequest->open(method, url, async, user, exceptionState); |
190 } | 190 } |
191 } else { | 191 } else { |
192 xmlHttpRequest->open(method, url, exceptionState); | 192 xmlHttpRequest->open(method, url, async, exceptionState); |
193 } | 193 } |
| 194 } else { |
| 195 xmlHttpRequest->open(method, url, exceptionState); |
194 } | 196 } |
195 | 197 |
196 exceptionState.throwIfNeeded(); | 198 exceptionState.throwIfNeeded(); |
197 } | 199 } |
198 | 200 |
199 static bool isDocumentType(v8::Handle<v8::Value> value, v8::Isolate* isolate, Wr
apperWorldType currentWorldType) | 201 static bool isDocumentType(v8::Handle<v8::Value> value, v8::Isolate* isolate, Wr
apperWorldType currentWorldType) |
200 { | 202 { |
201 // FIXME: add other document types. | 203 // FIXME: add other document types. |
202 return V8Document::hasInstance(value, isolate, currentWorldType) || V8HTMLDo
cument::hasInstance(value, isolate, currentWorldType); | 204 return V8Document::hasInstance(value, isolate, currentWorldType) || V8HTMLDo
cument::hasInstance(value, isolate, currentWorldType); |
203 } | 205 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } else { | 246 } else { |
245 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>
, argString, arg); | 247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>
, argString, arg); |
246 xmlHttpRequest->send(argString, exceptionState); | 248 xmlHttpRequest->send(argString, exceptionState); |
247 } | 249 } |
248 } | 250 } |
249 | 251 |
250 exceptionState.throwIfNeeded(); | 252 exceptionState.throwIfNeeded(); |
251 } | 253 } |
252 | 254 |
253 } // namespace WebCore | 255 } // namespace WebCore |
OLD | NEW |