<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200562] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200562">200562</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-05-08 14:56:57 -0700 (Sun, 08 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
https://bugs.webkit.org/show_bug.cgi?id=157465

Reviewed by Darin Adler.

Source/WebCore:

Simplify [RequiresExistingAtomicString] IDL extended attribute handling
in the bindings generator.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
Drop code specific to [RequiresExistingAtomicString].

(JSValueToNative):
Deal with [RequiresExistingAtomicString] IDL extended attribute,
similarly to [AtomicString] and [TreatNullAs].

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Add bindings test coverage.

* dom/DocumentFragment.cpp:
(WebCore::DocumentFragment::getElementById):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::getElementById):
Add null check for the id parameter. The generated bindings used to do
this null check for us but it is no longer the case (to make the bindings
generator a bit simpler). This extended attribute is not commonly used
and is meant as a micro-optimization for getElementById().

Source/WTF:

Add an AtomicString(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;) constructor that is now
used by the bindings when [RequiresExistingAtomicString] is used. This
is more efficient than using AtomicString(AtomicStringImpl*) as the
caller has a RefPtr&lt;AtomicStringImpl&gt; and is consistent with the
pre-existing String(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;) constructor.

* wtf/text/AtomicString.h:
(WTF::AtomicString::AtomicString):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringh">trunk/Source/WTF/wtf/text/AtomicString.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentFragmentcpp">trunk/Source/WebCore/dom/DocumentFragment.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSVGElementcpp">trunk/Source/WebCore/svg/SVGSVGElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WTF/ChangeLog        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-05-08  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
+        https://bugs.webkit.org/show_bug.cgi?id=157465
+
+        Reviewed by Darin Adler.
+
+        Add an AtomicString(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;) constructor that is now
+        used by the bindings when [RequiresExistingAtomicString] is used. This
+        is more efficient than using AtomicString(AtomicStringImpl*) as the
+        caller has a RefPtr&lt;AtomicStringImpl&gt; and is consistent with the
+        pre-existing String(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;) constructor.
+
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+
</ins><span class="cx"> 2016-05-08  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         * wtf/text/WTFString.h: Remove pragma once. Not working for some reason.
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicString.h (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicString.h        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WTF/wtf/text/AtomicString.h        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     AtomicString(AtomicStringImpl*);
</span><ins>+    AtomicString(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;);
</ins><span class="cx">     ATOMICSTRING_CONVERSION AtomicString(StringImpl*);
</span><span class="cx">     ATOMICSTRING_CONVERSION AtomicString(const String&amp;);
</span><span class="cx">     AtomicString(StringImpl* baseString, unsigned start, unsigned length);
</span><span class="lines">@@ -259,6 +260,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline AtomicString::AtomicString(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp; imp)
+    : m_string(WTFMove(imp))
+{
+}
+
</ins><span class="cx"> inline AtomicString::AtomicString(StringImpl* imp)
</span><span class="cx">     : m_string(AtomicStringImpl::add(imp))
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/ChangeLog        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-05-08  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
+        https://bugs.webkit.org/show_bug.cgi?id=157465
+
+        Reviewed by Darin Adler.
+
+        Simplify [RequiresExistingAtomicString] IDL extended attribute handling
+        in the bindings generator.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        Drop code specific to [RequiresExistingAtomicString].
+
+        (JSValueToNative):
+        Deal with [RequiresExistingAtomicString] IDL extended attribute,
+        similarly to [AtomicString] and [TreatNullAs].
+
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/TestObj.idl:
+        Add bindings test coverage.
+
+        * dom/DocumentFragment.cpp:
+        (WebCore::DocumentFragment::getElementById):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::getElementById):
+        Add null check for the id parameter. The generated bindings used to do
+        this null check for us but it is no longer the case (to make the bindings
+        generator a bit simpler). This extended attribute is not commonly used
+        and is meant as a micro-optimization for getElementById().
+
</ins><span class="cx"> 2016-05-08  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Roll out: ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -3748,56 +3748,47 @@
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if ($parameter-&gt;extendedAttributes-&gt;{&quot;RequiresExistingAtomicString&quot;}) {
-                # FIXME: This could be made slightly more efficient if we added an AtomicString(RefPtr&lt;AtomicStringImpl&gt;&amp;&amp;) constructor and removed the call to get() here.
-                push(@$outputArray, &quot;    AtomicString $name = state-&gt;argument($argumentIndex).toString(state)-&gt;toExistingAtomicString(state).get();\n&quot;);
-                push(@$outputArray, &quot;    if ($name.isNull())\n&quot;);
-                push(@$outputArray, &quot;        return JSValue::encode(jsNull());\n&quot;);
-                push(@$outputArray, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
-                push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-            } else {
-                my $outer;
-                my $inner;
-                my $nativeType = GetNativeTypeFromSignature($interface, $parameter);
</del><ins>+            my $outer;
+            my $inner;
+            my $nativeType = GetNativeTypeFromSignature($interface, $parameter);
</ins><span class="cx"> 
</span><del>-                if ($parameter-&gt;isOptional &amp;&amp; defined($parameter-&gt;default) &amp;&amp; !WillConvertUndefinedToDefaultParameterValue($type, $parameter-&gt;default)) {
-                    my $defaultValue = $parameter-&gt;default;
</del><ins>+            if ($parameter-&gt;isOptional &amp;&amp; defined($parameter-&gt;default) &amp;&amp; !WillConvertUndefinedToDefaultParameterValue($type, $parameter-&gt;default)) {
+                my $defaultValue = $parameter-&gt;default;
</ins><span class="cx"> 
</span><del>-                    # String-related optimizations.
-                    if ($type eq &quot;DOMString&quot;) {
-                        my $useAtomicString = $parameter-&gt;extendedAttributes-&gt;{&quot;AtomicString&quot;};
-                        if ($defaultValue eq &quot;null&quot;) {
-                            $defaultValue = $useAtomicString ? &quot;nullAtom&quot; : &quot;String()&quot;;
-                        } elsif ($defaultValue eq &quot;\&quot;\&quot;&quot;) {
-                            $defaultValue = $useAtomicString ? &quot;emptyAtom&quot; : &quot;emptyString()&quot;;
-                        } else {
-                            $defaultValue = $useAtomicString ? &quot;AtomicString($defaultValue, AtomicString::ConstructFromLiteral)&quot; : &quot;ASCIILiteral($defaultValue)&quot;;
-                        }
</del><ins>+                # String-related optimizations.
+                if ($type eq &quot;DOMString&quot;) {
+                    my $useAtomicString = $parameter-&gt;extendedAttributes-&gt;{&quot;AtomicString&quot;};
+                    if ($defaultValue eq &quot;null&quot;) {
+                        $defaultValue = $useAtomicString ? &quot;nullAtom&quot; : &quot;String()&quot;;
+                    } elsif ($defaultValue eq &quot;\&quot;\&quot;&quot;) {
+                        $defaultValue = $useAtomicString ? &quot;emptyAtom&quot; : &quot;emptyString()&quot;;
</ins><span class="cx">                     } else {
</span><del>-                        $defaultValue = &quot;nullptr&quot; if $defaultValue eq &quot;null&quot;;
-                        $defaultValue = &quot;PNaN&quot; if $defaultValue eq &quot;NaN&quot;;
-                        $defaultValue = &quot;$nativeType()&quot; if $defaultValue eq &quot;[]&quot;;
-                        $defaultValue = &quot;JSValue::JSUndefined&quot; if $defaultValue eq &quot;undefined&quot;;
</del><ins>+                        $defaultValue = $useAtomicString ? &quot;AtomicString($defaultValue, AtomicString::ConstructFromLiteral)&quot; : &quot;ASCIILiteral($defaultValue)&quot;;
</ins><span class="cx">                     }
</span><del>-
-                    $outer = &quot;state-&gt;argument($argumentIndex).isUndefined() ? $defaultValue : &quot;;
-                    $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
-                } elsif ($parameter-&gt;isOptional &amp;&amp; !defined($parameter-&gt;default)) {
-                    # Use WTF::Optional&lt;&gt;() for optional parameters that are missing or undefined and that do not have a default value in the IDL.
-                    $outer = &quot;state-&gt;argument($argumentIndex).isUndefined() ? Optional&lt;$nativeType&gt;() : &quot;;
-                    $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
</del><span class="cx">                 } else {
</span><del>-                    $outer = &quot;&quot;;
-                    $inner = &quot;state-&gt;argument($argumentIndex)&quot;;
</del><ins>+                    $defaultValue = &quot;nullptr&quot; if $defaultValue eq &quot;null&quot;;
+                    $defaultValue = &quot;PNaN&quot; if $defaultValue eq &quot;NaN&quot;;
+                    $defaultValue = &quot;$nativeType()&quot; if $defaultValue eq &quot;[]&quot;;
+                    $defaultValue = &quot;JSValue::JSUndefined&quot; if $defaultValue eq &quot;undefined&quot;;
</ins><span class="cx">                 }
</span><del>-                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $inner, $function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
-                push(@$outputArray, &quot;    auto $name = ${outer}${nativeValue};\n&quot;);
-                $value = &quot;WTFMove($name)&quot;;
-                if ($mayThrowException) {
-                    push(@$outputArray, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
-                    push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                }
</del><ins>+
+                $outer = &quot;state-&gt;argument($argumentIndex).isUndefined() ? $defaultValue : &quot;;
+                $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
+            } elsif ($parameter-&gt;isOptional &amp;&amp; !defined($parameter-&gt;default)) {
+                # Use WTF::Optional&lt;&gt;() for optional parameters that are missing or undefined and that do not have a default value in the IDL.
+                $outer = &quot;state-&gt;argument($argumentIndex).isUndefined() ? Optional&lt;$nativeType&gt;() : &quot;;
+                $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
+            } else {
+                $outer = &quot;&quot;;
+                $inner = &quot;state-&gt;argument($argumentIndex)&quot;;
</ins><span class="cx">             }
</span><ins>+            my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $inner, $function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
+            push(@$outputArray, &quot;    auto $name = ${outer}${nativeValue};\n&quot;);
+            $value = &quot;WTFMove($name)&quot;;
+            if ($mayThrowException) {
+                push(@$outputArray, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
+                push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
+            }
</ins><span class="cx"> 
</span><span class="cx">             my $isTearOff = $codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) &amp;&amp; $interfaceName !~ /List$/;
</span><span class="cx">             my $shouldPassByReference = ShouldPassWrapperByReference($parameter, $interface);
</span><span class="lines">@@ -4388,6 +4379,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($type eq &quot;DOMString&quot;) {
</span><ins>+        return (&quot;AtomicString($value.toString(state)-&gt;toExistingAtomicString(state))&quot;, 1) if $signature-&gt;extendedAttributes-&gt;{&quot;RequiresExistingAtomicString&quot;};
+
</ins><span class="cx">         if ($signature-&gt;extendedAttributes-&gt;{&quot;TreatNullAs&quot;}) {
</span><span class="cx">             return (&quot;valueToStringTreatingNullAsEmptyString(state, $value)&quot;, 1) if $signature-&gt;extendedAttributes-&gt;{&quot;TreatNullAs&quot;} eq &quot;EmptyString&quot;;
</span><span class="cx">             return (&quot;valueToStringWithNullCheck(state, $value)&quot;, 1) if $signature-&gt;extendedAttributes-&gt;{&quot;TreatNullAs&quot;} eq &quot;LegacyNullString&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include &quot;DOMStringList.h&quot;
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><ins>+#include &quot;Element.h&quot;
</ins><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="lines">@@ -35,6 +36,7 @@
</span><span class="cx"> #include &quot;JSDOMPromise.h&quot;
</span><span class="cx"> #include &quot;JSDOMStringList.h&quot;
</span><span class="cx"> #include &quot;JSDocument.h&quot;
</span><ins>+#include &quot;JSElement.h&quot;
</ins><span class="cx"> #include &quot;JSEventListener.h&quot;
</span><span class="cx"> #include &quot;JSFetchRequest.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><span class="lines">@@ -635,6 +637,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence2(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetElementById(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(JSC::ExecState*);
</span><span class="lines">@@ -1212,6 +1215,7 @@
</span><span class="cx">     { &quot;domStringListFunction&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionDomStringListFunction), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithAndWithoutNullableSequence&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence), (intptr_t) (2) } },
</span><span class="cx">     { &quot;methodWithAndWithoutNullableSequence2&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence2), (intptr_t) (2) } },
</span><ins>+    { &quot;getElementById&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionGetElementById), (intptr_t) (1) } },
</ins><span class="cx">     { &quot;getSVGDocument&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t) (0) } },
</span><span class="cx">     { &quot;convert1&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionConvert1), (intptr_t) (1) } },
</span><span class="cx">     { &quot;convert2&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionConvert2), (intptr_t) (1) } },
</span><span class="lines">@@ -5637,6 +5641,23 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetElementById(ExecState* state)
+{
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, &quot;TestObj&quot;, &quot;getElementById&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    auto elementId = AtomicString(state-&gt;argument(0).toString(state)-&gt;toExistingAtomicString(state));
+    if (UNLIKELY(state-&gt;hadException()))
+        return JSValue::encode(jsUndefined());
+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.getElementById(WTFMove(elementId))));
+    return JSValue::encode(result);
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = state-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -290,6 +290,8 @@
</span><span class="cx"> 
</span><span class="cx">     void methodWithAndWithoutNullableSequence(sequence&lt;unsigned long&gt; arrayArg, sequence&lt;unsigned long&gt;? nullableArrayArg);
</span><span class="cx">     void methodWithAndWithoutNullableSequence2(unsigned long[] arrayArg, unsigned long[]? nullableArrayArg);
</span><ins>+
+    Element? getElementById([RequiresExistingAtomicString] DOMString elementId);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     [CheckSecurityForNode] readonly attribute Document contentDocument;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentFragment.cpp (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentFragment.cpp        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/dom/DocumentFragment.cpp        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -93,6 +93,9 @@
</span><span class="cx"> 
</span><span class="cx"> Element* DocumentFragment::getElementById(const AtomicString&amp; id) const
</span><span class="cx"> {
</span><ins>+    if (id.isNull())
+        return nullptr;
+
</ins><span class="cx">     // Fast path for ShadowRoot, where we are both a DocumentFragment and a TreeScope.
</span><span class="cx">     if (isTreeScope())
</span><span class="cx">         return treeScope().getElementById(id);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (200561 => 200562)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSVGElement.cpp        2016-05-08 19:11:03 UTC (rev 200561)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp        2016-05-08 21:56:57 UTC (rev 200562)
</span><span class="lines">@@ -672,6 +672,9 @@
</span><span class="cx"> // See http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement
</span><span class="cx"> Element* SVGSVGElement::getElementById(const AtomicString&amp; id)
</span><span class="cx"> {
</span><ins>+    if (id.isNull())
+        return nullptr;
+
</ins><span class="cx">     Element* element = treeScope().getElementById(id);
</span><span class="cx">     if (element &amp;&amp; element-&gt;isDescendantOf(this))
</span><span class="cx">         return element;
</span></span></pre>
</div>
</div>

</body>
</html>