Title: [215200] trunk/Source/WebCore
Revision
215200
Author
commit-qu...@webkit.org
Date
2017-04-10 14:02:16 -0700 (Mon, 10 Apr 2017)

Log Message

Wrap legacy MediaStream API in runtime flag
https://bugs.webkit.org/show_bug.cgi?id=169877

Patch by Youenn Fablet <you...@apple.com> 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215199 => 215200)


--- 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)
@@ -1,5 +1,27 @@
 2017-04-10  Youenn Fablet  <you...@apple.com>
 
+        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  <you...@apple.com>
+
         Remove deprecated parts of media stream spec
         https://bugs.webkit.org/show_bug.cgi?id=169879
 

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamEvent.idl (215199 => 215200)


--- 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)
@@ -22,11 +22,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// FIXME 169871: legacy or remove
 [
     Conditional=WEB_RTC,
     Constructor(DOMString type, optional MediaStreamEventInit eventInitDict),
-    EnabledAtRuntime=MediaStream,
+    EnabledAtRuntime=WebRTCLegacyAPI&MediaStream,
 ] interface MediaStreamEvent : Event {
     readonly attribute MediaStream? stream;
 };

Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl (215199 => 215200)


--- 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)
@@ -29,9 +29,8 @@
 */
 
 [
-    Conditional=MEDIA_STREAM,
-    EnabledAtRuntime=MediaStream,
+    Conditional=MEDIA_STREAM&WEB_RTC,
+    EnabledAtRuntime=WebRTCLegacyAPI&MediaStream,
 ] partial interface Navigator {
-    // FIXME 169871: wrap legacy setting
     [JSBuiltin] void getUserMedia(MediaStreamConstraints constraints, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback);
 };

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (215199 => 215200)


--- 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)
@@ -2910,7 +2910,7 @@
 }
 
 # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled.
-# NOTE: Parameter passed in must have both an 'extendedAttributes' property.
+# NOTE: Parameter passed in must have an 'extendedAttributes' property.
 #  (e.g. DOMInterface, DOMAttribute, DOMOperation, DOMIterable, etc.)
 sub GetRuntimeEnableFunctionName
 {
@@ -2917,18 +2917,25 @@
     my $context = shift;
 
     AddToImplIncludes("RuntimeEnabledFeatures.h");
-    
+
     if ($context->extendedAttributes->{EnabledForWorld}) {
-        return "worldForDOMObject(this)." . ToMethodName($context->extendedAttributes->{EnabledForWorld});
+        return "worldForDOMObject(this)." . ToMethodName($context->extendedAttributes->{EnabledForWorld}) . "()";
     }
 
     # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::sharedFeatures().{FeatureName}Enabled() method.
     if ($context->extendedAttributes->{EnabledAtRuntime} && $context->extendedAttributes->{EnabledAtRuntime} ne "VALUE_IS_MISSING") {
-        return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->extendedAttributes->{EnabledAtRuntime}) . "Enabled";
+        my @flags = split /&/, $context->extendedAttributes->{EnabledAtRuntime};
+        my $result = "";
+        foreach my $flag (@flags) {
+            $result .= " && " unless length $result eq 0;
+            $result .= "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($flag) . "Enabled()"
+        }
+        $result = "(" . $result . ")" unless scalar @flags eq 1;
+        return $result;
     }
 
     # Otherwise return a function named RuntimeEnabledFeatures::sharedFeatures().{methodName}Enabled().
-    return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->name) . "Enabled";
+    return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->name) . "Enabled()";
 }
 
 sub GetCastingHelperForThisObject
@@ -3347,9 +3354,9 @@
             my $conditionalString = $codeGenerator->GenerateConditionalString($functionOrAttribute);
             push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
             AddToImplIncludes("RuntimeEnabledFeatures.h");
-            my $enable_function = GetRuntimeEnableFunctionName($functionOrAttribute);
+            my $enable_function_result = GetRuntimeEnableFunctionName($functionOrAttribute);
             my $name = $functionOrAttribute->name;
-            push(@implContent, "    if (!${enable_function}()) {\n");
+            push(@implContent, "    if (!${enable_function_result}) {\n");
             push(@implContent, "        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
             push(@implContent, "        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n");
             push(@implContent, "        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);\n");
@@ -3456,9 +3463,9 @@
 
         my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
         push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-        my $enable_function = GetRuntimeEnableFunctionName($attribute);
+        my $enable_function_result = GetRuntimeEnableFunctionName($attribute);
         my $attributeName = $attribute->name;
-        push(@implContent, "    if (${enable_function}()) {\n");
+        push(@implContent, "    if (${enable_function_result}) {\n");
         my $getter = GetAttributeGetterName($interface, $className, $attribute);
         my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interface, $className, $attribute);
         push(@implContent, "        auto* customGetterSetter = CustomGetterSetter::create(vm, $getter, $setter);\n");
@@ -3491,12 +3498,12 @@
 
         my $conditionalString = $codeGenerator->GenerateConditionalString($function);
         push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-        my $enable_function = GetRuntimeEnableFunctionName($function);
+        my $enable_function_result = GetRuntimeEnableFunctionName($function);
         my $functionName = $function->name;
         my $implementationFunction = GetFunctionName($interface, $className, $function);
         my $functionLength = GetFunctionLength($function);
         my $jsAttributes = ComputeFunctionSpecial($interface, $function);
-        push(@implContent, "    if (${enable_function}())\n");
+        push(@implContent, "    if (${enable_function_result})\n");
 
         my $propertyName = "vm.propertyNames->$functionName";
         $propertyName = "static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $functionName . "PrivateName()" if $function->extendedAttributes->{PrivateIdentifier};

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


--- 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)
@@ -1922,7 +1922,7 @@
         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
     }
 #if ENABLE(TEST_FEATURE)
-    if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
+    if (!(RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled() && RuntimeEnabledFeatures::sharedFeatures().testFeature1Enabled())) {
         Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttribute"), strlen("enabledAtRuntimeAttribute"));
         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (215199 => 215200)


--- 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)
@@ -105,7 +105,7 @@
     [Reflect=customContentURLAttr, URL] attribute DOMString reflectedCustomURLAttr;
 
     // [EnabledAtRuntime] attributes and operations.
-    [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] attribute DOMString enabledAtRuntimeAttribute;
+    [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature&TestFeature1] attribute DOMString enabledAtRuntimeAttribute;
     [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam);
     [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to