Title: [106077] trunk/Source/WebCore
Revision
106077
Author
[email protected]
Date
2012-01-26 18:25:01 -0800 (Thu, 26 Jan 2012)

Log Message

Fix bad code generated by the JSC idl code generator for [CachedAttribute] attributes
https://bugs.webkit.org/show_bug.cgi?id=77165

Patch by Pablo Flouret <[email protected]> on 2012-01-26
Reviewed by Oliver Hunt.

Missing parameter in a call to deserialize() and using 'this' in the
attribute accessor functions (which are static).

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(NativeToJSValue):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjCachedAttribute1):
(WebCore::jsTestObjCachedAttribute2):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::jsTestSerializedScriptValueInterfaceValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106076 => 106077)


--- trunk/Source/WebCore/ChangeLog	2012-01-27 02:11:55 UTC (rev 106076)
+++ trunk/Source/WebCore/ChangeLog	2012-01-27 02:25:01 UTC (rev 106077)
@@ -1,3 +1,22 @@
+2012-01-26  Pablo Flouret  <[email protected]>
+
+        Fix bad code generated by the JSC idl code generator for [CachedAttribute] attributes
+        https://bugs.webkit.org/show_bug.cgi?id=77165
+
+        Reviewed by Oliver Hunt.
+
+        Missing parameter in a call to deserialize() and using 'this' in the
+        attribute accessor functions (which are static).
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        (NativeToJSValue):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjCachedAttribute1):
+        (WebCore::jsTestObjCachedAttribute2):
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        (WebCore::jsTestSerializedScriptValueInterfaceValue):
+
 2012-01-26  W. James MacLean  <[email protected]>
 
         [chromium] Allow modification of size of partially occluded quads during culling to reduce pixel overdraw.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (106076 => 106077)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-01-27 02:11:55 UTC (rev 106076)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-01-27 02:25:01 UTC (rev 106077)
@@ -1751,7 +1751,7 @@
                     if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) {
                         $cacheIndex = $currentCachedAttribute;
                         $currentCachedAttribute++;
-                        push(@implContent, "    if (JSValue cachedValue = m_" . $attribute->signature->name . ".get())\n");
+                        push(@implContent, "    if (JSValue cachedValue = castedThis->m_" . $attribute->signature->name . ".get())\n");
                         push(@implContent, "        return cachedValue;\n");
                     }
 
@@ -1794,7 +1794,7 @@
                         }
                     }
 
-                    push(@implContent, "    m_" . $attribute->signature->name . ".set(exec->globalData(), this, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"});
+                    push(@implContent, "    castedThis->m_" . $attribute->signature->name . ".set(exec->globalData(), castedThis, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"});
                     push(@implContent, "    return result;\n");
 
                 } else {
@@ -2997,7 +2997,7 @@
         AddToImplIncludes("$joinedName.h", $conditional);
     } elsif ($type eq "SerializedScriptValue" or $type eq "any") {
         AddToImplIncludes("SerializedScriptValue.h", $conditional);
-        return "$value ? $value->deserialize(exec, castedThis->globalObject()) : jsNull()";
+        return "$value ? $value->deserialize(exec, castedThis->globalObject(), 0) : jsNull()";
     } else {
         # Default, include header with same name.
         AddToImplIncludes("JS$type.h", $conditional);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (106076 => 106077)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2012-01-27 02:11:55 UTC (rev 106076)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2012-01-27 02:25:01 UTC (rev 106077)
@@ -758,11 +758,11 @@
 {
     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
     UNUSED_PARAM(exec);
-    if (JSValue cachedValue = m_cachedAttribute1.get())
+    if (JSValue cachedValue = castedThis->m_cachedAttribute1.get())
         return cachedValue;
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    JSValue result = impl->cachedAttribute1() ? impl->cachedAttribute1()->deserialize(exec, castedThis->globalObject()) : jsNull();
-    m_cachedAttribute1.set(exec->globalData(), this, result);
+    JSValue result = impl->cachedAttribute1() ? impl->cachedAttribute1()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
+    castedThis->m_cachedAttribute1.set(exec->globalData(), castedThis, result);
     return result;
 }
 
@@ -771,11 +771,11 @@
 {
     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
     UNUSED_PARAM(exec);
-    if (JSValue cachedValue = m_cachedAttribute2.get())
+    if (JSValue cachedValue = castedThis->m_cachedAttribute2.get())
         return cachedValue;
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    JSValue result = impl->cachedAttribute2() ? impl->cachedAttribute2()->deserialize(exec, castedThis->globalObject()) : jsNull();
-    m_cachedAttribute2.set(exec->globalData(), this, result);
+    JSValue result = impl->cachedAttribute2() ? impl->cachedAttribute2()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
+    castedThis->m_cachedAttribute2.set(exec->globalData(), castedThis, result);
     return result;
 }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (106076 => 106077)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2012-01-27 02:11:55 UTC (rev 106076)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2012-01-27 02:25:01 UTC (rev 106077)
@@ -162,7 +162,7 @@
     JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
     UNUSED_PARAM(exec);
     TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
-    JSValue result = impl->value() ? impl->value()->deserialize(exec, castedThis->globalObject()) : jsNull();
+    JSValue result = impl->value() ? impl->value()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to