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