Changeset 53430 in webkit
- Timestamp:
- Jan 18, 2010 2:12:12 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53429 r53430 1 2010-01-18 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Removed unnecessary use of scriptExecutionContext() when creating a JS event listener. 6 https://bugs.webkit.org/show_bug.cgi?id=33811 7 8 This change simplifies a bunch of code, and also reduces 9 the number of places that use the difficult-to-understand and possibly 10 crashy-null scriptExecutionContext() idiom. 11 12 * bindings/js/JSDOMGlobalObject.cpp: 13 * bindings/js/JSDOMGlobalObject.h: 14 * bindings/js/JSEventListener.h: 15 (WebCore::createJSAttributeEventListener): 16 * bindings/scripts/CodeGeneratorJS.pm: 17 1 18 2010-01-18 Alexey Proskuryakov <ap@apple.com> 2 19 -
trunk/WebCore/bindings/js/JSDOMGlobalObject.cpp
r53119 r53430 60 60 if (d()->m_injectedScript) 61 61 markStack.append(d()->m_injectedScript); 62 }63 64 PassRefPtr<JSEventListener> JSDOMGlobalObject::createJSAttributeEventListener(JSValue val)65 {66 if (!val.isObject())67 return 0;68 69 return JSEventListener::create(asObject(val), true, currentWorld(globalExec())).get();70 62 } 71 63 -
trunk/WebCore/bindings/js/JSDOMGlobalObject.h
r53119 r53430 54 54 55 55 virtual ScriptExecutionContext* scriptExecutionContext() const = 0; 56 57 // Creates a JS EventListener for an "onXXX" event attribute. These58 // listeners cannot be removed through the removeEventListener API.59 PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::JSValue);60 56 61 57 // Make binding code generation easier. -
trunk/WebCore/bindings/js/JSEventListener.h
r49963 r53430 67 67 }; 68 68 69 // Creates a JS EventListener for an "onXXX" event attribute. 70 inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener) 71 { 72 if (!listener.isObject()) 73 return 0; 74 75 return JSEventListener::create(asObject(listener), true, currentWorld(exec)); 76 } 77 78 69 79 } // namespace WebCore 70 80 -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r53170 r53430 1478 1478 push(@implContent, " UNUSED_PARAM(exec);\n"); 1479 1479 push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n"); 1480 if ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { 1481 push(@implContent, " JSDOMGlobalObject* globalObject = static_cast<$className*>(thisObject);\n"); 1482 } else { 1483 $implIncludes{"Frame.h"} = 1; 1484 $implIncludes{"JSDOMGlobalObject.h"} = 1; 1485 push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec);\n"); 1486 push(@implContent, " if (!globalObject)\n"); 1487 push(@implContent, " return;\n"); 1488 } 1489 push(@implContent, " imp->set$implSetterFunctionName(globalObject->createJSAttributeEventListener(value));\n"); 1480 push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value));\n"); 1490 1481 } elsif ($attribute->signature->type =~ /Constructor$/) { 1491 1482 my $constructorType = $attribute->signature->type;
Note: See TracChangeset
for help on using the changeset viewer.