Title: [217235] trunk/Source/WebCore
Revision
217235
Author
[email protected]
Date
2017-05-22 12:14:14 -0700 (Mon, 22 May 2017)

Log Message

Add support for [LegacyWindowAlias] IDL extended attribute
https://bugs.webkit.org/show_bug.cgi?id=172451

Reviewed by Sam Weinig.

Add support for [LegacyWindowAlias] IDL extended attribute as per:
- https://heycam.github.io/webidl/#LegacyWindowAlias

Use it for our legacy window aliases, such as webKitURL.

No new tests, there should be no Web-exposed behavior change.

* bindings/scripts/IDLAttributes.json:
* bindings/scripts/preprocess-idls.pl:
(GenerateConstructorAttributes):
* css/DOMMatrix.idl:
* dom/MutationObserver.idl:
* dom/XMLDocument.idl:
* html/DOMURL.idl:
* page/DOMWindow.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217234 => 217235)


--- trunk/Source/WebCore/ChangeLog	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/ChangeLog	2017-05-22 19:14:14 UTC (rev 217235)
@@ -1,3 +1,26 @@
+2017-05-22  Chris Dumez  <[email protected]>
+
+        Add support for [LegacyWindowAlias] IDL extended attribute
+        https://bugs.webkit.org/show_bug.cgi?id=172451
+
+        Reviewed by Sam Weinig.
+
+        Add support for [LegacyWindowAlias] IDL extended attribute as per:
+        - https://heycam.github.io/webidl/#LegacyWindowAlias
+
+        Use it for our legacy window aliases, such as webKitURL.
+
+        No new tests, there should be no Web-exposed behavior change.
+
+        * bindings/scripts/IDLAttributes.json:
+        * bindings/scripts/preprocess-idls.pl:
+        (GenerateConstructorAttributes):
+        * css/DOMMatrix.idl:
+        * dom/MutationObserver.idl:
+        * dom/XMLDocument.idl:
+        * html/DOMURL.idl:
+        * page/DOMWindow.idl:
+
 2017-05-22  Jer Noble  <[email protected]>
 
         ASSERTION FAILED: m_boundThread == currentThread() in WTF::WeakReference<WebCore::WebCoreDecompressionSession>::clear()

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (217234 => 217235)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2017-05-22 19:14:14 UTC (rev 217235)
@@ -272,6 +272,13 @@
                 "url": "https://heycam.github.io/webidl/#LegacyUnenumerableNamedProperties"
             }
         },
+        "LegacyWindowAlias": {
+            "contextsAllowed": ["interface"],
+            "values": ["*"],
+            "standard": {
+                "url": "https://heycam.github.io/webidl/#LegacyWindowAlias"
+            }
+        },
         "LenientSetter": {
             "contextsAllowed": ["attribute"],
             "standard": {

Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (217234 => 217235)


--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -127,7 +127,7 @@
             my $exposedAttribute = $extendedAttributes->{"Exposed"} || "Window";
             $exposedAttribute = substr($exposedAttribute, 1, -1) if substr($exposedAttribute, 0, 1) eq "(";
             my @globalContexts = split(",", $exposedAttribute);
-            my $attributeCode = GenerateConstructorAttribute($interfaceName, $extendedAttributes);
+            my ($attributeCode, $windowAliases) = GenerateConstructorAttributes($interfaceName, $extendedAttributes);
             foreach my $globalContext (@globalContexts) {
                 if ($globalContext eq "Window") {
                     $windowConstructorsCode .= $attributeCode;
@@ -139,6 +139,7 @@
                     die "Unsupported global context '$globalContext' used in [Exposed] at $idlFile";
                 }
             }
+            $windowConstructorsCode .= $windowAliases if $windowAliases;
         }
     }
 }
@@ -238,7 +239,7 @@
     $supplementalDependencies{$fullPath} = [$interfaceName] if $interfaceNameToIdlFile{$interfaceName};
 }
 
-sub GenerateConstructorAttribute
+sub GenerateConstructorAttributes
 {
     my $interfaceName = shift;
     my $extendedAttributes = shift;
@@ -266,7 +267,20 @@
         $code .= "[" . join(', ', @extendedAttributesList) . "] " if @extendedAttributesList;
         $code .= "attribute " . $originalInterfaceName . "NamedConstructor $constructorName;\n";
     }
-    return $code;
+    
+    my $windowAliasesCode;
+    if ($extendedAttributes->{"LegacyWindowAlias"}) {
+        my $attributeValue = $extendedAttributes->{"LegacyWindowAlias"};
+        $attributeValue = substr($attributeValue, 1, -1) if substr($attributeValue, 0, 1) eq "(";
+        my @windowAliases = split(",", $attributeValue);
+        foreach my $windowAlias (@windowAliases) {
+            $windowAliasesCode .= "    ";
+            $windowAliasesCode .= "[" . join(', ', @extendedAttributesList) . "] " if @extendedAttributesList;
+            $windowAliasesCode .= "attribute " . $originalInterfaceName . "Constructor $windowAlias; // Legacy Window alias.\n";
+        }
+    }
+    
+    return ($code, $windowAliasesCode);
 }
 
 sub getFileContents

Modified: trunk/Source/WebCore/css/DOMMatrix.idl (217234 => 217235)


--- trunk/Source/WebCore/css/DOMMatrix.idl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/css/DOMMatrix.idl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -24,6 +24,7 @@
  */
 
 // FIXME: Should be exposed to workers as well.
+// FIXME: Should be [LegacyWindowAlias=(SVGMatrix, WebKitCSSMatrix)].
 [
     Constructor(optional (DOMString or sequence<unrestricted double>) init),
     ConstructorMayThrowException,

Modified: trunk/Source/WebCore/dom/MutationObserver.idl (217234 => 217235)


--- trunk/Source/WebCore/dom/MutationObserver.idl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/dom/MutationObserver.idl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -32,6 +32,7 @@
     CustomConstructor(MutationCallback callback),
     CustomIsReachable,
     ImplementationLacksVTable,
+    LegacyWindowAlias=WebKitMutationObserver,
 ] interface MutationObserver {
     [MayThrowException] void observe(Node target, optional MutationObserverInit options);
     void disconnect();

Modified: trunk/Source/WebCore/dom/XMLDocument.idl (217234 => 217235)


--- trunk/Source/WebCore/dom/XMLDocument.idl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/dom/XMLDocument.idl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -24,6 +24,7 @@
  */
 [
     CustomToJSObject,
+    LegacyWindowAlias=SVGDocument,
 ] interface XMLDocument : Document
 {
 };

Modified: trunk/Source/WebCore/html/DOMURL.idl (217234 => 217235)


--- trunk/Source/WebCore/html/DOMURL.idl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/html/DOMURL.idl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -24,17 +24,19 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// FIXME: Constructor should be Constructor(USVString url, optional USVString base).
 [
-    Exposed=(Window,Worker),
     Constructor(USVString url),
     Constructor(USVString url, USVString base),
     Constructor(USVString url, DOMURL base),
     ConstructorMayThrowException,
+    ExportMacro=WEBCORE_EXPORT,
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable,
+    InterfaceName=URL,
+    JSGenerateToJSObject,
     JSGenerateToNativeObject,
-    JSGenerateToJSObject,
-    InterfaceName=URL,
-    ImplementationLacksVTable,
-    ExportMacro=WEBCORE_EXPORT
+    LegacyWindowAlias=webkitURL,
 ] interface DOMURL {
     [SetterMayThrowException, URL] stringifier attribute USVString href;
     readonly attribute USVString origin;

Modified: trunk/Source/WebCore/page/DOMWindow.idl (217234 => 217235)


--- trunk/Source/WebCore/page/DOMWindow.idl	2017-05-22 19:02:11 UTC (rev 217234)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2017-05-22 19:14:14 UTC (rev 217235)
@@ -154,8 +154,6 @@
     [Replaceable] readonly attribute  boolean offscreenBuffering;
     [Replaceable] readonly attribute long screenLeft;
     [Replaceable] readonly attribute long screenTop;
-    attribute DOMURLConstructor webkitURL; // FIXME: Deprecate this.
-    attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Remove once we prove it is not needed for compatibility with legacy content.
     long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
     [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
     [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id);
@@ -177,9 +175,6 @@
     WebKitPoint webkitConvertPointFromPageToNode(optional Node? node = null, optional WebKitPoint? p = null);
     WebKitPoint webkitConvertPointFromNodeToPage(optional Node? node = null, optional WebKitPoint? p = null);
 
-    // Alias for background compatibility as we use to have a SVGDocument interface.
-    attribute XMLDocumentConstructor SVGDocument;
-
     // Internal operations, not exposed to the Web.
     [MayThrowException, EnabledForWorld=shadowRootIsAlwaysOpen] NodeList collectMatchingElementsInFlatTree(Node scope, DOMString selectors);
     [MayThrowException, EnabledForWorld=shadowRootIsAlwaysOpen] Element? matchingElementInFlatTree(Node scope, DOMString selectors);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to