[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

jamesr at google.com jamesr at google.com
Sun Feb 20 23:28:22 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit e364bab1d37d315f2076c1ea877fc76d8f1e3278
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 21:39:52 2011 +0000

    2011-01-20  James Robinson  <jamesr at chromium.org>
    
            Reviewed by Nate Chapin.
    
            [v8] CodeGeneratorV8 generates incorrect code for callbacks with no parameters
            https://bugs.webkit.org/show_bug.cgi?id=52837
    
            When generating code to invoke a callback with no parameters CodeGeneratorV8.pm was generating the following:
            v8::Handle<v8::Value> argv[] = {}; which does not compile in visual studio.  Instead, if the argument count
            is 0, we can just pass a NULL pointer for the argv parameter.
    
            Test added to bindings/scripts/test/TestCallback.idl and covered by run-bindings-tests.  This
            patch also includes some spurious changes to the bindings tests golden files (mostly GObject)
            because the old golden files were out of date.
    
            * bindings/scripts/CodeGeneratorV8.pm:
            * bindings/scripts/test/CPP/WebDOMTestCallback.cpp:
            (WebDOMTestCallback::callbackWithNoParam):
            * bindings/scripts/test/CPP/WebDOMTestCallback.h:
            * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp:
            (webkit_dom_test_callback_callback_with_no_param):
            * bindings/scripts/test/GObject/WebKitDOMTestCallback.h:
            * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp:
            * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp:
            * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
            * bindings/scripts/test/JS/JSTestCallback.cpp:
            (WebCore::JSTestCallback::callbackWithNoParam):
            * bindings/scripts/test/JS/JSTestCallback.h:
            * bindings/scripts/test/JS/JSTestInterface.cpp:
            * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
            * bindings/scripts/test/JS/JSTestObj.cpp:
            * bindings/scripts/test/ObjC/DOMTestCallback.h:
            * bindings/scripts/test/ObjC/DOMTestCallback.mm:
            (-[DOMTestCallback callbackWithNoParam]):
            * bindings/scripts/test/TestCallback.idl:
            * bindings/scripts/test/V8/V8TestCallback.cpp:
            (WebCore::V8TestCallback::callbackWithNoParam):
            * bindings/scripts/test/V8/V8TestCallback.h:
            * bindings/scripts/test/V8/V8TestObj.cpp:
            (WebCore::TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 6eb8cb7..9dc78ae 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,46 @@
 2011-01-20  James Robinson  <jamesr at chromium.org>
 
+        Reviewed by Nate Chapin.
+
+        [v8] CodeGeneratorV8 generates incorrect code for callbacks with no parameters
+        https://bugs.webkit.org/show_bug.cgi?id=52837
+
+        When generating code to invoke a callback with no parameters CodeGeneratorV8.pm was generating the following:
+        v8::Handle<v8::Value> argv[] = {}; which does not compile in visual studio.  Instead, if the argument count
+        is 0, we can just pass a NULL pointer for the argv parameter.
+
+        Test added to bindings/scripts/test/TestCallback.idl and covered by run-bindings-tests.  This
+        patch also includes some spurious changes to the bindings tests golden files (mostly GObject)
+        because the old golden files were out of date.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/CPP/WebDOMTestCallback.cpp:
+        (WebDOMTestCallback::callbackWithNoParam):
+        * bindings/scripts/test/CPP/WebDOMTestCallback.h:
+        * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp:
+        (webkit_dom_test_callback_callback_with_no_param):
+        * bindings/scripts/test/GObject/WebKitDOMTestCallback.h:
+        * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp:
+        * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestCallback.cpp:
+        (WebCore::JSTestCallback::callbackWithNoParam):
+        * bindings/scripts/test/JS/JSTestCallback.h:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/ObjC/DOMTestCallback.h:
+        * bindings/scripts/test/ObjC/DOMTestCallback.mm:
+        (-[DOMTestCallback callbackWithNoParam]):
+        * bindings/scripts/test/TestCallback.idl:
+        * bindings/scripts/test/V8/V8TestCallback.cpp:
+        (WebCore::V8TestCallback::callbackWithNoParam):
+        * bindings/scripts/test/V8/V8TestCallback.h:
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter):
+
+2011-01-20  James Robinson  <jamesr at chromium.org>
+
         Reviewed by Eric "Baller" Seidel.
 
         RenderTableSection's setNeedsCellRecalc needs to null check table()
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
index c06fe17..7d36db1 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -2401,9 +2401,13 @@ END
                 push(@args, "        ${paramName}Handle");
             }
 
-            push(@implContent, "\n    v8::Handle<v8::Value> argv[] = {\n");
-            push(@implContent, join(",\n", @args));
-            push(@implContent, "\n    };\n\n");
+            if (scalar(@args) > 0) {
+                push(@implContent, "\n    v8::Handle<v8::Value> argv[] = {\n");
+                push(@implContent, join(",\n", @args));
+                push(@implContent, "\n    };\n\n");
+            } else {
+                push(@implContent, "\n    v8::Handle<v8::Value> *argv = 0;\n\n");
+            }
             push(@implContent, "    bool callbackReturnValue = false;\n");
             push(@implContent, "    return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");
             push(@implContent, "}\n");
diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
index a58da40..62ebc3c 100644
--- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
+++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
@@ -83,6 +83,14 @@ WebDOMTestCallback::~WebDOMTestCallback()
     m_impl = 0;
 }
 
+bool WebDOMTestCallback::callbackWithNoParam()
+{
+    if (!impl())
+        return false;
+
+    return impl()->callbackWithNoParam();
+}
+
 bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param)
 {
     if (!impl())
diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
index 91ff787..7a077e2 100644
--- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
+++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
@@ -46,6 +46,7 @@ public:
     WebDOMTestCallback& operator=(const WebDOMTestCallback&);
     virtual ~WebDOMTestCallback();
 
+    bool callbackWithNoParam();
     bool callbackWithClass1Param(const WebDOMClass1& class1Param);
     bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg);
     int callbackWithNonBoolReturnType(const WebDOMClass3& class3Param);
diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
index 9c8fa59..054dc38 100644
--- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
+++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
@@ -39,8 +39,9 @@
 #include "webkit/WebKitDOMClass3Private.h"
 #include "webkit/WebKitDOMTestCallback.h"
 #include "webkit/WebKitDOMTestCallbackPrivate.h"
+#include "webkitdefines.h"
+#include "webkitglobalsprivate.h"
 #include "webkitmarshal.h"
-#include "webkitprivate.h"
 
 namespace WebKit {
     
@@ -57,6 +58,16 @@ WebKitDOMTestCallback* kit(WebCore::TestCallback* obj)
 } // namespace WebKit //
 
 gboolean
+webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self)
+{
+    g_return_val_if_fail(self, 0);
+    WebCore::JSMainThreadNullState state;
+    WebCore::TestCallback * item = WebKit::core(self);
+    gboolean res = item->callbackWithNoParam();
+    return res;
+}
+
+gboolean
 webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param)
 {
     g_return_val_if_fail(self, 0);
diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
index 4f0ac91..6049c79 100644
--- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
+++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
@@ -47,6 +47,9 @@ WEBKIT_API GType
 webkit_dom_test_callback_get_type (void);
 
 WEBKIT_API gboolean
+webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self);
+
+WEBKIT_API gboolean
 webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param);
 
 WEBKIT_API gboolean
diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
index b68340b..7086c80 100644
--- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
+++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
@@ -33,8 +33,9 @@
 #include "gobject/ConvertToUTF8String.h"
 #include "webkit/WebKitDOMTestInterface.h"
 #include "webkit/WebKitDOMTestInterfacePrivate.h"
+#include "webkitdefines.h"
+#include "webkitglobalsprivate.h"
 #include "webkitmarshal.h"
-#include "webkitprivate.h"
 
 namespace WebKit {
     
diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
index 93d0bde..5946ec0 100644
--- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
+++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
@@ -31,8 +31,9 @@
 #include "gobject/ConvertToUTF8String.h"
 #include "webkit/WebKitDOMTestMediaQueryListListener.h"
 #include "webkit/WebKitDOMTestMediaQueryListListenerPrivate.h"
+#include "webkitdefines.h"
+#include "webkitglobalsprivate.h"
 #include "webkitmarshal.h"
-#include "webkitprivate.h"
 
 namespace WebKit {
     
diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
index 6c94d94..44d58d4 100644
--- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
+++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
@@ -38,8 +38,9 @@
 #include "webkit/WebKitDOMSerializedScriptValuePrivate.h"
 #include "webkit/WebKitDOMTestObj.h"
 #include "webkit/WebKitDOMTestObjPrivate.h"
+#include "webkitdefines.h"
+#include "webkitglobalsprivate.h"
 #include "webkitmarshal.h"
-#include "webkitprivate.h"
 
 namespace WebKit {
     
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
index 069b8ae..1f48ee9 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
@@ -56,6 +56,23 @@ JSTestCallback::~JSTestCallback()
 
 // Functions
 
+bool JSTestCallback::callbackWithNoParam()
+{
+    if (!canInvokeCallback())
+        return true;
+
+    RefPtr<JSTestCallback> protect(this);
+
+    JSLock lock(SilenceAssertionsOnly);
+
+    ExecState* exec = m_data->globalObject()->globalExec();
+    MarkedArgumentBuffer args;
+
+    bool raisedException = false;
+    m_data->invokeCallback(args, &raisedException);
+    return !raisedException;
+}
+
 bool JSTestCallback::callbackWithClass1Param(Class1* class1Param)
 {
     if (!canInvokeCallback())
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h
index ae91a6c..ba3559c 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h
@@ -40,6 +40,7 @@ public:
     virtual ~JSTestCallback();
 
     // Functions
+    virtual bool callbackWithNoParam();
     virtual bool callbackWithClass1Param(Class1* class1Param);
     virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg);
     COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(Class3* class3Param);
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
index 8e71df1..684f587 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
@@ -166,6 +166,7 @@ JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Iden
     JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase));
     return JSTestInterface::getConstructor(exec, domObject->globalObject());
 }
+
 JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
 {
     return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
index e505ed2..f1c09b5 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
@@ -162,6 +162,7 @@ JSValue jsTestMediaQueryListListenerConstructor(ExecState* exec, JSValue slotBas
     JSTestMediaQueryListListener* domObject = static_cast<JSTestMediaQueryListListener*>(asObject(slotBase));
     return JSTestMediaQueryListListener::getConstructor(exec, domObject->globalObject());
 }
+
 JSValue JSTestMediaQueryListListener::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
 {
     return getDOMConstructor<JSTestMediaQueryListListenerConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index c4c77ee..9d446a2 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -607,6 +607,7 @@ JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier
     JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase));
     return JSTestObj::getConstructor(exec, domObject->globalObject());
 }
+
 void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
 {
     lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot);
diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h
index 1213c6f..08c30b7 100644
--- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h
+++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h
@@ -36,6 +36,7 @@
 @class NSString;
 
 @interface DOMTestCallback : DOMObject
+- (BOOL)callbackWithNoParam;
 - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param;
 - (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg;
 - (int)callbackWithNonBoolReturnType:(DOMClass3 *)class3Param;
diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
index e941eda..c4be39d 100644
--- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
+++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
@@ -79,6 +79,12 @@
     [super finalize];
 }
 
+- (BOOL)callbackWithNoParam
+{
+    WebCore::JSMainThreadNullState state;
+    return IMPL->callbackWithNoParam();
+}
+
 - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param
 {
     WebCore::JSMainThreadNullState state;
diff --git a/Source/WebCore/bindings/scripts/test/TestCallback.idl b/Source/WebCore/bindings/scripts/test/TestCallback.idl
index 25db4c6..9679a5a 100644
--- a/Source/WebCore/bindings/scripts/test/TestCallback.idl
+++ b/Source/WebCore/bindings/scripts/test/TestCallback.idl
@@ -33,6 +33,7 @@ module test {
         Conditional=DATABASE,
         Callback
     ] TestCallback {
+      boolean callbackWithNoParam();
       boolean callbackWithClass1Param(in Class1 class1Param);
       boolean callbackWithClass2Param(in Class2 class2Param, in DOMString strArg);
       long callbackWithNonBoolReturnType(in Class3 class3Param);
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
index c286c24..36a5ca2 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
@@ -48,6 +48,26 @@ V8TestCallback::~V8TestCallback()
 
 // Functions
 
+bool V8TestCallback::callbackWithNoParam()
+{
+    if (!canInvokeCallback())
+        return true;
+
+    v8::HandleScope handleScope;
+
+    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
+    if (v8Context.IsEmpty())
+        return true;
+
+    v8::Context::Scope scope(v8Context);
+
+
+    v8::Handle<v8::Value> *argv = 0;
+
+    bool callbackReturnValue = false;
+    return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext());
+}
+
 bool V8TestCallback::callbackWithClass1Param(Class1* class1Param)
 {
     if (!canInvokeCallback())
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h
index a105d75..8ff8c26 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h
@@ -45,6 +45,7 @@ public:
     virtual ~V8TestCallback();
 
     // Functions
+    virtual bool callbackWithNoParam();
     virtual bool callbackWithClass1Param(Class1* class1Param);
     virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg);
     COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(Class3* class3Param);
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 7a759a3..4298756 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -260,7 +260,7 @@ static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v
 {
     INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get");
     TestObj* imp = V8TestObj::toNative(info.Holder());
-    return v8::Integer::NewFromUnsigned(imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr));
+    return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)));
 }
 
 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list