[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

ggaren at apple.com ggaren at apple.com
Thu Apr 8 01:13:42 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit a88680991d73e21c25860680b458f6158a925c76
Author: ggaren at apple.com <ggaren at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 18 22:12:12 2010 +0000

    2010-01-18  Geoffrey Garen  <ggaren at apple.com>
    
            Reviewed by Darin Adler.
    
            Removed unnecessary use of scriptExecutionContext() when creating a JS event listener.
            https://bugs.webkit.org/show_bug.cgi?id=33811
    
            This change simplifies a bunch of code, and also reduces
            the number of places that use the difficult-to-understand and possibly
            crashy-null scriptExecutionContext() idiom.
    
            * bindings/js/JSDOMGlobalObject.cpp:
            * bindings/js/JSDOMGlobalObject.h:
            * bindings/js/JSEventListener.h:
            (WebCore::createJSAttributeEventListener):
            * bindings/scripts/CodeGeneratorJS.pm:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 43272ae..349f389 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-18  Geoffrey Garen  <ggaren at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Removed unnecessary use of scriptExecutionContext() when creating a JS event listener.
+        https://bugs.webkit.org/show_bug.cgi?id=33811
+
+        This change simplifies a bunch of code, and also reduces
+        the number of places that use the difficult-to-understand and possibly
+        crashy-null scriptExecutionContext() idiom.
+
+        * bindings/js/JSDOMGlobalObject.cpp:
+        * bindings/js/JSDOMGlobalObject.h:
+        * bindings/js/JSEventListener.h:
+        (WebCore::createJSAttributeEventListener):
+        * bindings/scripts/CodeGeneratorJS.pm:
+
 2010-01-18  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bindings/js/JSDOMGlobalObject.cpp b/WebCore/bindings/js/JSDOMGlobalObject.cpp
index 124ff50..8310fd1 100644
--- a/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -61,14 +61,6 @@ void JSDOMGlobalObject::markChildren(MarkStack& markStack)
         markStack.append(d()->m_injectedScript);
 }
 
-PassRefPtr<JSEventListener> JSDOMGlobalObject::createJSAttributeEventListener(JSValue val)
-{
-    if (!val.isObject())
-        return 0;
-
-    return JSEventListener::create(asObject(val), true, currentWorld(globalExec())).get();
-}
-
 void JSDOMGlobalObject::setCurrentEvent(Event* evt)
 {
     d()->evt = evt;
diff --git a/WebCore/bindings/js/JSDOMGlobalObject.h b/WebCore/bindings/js/JSDOMGlobalObject.h
index a55cc31..a5d410e 100644
--- a/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -54,10 +54,6 @@ namespace WebCore {
 
         virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
 
-        // Creates a JS EventListener for an "onXXX" event attribute. These
-        // listeners cannot be removed through the removeEventListener API.
-        PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::JSValue);
-
         // Make binding code generation easier.
         JSDOMGlobalObject* globalObject() { return this; }
 
diff --git a/WebCore/bindings/js/JSEventListener.h b/WebCore/bindings/js/JSEventListener.h
index bf3af48..9ba09c6 100644
--- a/WebCore/bindings/js/JSEventListener.h
+++ b/WebCore/bindings/js/JSEventListener.h
@@ -66,6 +66,16 @@ namespace WebCore {
         RefPtr<DOMWrapperWorld> m_isolatedWorld;
     };
 
+    // Creates a JS EventListener for an "onXXX" event attribute.
+    inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener)
+    {
+        if (!listener.isObject())
+            return 0;
+
+        return JSEventListener::create(asObject(listener), true, currentWorld(exec));
+    }
+
+
 } // namespace WebCore
 
 #endif // JSEventListener_h
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index cab34ed..aaf8587 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1477,16 +1477,7 @@ sub GenerateImplementation
                             $implIncludes{"JSEventListener.h"} = 1;
                             push(@implContent, "    UNUSED_PARAM(exec);\n");
                             push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n");
-                            if ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
-                                push(@implContent, "    JSDOMGlobalObject* globalObject = static_cast<$className*>(thisObject);\n");
-                            } else {
-                                $implIncludes{"Frame.h"} = 1;
-                                $implIncludes{"JSDOMGlobalObject.h"} = 1;
-                                push(@implContent, "    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec);\n");
-                                push(@implContent, "    if (!globalObject)\n");
-                                push(@implContent, "        return;\n");
-                            }
-                            push(@implContent, "    imp->set$implSetterFunctionName(globalObject->createJSAttributeEventListener(value));\n");
+                            push(@implContent, "    imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value));\n");
                         } elsif ($attribute->signature->type =~ /Constructor$/) {
                             my $constructorType = $attribute->signature->type;
                             $constructorType =~ s/Constructor$//;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list