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

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

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry); 272 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry);
273 } 273 }
274 return result; 274 return result;
275 } 275 }
276 276
277 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 277 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info)
278 { 278 {
279 if (info.Length() < 1) 279 if (info.Length() < 1)
280 return; 280 return;
281 281
282 EventTarget* target = 0; 282
283 v8::Local<v8::Value> value = info[0]; 283 v8::Local<v8::Value> value = info[0];
284 284 EventTarget* target = V8EventTarget::toNativeWithTypeCheck(info.GetIsolate() , value);
285 if (V8EventTarget::hasInstance(value, info.GetIsolate()))
286 target = V8EventTarget::toNative(value->ToObject());
287 285
288 // We need to handle a DOMWindow specially, because a DOMWindow wrapper exis ts on a prototype chain. 286 // We need to handle a DOMWindow specially, because a DOMWindow wrapper exis ts on a prototype chain.
289 if (!target) 287 if (!target)
290 target = toDOMWindow(value, info.GetIsolate()); 288 target = toDOMWindow(value, info.GetIsolate());
291 289
292 if (!target || !target->executionContext()) 290 if (!target || !target->executionContext())
293 return; 291 return;
294 292
295 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); 293 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder());
296 Vector<EventListenerInfo> listenersArray; 294 Vector<EventListenerInfo> listenersArray;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 int lineNumber; 419 int lineNumber;
422 int columnNumber; 420 int columnNumber;
423 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) 421 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber))
424 return; 422 return;
425 423
426 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); 424 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder());
427 host->unmonitorFunction(scriptId, lineNumber, columnNumber); 425 host->unmonitorFunction(scriptId, lineNumber, columnNumber);
428 } 426 }
429 427
430 } // namespace WebCore 428 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8DocumentCustom.cpp ('k') | Source/bindings/v8/custom/V8NodeCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698