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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (listener->IsFunction()) | 55 if (listener->IsFunction()) |
56 return v8::Local<v8::Function>::Cast(listener); | 56 return v8::Local<v8::Function>::Cast(listener); |
57 | 57 |
58 // The EventHandler callback function type (used for event handler | 58 // The EventHandler callback function type (used for event handler |
59 // attributes in HTML) has [TreatNonObjectAsNull], which implies that | 59 // attributes in HTML) has [TreatNonObjectAsNull], which implies that |
60 // non-function objects should be treated as no-op functions that return | 60 // non-function objects should be treated as no-op functions that return |
61 // undefined. | 61 // undefined. |
62 if (isAttribute()) | 62 if (isAttribute()) |
63 return v8::Local<v8::Function>(); | 63 return v8::Local<v8::Function>(); |
64 | 64 |
| 65 // Getting the handleEvent property can runs script in the getter. |
| 66 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 67 V8ThrowException::throwError(isolate(), "Script execution is forbidden."); |
| 68 return v8::Local<v8::Function>(); |
| 69 } |
| 70 |
65 if (listener->IsObject()) { | 71 if (listener->IsObject()) { |
66 // Check that no exceptions were thrown when getting the | 72 // Check that no exceptions were thrown when getting the |
67 // handleEvent property and that the value is a function. | 73 // handleEvent property and that the value is a function. |
68 v8::Local<v8::Value> property; | 74 v8::Local<v8::Value> property; |
69 if (listener | 75 if (listener |
70 ->Get(scriptState->context(), | 76 ->Get(scriptState->context(), |
71 v8AtomicString(isolate(), "handleEvent")) | 77 v8AtomicString(isolate(), "handleEvent")) |
72 .ToLocal(&property) && | 78 .ToLocal(&property) && |
73 property->IsFunction()) | 79 property->IsFunction()) |
74 return v8::Local<v8::Function>::Cast(property); | 80 return v8::Local<v8::Function>::Cast(property); |
(...skipping 29 matching lines...) Expand all Loading... |
104 v8::Local<v8::Value> result; | 110 v8::Local<v8::Value> result; |
105 if (!V8ScriptRunner::callFunction(handlerFunction, frame->document(), | 111 if (!V8ScriptRunner::callFunction(handlerFunction, frame->document(), |
106 receiver, WTF_ARRAY_LENGTH(parameters), | 112 receiver, WTF_ARRAY_LENGTH(parameters), |
107 parameters, scriptState->isolate()) | 113 parameters, scriptState->isolate()) |
108 .ToLocal(&result)) | 114 .ToLocal(&result)) |
109 return v8::Local<v8::Value>(); | 115 return v8::Local<v8::Value>(); |
110 return result; | 116 return result; |
111 } | 117 } |
112 | 118 |
113 } // namespace blink | 119 } // namespace blink |
OLD | NEW |