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

Side by Side Diff: Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp

Issue 1034453002: [bindings] Remove custom binding usage from XMLHttpRequest.open() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: isEmpty => isNull Created 5 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/xmlhttprequest/XMLHttpRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 case XMLHttpRequest::ResponseTypeArrayBuffer: 149 case XMLHttpRequest::ResponseTypeArrayBuffer:
150 { 150 {
151 DOMArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); 151 DOMArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer();
152 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest); 152 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest);
153 return; 153 return;
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 void V8XMLHttpRequest::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& info)
159 {
160 // Four cases:
161 // open(method, url)
162 // open(method, url, async)
163 // open(method, url, async, user)
164 // open(method, url, async, user, passwd)
165
166 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "XML HttpRequest", info.Holder(), info.GetIsolate());
167
168 if (info.Length() < 2) {
169 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
170 exceptionState.throwIfNeeded();
171 return;
172 }
173
174 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toImpl(info.Holder());
175
176 TOSTRING_VOID(V8StringResource<>, method, info[0]);
177 TOSTRING_VOID(V8StringResource<>, urlstring, info[1]);
178
179 ExecutionContext* context = currentExecutionContext(info.GetIsolate());
180 KURL url = context->completeURL(urlstring);
181
182 if (info.Length() >= 3) {
183 bool async = info[2]->BooleanValue();
184
185 if (info.Length() >= 4 && !info[3]->IsUndefined()) {
186 TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, user, info[3] );
187
188 if (info.Length() >= 5 && !info[4]->IsUndefined()) {
189 TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, password, info[4]);
190 xmlHttpRequest->open(method, url, async, user, password, excepti onState);
191 } else {
192 xmlHttpRequest->open(method, url, async, user, exceptionState);
193 }
194 } else {
195 xmlHttpRequest->open(method, url, async, exceptionState);
196 }
197 } else {
198 xmlHttpRequest->open(method, url, exceptionState);
199 }
200
201 exceptionState.throwIfNeeded();
202 }
203
204 } // namespace blink 158 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/xmlhttprequest/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698