<!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>[215200] trunk/Source/WebCore</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/215200">215200</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-04-10 14:02:16 -0700 (Mon, 10 Apr 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Wrap legacy MediaStream API in runtime flag
https://bugs.webkit.org/show_bug.cgi?id=169877

Patch by Youenn Fablet &lt;youenn@apple.com&gt; on 2017-04-10
Reviewed by Alex Christensen.

Covered by binding tests.

Marking navigator.getUserMedia and MediaStreamEvent as runtime enabled if mediastream and webrtclegacy api flags
are on.
Updated binding generator to support multiple runtime flags.

* Modules/mediastream/MediaStreamEvent.idl:
* Modules/mediastream/NavigatorUserMedia.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GetRuntimeEnableFunctionName):
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
* bindings/scripts/test/TestObj.idl:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamEventidl">trunk/Source/WebCore/Modules/mediastream/MediaStreamEvent.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamNavigatorUserMediaidl">trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/ChangeLog        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -1,5 +1,27 @@
</span><span class="cx"> 2017-04-10  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Wrap legacy MediaStream API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169877
+
+        Reviewed by Alex Christensen.
+
+        Covered by binding tests.
+
+        Marking navigator.getUserMedia and MediaStreamEvent as runtime enabled if mediastream and webrtclegacy api flags
+        are on.
+        Updated binding generator to support multiple runtime flags.
+
+        * Modules/mediastream/MediaStreamEvent.idl:
+        * Modules/mediastream/NavigatorUserMedia.idl:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetRuntimeEnableFunctionName):
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObjPrototype::finishCreation):
+        * bindings/scripts/test/TestObj.idl:
+
+2017-04-10  Youenn Fablet  &lt;youenn@apple.com&gt;
+
</ins><span class="cx">         Remove deprecated parts of media stream spec
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=169879
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamEvent.idl (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamEvent.idl        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamEvent.idl        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -22,11 +22,10 @@
</span><span class="cx">  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-// FIXME 169871: legacy or remove
</del><span class="cx"> [
</span><span class="cx">     Conditional=WEB_RTC,
</span><span class="cx">     Constructor(DOMString type, optional MediaStreamEventInit eventInitDict),
</span><del>-    EnabledAtRuntime=MediaStream,
</del><ins>+    EnabledAtRuntime=WebRTCLegacyAPI&amp;MediaStream,
</ins><span class="cx"> ] interface MediaStreamEvent : Event {
</span><span class="cx">     readonly attribute MediaStream? stream;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamNavigatorUserMediaidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -29,9 +29,8 @@
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="cx"> [
</span><del>-    Conditional=MEDIA_STREAM,
-    EnabledAtRuntime=MediaStream,
</del><ins>+    Conditional=MEDIA_STREAM&amp;WEB_RTC,
+    EnabledAtRuntime=WebRTCLegacyAPI&amp;MediaStream,
</ins><span class="cx"> ] partial interface Navigator {
</span><del>-    // FIXME 169871: wrap legacy setting
</del><span class="cx">     [JSBuiltin] void getUserMedia(MediaStreamConstraints constraints, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -2910,7 +2910,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled.
</span><del>-# NOTE: Parameter passed in must have both an 'extendedAttributes' property.
</del><ins>+# NOTE: Parameter passed in must have an 'extendedAttributes' property.
</ins><span class="cx"> #  (e.g. DOMInterface, DOMAttribute, DOMOperation, DOMIterable, etc.)
</span><span class="cx"> sub GetRuntimeEnableFunctionName
</span><span class="cx"> {
</span><span class="lines">@@ -2917,18 +2917,25 @@
</span><span class="cx">     my $context = shift;
</span><span class="cx"> 
</span><span class="cx">     AddToImplIncludes(&quot;RuntimeEnabledFeatures.h&quot;);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if ($context-&gt;extendedAttributes-&gt;{EnabledForWorld}) {
</span><del>-        return &quot;worldForDOMObject(this).&quot; . ToMethodName($context-&gt;extendedAttributes-&gt;{EnabledForWorld});
</del><ins>+        return &quot;worldForDOMObject(this).&quot; . ToMethodName($context-&gt;extendedAttributes-&gt;{EnabledForWorld}) . &quot;()&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # If a parameter is given (e.g. &quot;EnabledAtRuntime=FeatureName&quot;) return the RuntimeEnabledFeatures::sharedFeatures().{FeatureName}Enabled() method.
</span><span class="cx">     if ($context-&gt;extendedAttributes-&gt;{EnabledAtRuntime} &amp;&amp; $context-&gt;extendedAttributes-&gt;{EnabledAtRuntime} ne &quot;VALUE_IS_MISSING&quot;) {
</span><del>-        return &quot;RuntimeEnabledFeatures::sharedFeatures().&quot; . ToMethodName($context-&gt;extendedAttributes-&gt;{EnabledAtRuntime}) . &quot;Enabled&quot;;
</del><ins>+        my @flags = split /&amp;/, $context-&gt;extendedAttributes-&gt;{EnabledAtRuntime};
+        my $result = &quot;&quot;;
+        foreach my $flag (@flags) {
+            $result .= &quot; &amp;&amp; &quot; unless length $result eq 0;
+            $result .= &quot;RuntimeEnabledFeatures::sharedFeatures().&quot; . ToMethodName($flag) . &quot;Enabled()&quot;
+        }
+        $result = &quot;(&quot; . $result . &quot;)&quot; unless scalar @flags eq 1;
+        return $result;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Otherwise return a function named RuntimeEnabledFeatures::sharedFeatures().{methodName}Enabled().
</span><del>-    return &quot;RuntimeEnabledFeatures::sharedFeatures().&quot; . ToMethodName($context-&gt;name) . &quot;Enabled&quot;;
</del><ins>+    return &quot;RuntimeEnabledFeatures::sharedFeatures().&quot; . ToMethodName($context-&gt;name) . &quot;Enabled()&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GetCastingHelperForThisObject
</span><span class="lines">@@ -3347,9 +3354,9 @@
</span><span class="cx">             my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($functionOrAttribute);
</span><span class="cx">             push(@implContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</span><span class="cx">             AddToImplIncludes(&quot;RuntimeEnabledFeatures.h&quot;);
</span><del>-            my $enable_function = GetRuntimeEnableFunctionName($functionOrAttribute);
</del><ins>+            my $enable_function_result = GetRuntimeEnableFunctionName($functionOrAttribute);
</ins><span class="cx">             my $name = $functionOrAttribute-&gt;name;
</span><del>-            push(@implContent, &quot;    if (!${enable_function}()) {\n&quot;);
</del><ins>+            push(@implContent, &quot;    if (!${enable_function_result}) {\n&quot;);
</ins><span class="cx">             push(@implContent, &quot;        Identifier propertyName = Identifier::fromString(&amp;vm, reinterpret_cast&lt;const LChar*&gt;(\&quot;$name\&quot;), strlen(\&quot;$name\&quot;));\n&quot;);
</span><span class="cx">             push(@implContent, &quot;        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n&quot;);
</span><span class="cx">             push(@implContent, &quot;        JSObject::deleteProperty(this, globalObject()-&gt;globalExec(), propertyName);\n&quot;);
</span><span class="lines">@@ -3456,9 +3463,9 @@
</span><span class="cx"> 
</span><span class="cx">         my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($attribute);
</span><span class="cx">         push(@implContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</span><del>-        my $enable_function = GetRuntimeEnableFunctionName($attribute);
</del><ins>+        my $enable_function_result = GetRuntimeEnableFunctionName($attribute);
</ins><span class="cx">         my $attributeName = $attribute-&gt;name;
</span><del>-        push(@implContent, &quot;    if (${enable_function}()) {\n&quot;);
</del><ins>+        push(@implContent, &quot;    if (${enable_function_result}) {\n&quot;);
</ins><span class="cx">         my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx">         my $setter = IsReadonly($attribute) ? &quot;nullptr&quot; : GetAttributeSetterName($interface, $className, $attribute);
</span><span class="cx">         push(@implContent, &quot;        auto* customGetterSetter = CustomGetterSetter::create(vm, $getter, $setter);\n&quot;);
</span><span class="lines">@@ -3491,12 +3498,12 @@
</span><span class="cx"> 
</span><span class="cx">         my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($function);
</span><span class="cx">         push(@implContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</span><del>-        my $enable_function = GetRuntimeEnableFunctionName($function);
</del><ins>+        my $enable_function_result = GetRuntimeEnableFunctionName($function);
</ins><span class="cx">         my $functionName = $function-&gt;name;
</span><span class="cx">         my $implementationFunction = GetFunctionName($interface, $className, $function);
</span><span class="cx">         my $functionLength = GetFunctionLength($function);
</span><span class="cx">         my $jsAttributes = ComputeFunctionSpecial($interface, $function);
</span><del>-        push(@implContent, &quot;    if (${enable_function}())\n&quot;);
</del><ins>+        push(@implContent, &quot;    if (${enable_function_result})\n&quot;);
</ins><span class="cx"> 
</span><span class="cx">         my $propertyName = &quot;vm.propertyNames-&gt;$functionName&quot;;
</span><span class="cx">         $propertyName = &quot;static_cast&lt;JSVMClientData*&gt;(vm.clientData)-&gt;builtinNames().&quot; . $functionName . &quot;PrivateName()&quot; if $function-&gt;extendedAttributes-&gt;{PrivateIdentifier};
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -1922,7 +1922,7 @@
</span><span class="cx">         JSObject::deleteProperty(this, globalObject()-&gt;globalExec(), propertyName);
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><del>-    if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
</del><ins>+    if (!(RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled() &amp;&amp; RuntimeEnabledFeatures::sharedFeatures().testFeature1Enabled())) {
</ins><span class="cx">         Identifier propertyName = Identifier::fromString(&amp;vm, reinterpret_cast&lt;const LChar*&gt;(&quot;enabledAtRuntimeAttribute&quot;), strlen(&quot;enabledAtRuntimeAttribute&quot;));
</span><span class="cx">         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
</span><span class="cx">         JSObject::deleteProperty(this, globalObject()-&gt;globalExec(), propertyName);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (215199 => 215200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2017-04-10 20:00:55 UTC (rev 215199)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2017-04-10 21:02:16 UTC (rev 215200)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     [Reflect=customContentURLAttr, URL] attribute DOMString reflectedCustomURLAttr;
</span><span class="cx"> 
</span><span class="cx">     // [EnabledAtRuntime] attributes and operations.
</span><del>-    [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] attribute DOMString enabledAtRuntimeAttribute;
</del><ins>+    [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature&amp;TestFeature1] attribute DOMString enabledAtRuntimeAttribute;
</ins><span class="cx">     [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam);
</span><span class="cx">     [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>