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

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: Rebase 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
« no previous file with comments | « Source/bindings/v8/custom/V8TextTrackCueCustom.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..855f64e16bfe193b828a813d80756b8ad421e54b 100644
--- a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -164,33 +164,35 @@ void V8XMLHttpRequest::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value
if (info.Length() < 2) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
- } else {
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
+ exceptionState.throwIfNeeded();
+ 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();
« no previous file with comments | « Source/bindings/v8/custom/V8TextTrackCueCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698