| OLD | NEW |
| 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 Loading... |
| 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 // EventHandler attributes should only accept JS Functions as input. |
| 59 ASSERT(!isAttribute()); |
| 58 v8::Local<v8::Value> property = listener->Get(v8::String::NewSymbol("han
dleEvent")); | 60 v8::Local<v8::Value> property = listener->Get(v8::String::NewSymbol("han
dleEvent")); |
| 59 // Check that no exceptions were thrown when getting the | 61 // Check that no exceptions were thrown when getting the |
| 60 // handleEvent property and that the value is a function. | 62 // handleEvent property and that the value is a function. |
| 61 if (!property.IsEmpty() && property->IsFunction()) | 63 if (!property.IsEmpty() && property->IsFunction()) |
| 62 return v8::Local<v8::Function>::Cast(property); | 64 return v8::Local<v8::Function>::Cast(property); |
| 63 } | 65 } |
| 64 | 66 |
| 65 return v8::Local<v8::Function>(); | 67 return v8::Local<v8::Function>(); |
| 66 } | 68 } |
| 67 | 69 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 85 return v8::Local<v8::Value>(); | 87 return v8::Local<v8::Value>(); |
| 86 | 88 |
| 87 if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) | 89 if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) |
| 88 return v8::Local<v8::Value>(); | 90 return v8::Local<v8::Value>(); |
| 89 | 91 |
| 90 v8::Handle<v8::Value> parameters[1] = { jsEvent }; | 92 v8::Handle<v8::Value> parameters[1] = { jsEvent }; |
| 91 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE
NGTH(parameters), parameters); | 93 return frame->script()->callFunction(handlerFunction, receiver, WTF_ARRAY_LE
NGTH(parameters), parameters); |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace WebCore | 96 } // namespace WebCore |
| OLD | NEW |