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

Unified Diff: Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
diff --git a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index d5709cc7015db0e30c14cdc721415ee62c067818..415b10785b5902ed4812048a1219b070b7bbe4b8 100644
--- a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -163,34 +163,35 @@ void V8XMLHttpRequest::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value
ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "XMLHttpRequest", info.Holder(), info.GetIsolate());
if (info.Length() < 2) {
- exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
- } else {
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
+ exceptionState.notEnoughArguments(2, info.Length());
+ return;
+ }
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, method, info[0]);
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, urlstring, info[1]);
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
- ExecutionContext* context = getExecutionContext();
- KURL url = context->completeURL(urlstring);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, method, info[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, urlstring, info[1]);
- if (info.Length() >= 3) {
- bool async = info[2]->BooleanValue();
+ ExecutionContext* context = getExecutionContext();
+ KURL url = context->completeURL(urlstring);
+
+ if (info.Length() >= 3) {
+ bool async = info[2]->BooleanValue();
- if (info.Length() >= 4 && !info[3]->IsUndefined()) {
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, user, info[3]);
+ if (info.Length() >= 4 && !info[3]->IsUndefined()) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, user, info[3]);
- if (info.Length() >= 5 && !info[4]->IsUndefined()) {
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, password, info[4]);
- xmlHttpRequest->open(method, url, async, user, password, exceptionState);
- } else {
- xmlHttpRequest->open(method, url, async, user, exceptionState);
- }
+ if (info.Length() >= 5 && !info[4]->IsUndefined()) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, password, info[4]);
+ xmlHttpRequest->open(method, url, async, user, password, exceptionState);
} else {
- xmlHttpRequest->open(method, url, async, exceptionState);
+ xmlHttpRequest->open(method, url, async, user, exceptionState);
}
} else {
- xmlHttpRequest->open(method, url, exceptionState);
+ xmlHttpRequest->open(method, url, async, exceptionState);
}
+ } else {
+ xmlHttpRequest->open(method, url, exceptionState);
}
exceptionState.throwIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698