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

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

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } else { 191 } else {
192 xmlHttpRequest->open(method, url, async, exceptionState); 192 xmlHttpRequest->open(method, url, async, exceptionState);
193 } 193 }
194 } else { 194 } else {
195 xmlHttpRequest->open(method, url, exceptionState); 195 xmlHttpRequest->open(method, url, exceptionState);
196 } 196 }
197 197
198 exceptionState.throwIfNeeded(); 198 exceptionState.throwIfNeeded();
199 } 199 }
200 200
201 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)
202 { 202 {
203 // FIXME: add other document types. 203 // FIXME: add other document types.
204 return V8Document::hasInstance(value, isolate, currentWorldType) || V8HTMLDo cument::hasInstance(value, isolate, currentWorldType); 204 return V8Document::hasInstance(value, isolate) || V8HTMLDocument::hasInstanc e(value, isolate);
205 } 205 }
206 206
207 void V8XMLHttpRequest::sendMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& info) 207 void V8XMLHttpRequest::sendMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& info)
208 { 208 {
209 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); 209 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
210 210
211 InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->executionCo ntext(), xmlHttpRequest->url()); 211 InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->executionCo ntext(), xmlHttpRequest->url());
212 212
213 ExceptionState exceptionState(ExceptionState::ExecutionContext, "send", "XML HttpRequest", info.Holder(), info.GetIsolate()); 213 ExceptionState exceptionState(ExceptionState::ExecutionContext, "send", "XML HttpRequest", info.Holder(), info.GetIsolate());
214 if (info.Length() < 1) 214 if (info.Length() < 1)
215 xmlHttpRequest->send(exceptionState); 215 xmlHttpRequest->send(exceptionState);
216 else { 216 else {
217 v8::Handle<v8::Value> arg = info[0]; 217 v8::Handle<v8::Value> arg = info[0];
218 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
219 if (isUndefinedOrNull(arg)) { 218 if (isUndefinedOrNull(arg)) {
220 xmlHttpRequest->send(exceptionState); 219 xmlHttpRequest->send(exceptionState);
221 } else if (isDocumentType(arg, info.GetIsolate(), currentWorldType)) { 220 } else if (isDocumentType(arg, info.GetIsolate())) {
222 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); 221 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
223 Document* document = V8Document::toNative(object); 222 Document* document = V8Document::toNative(object);
224 ASSERT(document); 223 ASSERT(document);
225 xmlHttpRequest->send(document, exceptionState); 224 xmlHttpRequest->send(document, exceptionState);
226 } else if (V8Blob::hasInstance(arg, info.GetIsolate(), currentWorldType) ) { 225 } else if (V8Blob::hasInstance(arg, info.GetIsolate())) {
227 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); 226 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
228 Blob* blob = V8Blob::toNative(object); 227 Blob* blob = V8Blob::toNative(object);
229 ASSERT(blob); 228 ASSERT(blob);
230 xmlHttpRequest->send(blob, exceptionState); 229 xmlHttpRequest->send(blob, exceptionState);
231 } else if (V8FormData::hasInstance(arg, info.GetIsolate(), currentWorldT ype)) { 230 } else if (V8FormData::hasInstance(arg, info.GetIsolate())) {
232 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); 231 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
233 DOMFormData* domFormData = V8FormData::toNative(object); 232 DOMFormData* domFormData = V8FormData::toNative(object);
234 ASSERT(domFormData); 233 ASSERT(domFormData);
235 xmlHttpRequest->send(domFormData, exceptionState); 234 xmlHttpRequest->send(domFormData, exceptionState);
236 } else if (V8ArrayBuffer::hasInstance(arg, info.GetIsolate(), currentWor ldType)) { 235 } else if (V8ArrayBuffer::hasInstance(arg, info.GetIsolate())) {
237 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); 236 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
238 ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); 237 ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object);
239 ASSERT(arrayBuffer); 238 ASSERT(arrayBuffer);
240 xmlHttpRequest->send(arrayBuffer, exceptionState); 239 xmlHttpRequest->send(arrayBuffer, exceptionState);
241 } else if (V8ArrayBufferView::hasInstance(arg, info.GetIsolate(), curren tWorldType)) { 240 } else if (V8ArrayBufferView::hasInstance(arg, info.GetIsolate())) {
242 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); 241 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
243 ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(objec t); 242 ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(objec t);
244 ASSERT(arrayBufferView); 243 ASSERT(arrayBufferView);
245 xmlHttpRequest->send(arrayBufferView, exceptionState); 244 xmlHttpRequest->send(arrayBufferView, exceptionState);
246 } else { 245 } else {
247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck> , argString, arg); 246 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck> , argString, arg);
248 xmlHttpRequest->send(argString, exceptionState); 247 xmlHttpRequest->send(argString, exceptionState);
249 } 248 }
250 } 249 }
251 250
252 exceptionState.throwIfNeeded(); 251 exceptionState.throwIfNeeded();
253 } 252 }
254 253
255 } // namespace WebCore 254 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp ('k') | Source/core/platform/chromium/support/WebArrayBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698