Title: [183648] trunk/Source/WebCore
Revision
183648
Author
oli...@apple.com
Date
2015-04-30 15:40:30 -0700 (Thu, 30 Apr 2015)

Log Message

DOM bindings should not be using a reference type to point to a temporary object
https://bugs.webkit.org/show_bug.cgi?id=144474

Reviewed by Beth Dakin.

The DOM bindings will currently try and use a local reference to point
to a temporary object. This currently works as a by product of the compiler's
stack layout. This patch removes the dependency on undefined behaviour
by ensuring that we use a value rather than reference type.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
(GetNativeTypeForCallbacks):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183647 => 183648)


--- trunk/Source/WebCore/ChangeLog	2015-04-30 22:16:42 UTC (rev 183647)
+++ trunk/Source/WebCore/ChangeLog	2015-04-30 22:40:30 UTC (rev 183648)
@@ -1,3 +1,19 @@
+2015-04-30  Oliver Hunt  <oli...@apple.com>
+
+        DOM bindings should not be using a reference type to point to a temporary object
+        https://bugs.webkit.org/show_bug.cgi?id=144474
+
+        Reviewed by Beth Dakin.
+
+        The DOM bindings will currently try and use a local reference to point
+        to a temporary object. This currently works as a by product of the compiler's
+        stack layout. This patch removes the dependency on undefined behaviour
+        by ensuring that we use a value rather than reference type.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        (GetNativeTypeForCallbacks):
+
 2015-04-30  Brady Eidson  <beid...@apple.com>
 
         _javascript_ using WebSQL can create their own WebKit info table.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (183647 => 183648)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-04-30 22:16:42 UTC (rev 183647)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-04-30 22:40:30 UTC (rev 183648)
@@ -3303,7 +3303,7 @@
                 push(@$outputArray, "    AtomicStringImpl* existing_$name = exec->argument($argsIndex).isEmpty() ? nullptr : exec->argument($argsIndex).toString(exec)->toExistingAtomicString(exec);\n");
                 push(@$outputArray, "    if (!existing_$name)\n");
                 push(@$outputArray, "        return JSValue::encode(jsNull());\n");
-                push(@$outputArray, "    const AtomicString& $name(existing_$name);\n");
+                push(@$outputArray, "    const AtomicString $name(existing_$name);\n");
             } else {
                 push(@$outputArray, "    " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, $optional && $defaultAttribute && $defaultAttribute eq "NullString" ? "argumentOrNull(exec, $argsIndex)" : "exec->argument($argsIndex)", $function->signature->extendedAttributes->{"Conditional"}) . ");\n");
             }
@@ -3644,7 +3644,7 @@
 
 my %nativeType = (
     "CompareHow" => "Range::CompareHow",
-    "DOMString" => "const String&",
+    "DOMString" => "const String",
     "NodeFilter" => "RefPtr<NodeFilter>",
     "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
     "Date" => "double",
@@ -3704,6 +3704,7 @@
     my $type = shift;
     return "PassRefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue";
     return "PassRefPtr<DOMStringList>" if $type eq "DOMStringList";
+    return "const String&" if $type eq "DOMString";
 
     return GetNativeType($type);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to