| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // handleEvent property and that the value is a function. | 62 // handleEvent property and that the value is a function. |
| 63 if (!property.IsEmpty() && property->IsFunction()) | 63 if (!property.IsEmpty() && property->IsFunction()) |
| 64 return v8::Local<v8::Function>::Cast(property); | 64 return v8::Local<v8::Function>::Cast(property); |
| 65 } | 65 } |
| 66 | 66 |
| 67 return v8::Local<v8::Function>(); | 67 return v8::Local<v8::Function>(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 v8::Local<v8::Value> V8EventListener::callListenerFunction(v8::Handle<v8::Value>
jsEvent, Event* event) | 70 v8::Local<v8::Value> V8EventListener::callListenerFunction(v8::Handle<v8::Value>
jsEvent, Event* event) |
| 71 { | 71 { |
| 72 | |
| 73 v8::Local<v8::Function> handlerFunction = getListenerFunction(scriptState()-
>executionContext()); | 72 v8::Local<v8::Function> handlerFunction = getListenerFunction(scriptState()-
>executionContext()); |
| 74 v8::Local<v8::Object> receiver = getReceiverObject(event); | 73 v8::Local<v8::Object> receiver = getReceiverObject(event); |
| 75 if (handlerFunction.IsEmpty() || receiver.IsEmpty()) | 74 if (handlerFunction.IsEmpty() || receiver.IsEmpty()) |
| 76 return v8::Local<v8::Value>(); | 75 return v8::Local<v8::Value>(); |
| 77 | 76 |
| 78 if (!scriptState()->executionContext()->isDocument()) | 77 if (!scriptState()->executionContext()->isDocument()) |
| 79 return v8::Local<v8::Value>(); | 78 return v8::Local<v8::Value>(); |
| 80 | 79 |
| 81 LocalFrame* frame = toDocument(scriptState()->executionContext())->frame(); | 80 LocalFrame* frame = toDocument(scriptState()->executionContext())->frame(); |
| 82 if (!frame) | 81 if (!frame) |
| 83 return v8::Local<v8::Value>(); | 82 return v8::Local<v8::Value>(); |
| 84 | 83 |
| 85 if (!frame->script().canExecuteScripts(AboutToExecuteScript)) | 84 if (!frame->script().canExecuteScripts(AboutToExecuteScript)) |
| 86 return v8::Local<v8::Value>(); | 85 return v8::Local<v8::Value>(); |
| 87 | 86 |
| 88 v8::Handle<v8::Value> parameters[1] = { jsEvent }; | 87 v8::Handle<v8::Value> parameters[1] = { jsEvent }; |
| 89 return frame->script().callFunction(handlerFunction, receiver, WTF_ARRAY_LEN
GTH(parameters), parameters); | 88 return frame->script().callFunction(handlerFunction, receiver, WTF_ARRAY_LEN
GTH(parameters), parameters); |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace WebCore | 91 } // namespace WebCore |
| OLD | NEW |