| 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 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 Loading... |
| 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 |
| OLD | NEW |