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

Side by Side Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 70963003: IDL compiler: addEventListener, removeEventListener methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Other test Created 7 years, 1 month 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 3087 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 3098
3099 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo) 3099 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo)
3100 { 3100 {
3101 EventTarget* impl = V8TestObject::toNative(info.Holder()); 3101 EventTarget* impl = V8TestObject::toNative(info.Holder());
3102 if (DOMWindow* window = impl->toDOMWindow()) { 3102 if (DOMWindow* window = impl->toDOMWindow()) {
3103 ExceptionState es(info.GetIsolate()); 3103 ExceptionState es(info.GetIsolate());
3104 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), es)) { 3104 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), es)) {
3105 es.throwIfNeeded(); 3105 es.throwIfNeeded();
3106 return; 3106 return;
3107 } 3107 }
3108
3109 if (!window->document()) 3108 if (!window->document())
3110 return; 3109 return;
3111 } 3110 }
3112
3113 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOrCreate); 3111 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOrCreate);
3114 if (listener) { 3112 if (listener) {
3115 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, st ringResource, info[0]); 3113 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, st ringResource, info[0]);
3116 impl->addEventListener(stringResource, listener, info[2]->BooleanValue() ); 3114 impl->addEventListener(stringResource, listener, info[2]->BooleanValue() );
3117 if (!impl->toNode()) 3115 if (!impl->toNode())
3118 createHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate()); 3116 createHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate());
3119 } 3117 }
3120 } 3118 }
3121 3119
3122 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 3120 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
3123 { 3121 {
3124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3125 TestObjV8Internal::addEventListenerMethod(info); 3123 TestObjV8Internal::addEventListenerMethod(info);
3126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3127 } 3125 }
3128 3126
3129 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 3127 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
3130 { 3128 {
3131 EventTarget* impl = V8TestObject::toNative(info.Holder()); 3129 EventTarget* impl = V8TestObject::toNative(info.Holder());
3132 if (DOMWindow* window = impl->toDOMWindow()) { 3130 if (DOMWindow* window = impl->toDOMWindow()) {
3133 ExceptionState es(info.GetIsolate()); 3131 ExceptionState es(info.GetIsolate());
3134 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), es)) { 3132 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), es)) {
3135 es.throwIfNeeded(); 3133 es.throwIfNeeded();
3136 return; 3134 return;
3137 } 3135 }
3138
3139 if (!window->document()) 3136 if (!window->document())
3140 return; 3137 return;
3141 } 3138 }
3142
3143 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOnly); 3139 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOnly);
3144 if (listener) { 3140 if (listener) {
3145 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, st ringResource, info[0]); 3141 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, st ringResource, info[0]);
3146 impl->removeEventListener(stringResource, listener.get(), info[2]->Boole anValue()); 3142 impl->removeEventListener(stringResource, listener.get(), info[2]->Boole anValue());
3147 if (!impl->toNode()) 3143 if (!impl->toNode())
3148 removeHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate()); 3144 removeHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate());
3149 } 3145 }
3150 } 3146 }
3151 3147
3152 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 3148 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5280 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &wrapperTypeInf o, wrapper, isolate, WrapperConfiguration::Independent); 5276 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &wrapperTypeInf o, wrapper, isolate, WrapperConfiguration::Independent);
5281 return wrapper; 5277 return wrapper;
5282 } 5278 }
5283 5279
5284 void V8TestObject::derefObject(void* object) 5280 void V8TestObject::derefObject(void* object)
5285 { 5281 {
5286 fromInternalPointer(object)->deref(); 5282 fromInternalPointer(object)->deref();
5287 } 5283 }
5288 5284
5289 } // namespace WebCore 5285 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698