Title: [217066] trunk/Source/WebCore
Revision
217066
Author
[email protected]
Date
2017-05-18 14:35:31 -0700 (Thu, 18 May 2017)

Log Message

Bindings: Require value for extended attributes EnabledAtRuntime and EnabledForWorld
https://bugs.webkit.org/show_bug.cgi?id=172252

Reviewed by Sam Weinig.

According to Sam Weinig it is an anti-feature that EnabledAtRuntime can be specified
without a value. We should make it require a value for the name of the RuntimeEnabledFeatures
function to use in the generated code. For similar reasons we should also require
a value for the extended attribute EnabledForWorld.

* Modules/websockets/WebSocket.idl: Substitute EnabledAtRuntime=WebSocket for EnabledAtRuntime.
* bindings/scripts/CodeGeneratorJS.pm:
(GetRuntimeEnableFunctionName):
* html/HTMLAudioElement.idl: Substitute EnabledAtRuntime=Audio for EnabledAtRuntime.
* page/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::audioEnabled):
(WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): Deleted. This function duplicated
the functionality of RuntimeEnabledFeatures::audioEnabled(). Instead we explicitly
write EnabledAtRuntime=Audio in HTMLAudioElement.idl to use RuntimeEnabledFeatures::audioEnabled()
to determine whether to expose/conceal the HTMLAudioElement global constructor at runtime.
* page/RuntimeEnabledFeatures.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217065 => 217066)


--- trunk/Source/WebCore/ChangeLog	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/ChangeLog	2017-05-18 21:35:31 UTC (rev 217066)
@@ -1,3 +1,27 @@
+2017-05-18  Daniel Bates  <[email protected]>
+
+        Bindings: Require value for extended attributes EnabledAtRuntime and EnabledForWorld
+        https://bugs.webkit.org/show_bug.cgi?id=172252
+
+        Reviewed by Sam Weinig.
+
+        According to Sam Weinig it is an anti-feature that EnabledAtRuntime can be specified
+        without a value. We should make it require a value for the name of the RuntimeEnabledFeatures
+        function to use in the generated code. For similar reasons we should also require
+        a value for the extended attribute EnabledForWorld.
+
+        * Modules/websockets/WebSocket.idl: Substitute EnabledAtRuntime=WebSocket for EnabledAtRuntime.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetRuntimeEnableFunctionName):
+        * html/HTMLAudioElement.idl: Substitute EnabledAtRuntime=Audio for EnabledAtRuntime.
+        * page/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::audioEnabled):
+        (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): Deleted. This function duplicated
+        the functionality of RuntimeEnabledFeatures::audioEnabled(). Instead we explicitly
+        write EnabledAtRuntime=Audio in HTMLAudioElement.idl to use RuntimeEnabledFeatures::audioEnabled()
+        to determine whether to expose/conceal the HTMLAudioElement global constructor at runtime.
+        * page/RuntimeEnabledFeatures.h:
+
 2017-05-18  Jer Noble  <[email protected]>
 
         Allow nested timers to propagate user gestures so long as the total nested interval is less than 1s.

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.idl (217065 => 217066)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2017-05-18 21:35:31 UTC (rev 217066)
@@ -36,7 +36,7 @@
     Constructor(USVString url, DOMString protocol),
     ConstructorMayThrowException,
     ConstructorCallWith=ScriptExecutionContext,
-    EnabledAtRuntime,
+    EnabledAtRuntime=WebSocket,
     Exposed=(Window,Worker),
 ] interface WebSocket : EventTarget {
     readonly attribute USVString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (217065 => 217066)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-05-18 21:35:31 UTC (rev 217066)
@@ -2970,11 +2970,12 @@
     AddToImplIncludes("RuntimeEnabledFeatures.h");
 
     if ($context->extendedAttributes->{EnabledForWorld}) {
+        assert("Must specify value for EnabledForWorld.") if $context->extendedAttributes->{EnabledForWorld} eq "VALUE_IS_MISSING";
         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") {
+    if ($context->extendedAttributes->{EnabledAtRuntime}) {
+        assert("Must specify value for EnabledAtRuntime.") if $context->extendedAttributes->{EnabledAtRuntime} eq "VALUE_IS_MISSING";
         my @flags = split /&/, $context->extendedAttributes->{EnabledAtRuntime};
         my $result = "";
         foreach my $flag (@flags) {
@@ -2984,9 +2985,6 @@
         $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()";
 }
 
 sub GetCastingHelperForThisObject

Modified: trunk/Source/WebCore/html/HTMLAudioElement.idl (217065 => 217066)


--- trunk/Source/WebCore/html/HTMLAudioElement.idl	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/html/HTMLAudioElement.idl	2017-05-18 21:35:31 UTC (rev 217066)
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime,
+    EnabledAtRuntime=Audio,
     Conditional=VIDEO,
     ConstructorCallWith=Document,
     NamedConstructor=Audio(optional DOMString src)

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp (217065 => 217066)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2017-05-18 21:35:31 UTC (rev 217066)
@@ -62,11 +62,6 @@
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::htmlAudioElementEnabled() const
-{
-    return MediaPlayer::isAvailable();
-}
-
 bool RuntimeEnabledFeatures::htmlVideoElementEnabled() const
 {
     return MediaPlayer::isAvailable();

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (217065 => 217066)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-05-18 21:14:04 UTC (rev 217065)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-05-18 21:35:31 UTC (rev 217066)
@@ -201,7 +201,6 @@
 #if ENABLE(VIDEO)
     bool audioEnabled() const;
     bool htmlMediaElementEnabled() const;
-    bool htmlAudioElementEnabled() const;
     bool htmlVideoElementEnabled() const;
     bool htmlSourceElementEnabled() const;
     bool mediaControllerEnabled() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to