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

Side by Side Diff: Source/bindings/v8/V8EventListener.cpp

Issue 22687002: Treat non-callable input as null for EventHandler attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 4 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
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | no next file » | 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 v8::Local<v8::Object> listener = getListenerObject(context); 48 v8::Local<v8::Object> listener = getListenerObject(context);
49 49
50 // Has the listener been disposed? 50 // Has the listener been disposed?
51 if (listener.IsEmpty()) 51 if (listener.IsEmpty())
52 return v8::Local<v8::Function>(); 52 return v8::Local<v8::Function>();
53 53
54 if (listener->IsFunction()) 54 if (listener->IsFunction())
55 return v8::Local<v8::Function>::Cast(listener); 55 return v8::Local<v8::Function>::Cast(listener);
56 56
57 if (listener->IsObject()) { 57 if (listener->IsObject()) {
58 ASSERT_WITH_MESSAGE(!isAttribute(), "EventHandler attributes should only accept JS Functions as input.");
58 v8::Local<v8::Value> property = listener->Get(v8::String::NewSymbol("han dleEvent")); 59 v8::Local<v8::Value> property = listener->Get(v8::String::NewSymbol("han dleEvent"));
59 // Check that no exceptions were thrown when getting the 60 // Check that no exceptions were thrown when getting the
60 // handleEvent property and that the value is a function. 61 // handleEvent property and that the value is a function.
61 if (!property.IsEmpty() && property->IsFunction()) 62 if (!property.IsEmpty() && property->IsFunction())
62 return v8::Local<v8::Function>::Cast(property); 63 return v8::Local<v8::Function>::Cast(property);
63 } 64 }
64 65
65 return v8::Local<v8::Function>(); 66 return v8::Local<v8::Function>();
66 } 67 }
67 68
(...skipping 17 matching lines...) Expand all
85 return v8::Local<v8::Value>(); 86 return v8::Local<v8::Value>();
86 87
87 if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) 88 if (!frame->script()->canExecuteScripts(AboutToExecuteScript))
88 return v8::Local<v8::Value>(); 89 return v8::Local<v8::Value>();
89 90
90 v8::Handle<v8::Value> parameters[1] = { jsEvent }; 91 v8::Handle<v8::Value> parameters[1] = { jsEvent };
91 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE NGTH(parameters), parameters); 92 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE NGTH(parameters), parameters);
92 } 93 }
93 94
94 } // namespace WebCore 95 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698