Title: [146292] trunk/Source/WebCore
Revision
146292
Author
commit-qu...@webkit.org
Date
2013-03-19 19:11:22 -0700 (Tue, 19 Mar 2013)

Log Message

do not use string reference for enum support in CodeGeneratorJS.pm
https://bugs.webkit.org/show_bug.cgi?id=112760

Patch by Arnaud Renevier <a.renev...@sisa.samsung.com> on 2013-03-19
Reviewed by Kentaro Hara.

Do use string references in generated JS bindings for enum values.

Test: bindings/scripts/test/TestObj.idl

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateParametersCheck):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjEnumAttr):
(WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146291 => 146292)


--- trunk/Source/WebCore/ChangeLog	2013-03-20 02:08:09 UTC (rev 146291)
+++ trunk/Source/WebCore/ChangeLog	2013-03-20 02:11:22 UTC (rev 146292)
@@ -1,3 +1,21 @@
+2013-03-19  Arnaud Renevier  <a.renev...@sisa.samsung.com>
+
+        do not use string reference for enum support in CodeGeneratorJS.pm
+        https://bugs.webkit.org/show_bug.cgi?id=112760
+
+        Reviewed by Kentaro Hara.
+
+        Do use string references in generated JS bindings for enum values.
+
+        Test: bindings/scripts/test/TestObj.idl
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        (GenerateParametersCheck):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::setJSTestObjEnumAttr):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
+
 2013-03-19  Simon Fraser  <simon.fra...@apple.com>
 
         Make RLC::haveNonMainLayersWithTiledBacking() public and fix the name

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (146291 => 146292)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-03-20 02:08:09 UTC (rev 146291)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-03-20 02:11:22 UTC (rev 146292)
@@ -2144,7 +2144,7 @@
 
                                 my $nativeValue;
                                 if ($codeGenerator->IsEnumType($type)) {
-                                    push(@implContent, "    String& string = value.isEmpty() ? String() : value.toString(exec)->value(exec);\n");
+                                    push(@implContent, "    const String string = value.isEmpty() ? String() : value.toString(exec)->value(exec);\n");
                                     push(@implContent, "    if (exec->hadException())\n");
                                     push(@implContent, "        return;\n");
                                     my @enumValues = $codeGenerator->ValidEnumValues($type);
@@ -2786,7 +2786,7 @@
             $implIncludes{"<runtime/Error.h>"} = 1;
 
             my $argValue = "exec->argument($argsIndex)";
-            push(@$outputArray, "    const String& ${name}(${argValue}.isEmpty() ? String() : ${argValue}.toString(exec)->value(exec));\n");
+            push(@$outputArray, "    const String ${name}(${argValue}.isEmpty() ? String() : ${argValue}.toString(exec)->value(exec));\n");
             push(@$outputArray, "    if (exec->hadException())\n");
             push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
 

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-03-20 02:08:09 UTC (rev 146291)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-03-20 02:11:22 UTC (rev 146292)
@@ -1085,7 +1085,7 @@
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    String& string = value.isEmpty() ? String() : value.toString(exec)->value(exec);
+    const String string = value.isEmpty() ? String() : value.toString(exec)->value(exec);
     if (exec->hadException())
         return;
     if (string != "" && string != "EnumValue1" && string != "EnumValue2" && string != "EnumValue3")
@@ -1701,7 +1701,7 @@
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    const String& enumArg(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
+    const String enumArg(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     if (enumArg != "" && enumArg != "EnumValue1" && enumArg != "EnumValue2" && enumArg != "EnumValue3")
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to