From 05f32d39827cc20c250beae9a535d0e9df44ee38 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Tue, 16 May 2017 15:29:39 +0200 Subject: [PATCH 1/5] Add [LegacyWindowAlias] extended attribute for WebKitCSSMatrix et al Fixes #362. --- index.bs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/index.bs b/index.bs index 1ec25f51..36039e21 100644 --- a/index.bs +++ b/index.bs @@ -940,6 +940,7 @@ limitations. The following extended attributes must not be specified on partial interface definitions: [{{Constructor}}], [{{LegacyArrayClass}}], +[{{LegacyWindowAlias}}], [{{NamedConstructor}}], [{{NoInterfaceObject}}]. @@ -965,6 +966,7 @@ The following extended attributes are applicable to interfaces: [{{Exposed}}], [{{Global}}], [{{LegacyArrayClass}}], +[{{LegacyWindowAlias}}], [{{NamedConstructor}}], [{{NoInterfaceObject}}], [{{OverrideBuiltins}}], @@ -8867,6 +8869,34 @@ is to be implemented. +

[LegacyWindowAlias]

+ +The [{{LegacyWindowAlias}}] +[=extended attribute=] +must either +[=takes an identifier|take an identifier=] or +[=takes an identifier list|take an identifier list=]. + +If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, +then for each identifier |id| mentioned in the extended attribute, +the [=primary global interface=] must +have a property named |id|, +which is the legacy window alias, +with attributes +{ \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true } +whose value is a reference to the [=interface object=] for the interface. + +The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}] +extended attributes must not be specified on the same interface. + +

+ [{{LegacyWindowAlias}}] extended attributes are an undesirable feature. + They exist only so that legacy Web platform features can be specified. + They should not be used in specifications + unless required to specify the behavior of legacy APIs. +

+ +

[NamedConstructor]

If the [{{NamedConstructor}}] From 85f1693740c43214e8b5d04e9dab4cc0fc78744e Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 17 May 2017 10:30:22 +0200 Subject: [PATCH 2/5] Address review comments --- index.bs | 108 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 28 deletions(-) diff --git a/index.bs b/index.bs index 36039e21..8dbc8d7e 100644 --- a/index.bs +++ b/index.bs @@ -8727,6 +8727,71 @@ for the specific requirements that the use of entails. +

[LegacyWindowAlias]

+ +If the [{{LegacyWindowAlias}}] [=extended attribute=] appears on an [=interface=], +it indicates that the [=primary global interface=] will have a property +for each identifier mentioned in the extended attribute, +whose value is the [=interface object=] for the interface. + +The [{{LegacyWindowAlias}}] [=extended attribute=] must either +[=takes an identifier|take an identifier=] or +[=takes an identifier list|take an identifier list=]. + +The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}] +extended attributes must not be specified on the same interface. + +The [{{LegacyWindowAlias}}] extended attribute must not be specified +on an interface that does not include the [=primary global interface=] +in its [=exposure set=]. + +The [{{LegacyWindowAlias}}] extended attribute must not be specified +on a [=callback interface=]. + +An interface must not have more than one [{{LegacyWindowAlias}}] extended attributes specified. + +See [[#legacy-window-alias]] for details on how legacy window aliases +are to be implemented. + +

+ [{{LegacyWindowAlias}}] extended attributes are an undesirable feature. + They exist only so that legacy Web platform features can be specified. + They should not be used in specifications + unless required to specify the behavior of legacy APIs. +

+ +
+ + The following IDL defines an interface that uses the + [{{LegacyWindowAlias}}] extended attribute. + +
+        [Constructor,
+         LegacyWindowAlias=WebKitCSSMatrix]
+        interface DOMMatrix : DOMMatrixReadOnly {
+          // ...
+        };
+    
+ + An ECMAScript implementation that supports this interface will + expose two properties on the {{Window}} object with the same value + and the same characteristics; + one for exposing the [=interface object=] normally, + and one for exposing it with a legacy name. + +
+        WebKitCSSMatrix === DOMMatrix;     // Evaluates to true.
+
+        var m = new WebKitCSSMatrix();     // Creates a new object that
+                                           // implements DOMMatrix.
+
+        m.constructor === DOMMatrix;       // Evaluates to true.
+        m.constructor === WebKitCSSMatrix; // Evaluates to true.
+        {}.toString.call(m);               // Evaluates to '[object DOMMatrix]'.
+    
+
+ +

[LenientSetter]

If the [{{LenientSetter}}] @@ -8869,34 +8934,6 @@ is to be implemented. -

[LegacyWindowAlias]

- -The [{{LegacyWindowAlias}}] -[=extended attribute=] -must either -[=takes an identifier|take an identifier=] or -[=takes an identifier list|take an identifier list=]. - -If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, -then for each identifier |id| mentioned in the extended attribute, -the [=primary global interface=] must -have a property named |id|, -which is the legacy window alias, -with attributes -{ \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true } -whose value is a reference to the [=interface object=] for the interface. - -The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}] -extended attributes must not be specified on the same interface. - -

- [{{LegacyWindowAlias}}] extended attributes are an undesirable feature. - They exist only so that legacy Web platform features can be specified. - They should not be used in specifications - unless required to specify the behavior of legacy APIs. -

- -

[NamedConstructor]

If the [{{NamedConstructor}}] @@ -10232,6 +10269,21 @@ the typeof operator will return "function" when applied to an inter +

Legacy window alias

+ +If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, +then for each identifier |id| mentioned in the extended attribute, +there must be a corresponding property, +known as the legacy window alias, +on the [=primary global interface=]. +The property has the following characteristics: + +* The name of the property is |id|. +* The value of the property is a reference to the [=interface object=] for the interface. +* The property has attributes + { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. + +

Named constructors

A [=named constructor=] that exists due to one or more From 44cf5132b5981ffaded4ff587b3e54c901b1c1d8 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 17 May 2017 12:37:18 +0200 Subject: [PATCH 3/5] Move and rephrase per tobie's comment --- index.bs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/index.bs b/index.bs index 8dbc8d7e..2118a663 100644 --- a/index.bs +++ b/index.bs @@ -8750,7 +8750,7 @@ on a [=callback interface=]. An interface must not have more than one [{{LegacyWindowAlias}}] extended attributes specified. -See [[#legacy-window-alias]] for details on how legacy window aliases +See [[#es-interfaces]] for details on how legacy window aliases are to be implemented.

@@ -10186,6 +10186,15 @@ and its value is an object called the inte The property has the attributes { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. The characteristics of an interface object are described in [[#interface-object]]. +If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, +then for each [=identifier=] mentioned in the extended attribute, +there must be a corresponding property on the [=primary global interface=], +known as the legacy window alias. +The name of the property is the [=legacy window alias=]'s [=identifier=], +and its value is a reference to the [=interface object=] for the [=interface=]. +The property has the attributes +{ \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. + In addition, for every [{{NamedConstructor}}] extended attribute on an [=exposed=] interface, a corresponding property must exist on the ECMAScript global object. The name of the property is the [{{NamedConstructor}}]'s [=NamedConstructor identifier|identifier=], @@ -10269,21 +10278,6 @@ the typeof operator will return "function" when applied to an inter -

Legacy window alias

- -If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, -then for each identifier |id| mentioned in the extended attribute, -there must be a corresponding property, -known as the legacy window alias, -on the [=primary global interface=]. -The property has the following characteristics: - -* The name of the property is |id|. -* The value of the property is a reference to the [=interface object=] for the interface. -* The property has attributes - { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. - -

Named constructors

A [=named constructor=] that exists due to one or more From 7b0758c6787395bf6fe2f84c1d1d93262e2afba6 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 18 May 2017 12:50:04 +0200 Subject: [PATCH 4/5] Address review comments --- index.bs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 2118a663..d05cbff5 100644 --- a/index.bs +++ b/index.bs @@ -8731,13 +8731,25 @@ entails. If the [{{LegacyWindowAlias}}] [=extended attribute=] appears on an [=interface=], it indicates that the [=primary global interface=] will have a property -for each identifier mentioned in the extended attribute, +for each [=identifier=] mentioned in the extended attribute, whose value is the [=interface object=] for the interface. The [{{LegacyWindowAlias}}] [=extended attribute=] must either [=takes an identifier|take an identifier=] or [=takes an identifier list|take an identifier list=]. +A [{{LegacyWindowAlias}}]'s identifiers +is a list containing all of the [=identifiers=] mentioned in the extended attribute. + +Each of the [=identifiers=] in the +[{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifiers|identifiers=] +must not be the same as one used by a [{{LegacyWindowAlias}}] +extended attribute on this interface or another interface, +must not be the same as that used by a [{{NamedConstructor}}] +extended attribute on this interface or another interface, +must not be the same as an identifier of an interface that has an [=interface object=], +and must not be one of the [=reserved identifiers=]. + The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}] extended attributes must not be specified on the same interface. @@ -8961,6 +8973,8 @@ that is the value of the aforementioned property. The [=NamedConstructor identifier|identifier=] used for the named constructor must not be the same as that used by an [{{NamedConstructor}}] extended attribute on another interface, must not +be the same as one used by an [{{LegacyWindowAlias}}] +extended attribute on this interface or another interface, be the same as an identifier of an interface that has an [=interface object=], and must not be one of the @@ -10186,11 +10200,10 @@ and its value is an object called the inte The property has the attributes { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. The characteristics of an interface object are described in [[#interface-object]]. -If the [{{LegacyWindowAlias}}] extended attribute was specified on an interface, -then for each [=identifier=] mentioned in the extended attribute, -there must be a corresponding property on the [=primary global interface=], -known as the legacy window alias. -The name of the property is the [=legacy window alias=]'s [=identifier=], +If the [{{LegacyWindowAlias}}] extended attribute was specified on an [=exposed=] interface, +then for each [=identifier=] in the [{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifiers|identifiers=], +there must be a corresponding property on the [=primary global interface=]. +The name of the property is the given [=identifier=], and its value is a reference to the [=interface object=] for the [=interface=]. The property has the attributes { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }. From d346eb092b9a643c8a22ad2ca70d2ca2ee3af0e9 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Thu, 18 May 2017 18:38:03 +0200 Subject: [PATCH 5/5] Edit language. * Turn "LegacyWindowAlias identifiers" dfn from a list to an identifier. * Fix a forgotten "must not". * Reference identifiers according to their extended attribute. --- index.bs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/index.bs b/index.bs index d05cbff5..4657110e 100644 --- a/index.bs +++ b/index.bs @@ -8734,20 +8734,18 @@ it indicates that the [=primary global interface=] will have a property for each [=identifier=] mentioned in the extended attribute, whose value is the [=interface object=] for the interface. -The [{{LegacyWindowAlias}}] [=extended attribute=] must either +The [{{LegacyWindowAlias}}] extended attribute must either [=takes an identifier|take an identifier=] or [=takes an identifier list|take an identifier list=]. +The identifiers that occur after the +“=” are the [{{LegacyWindowAlias}}]'s identifiers. -A [{{LegacyWindowAlias}}]'s identifiers -is a list containing all of the [=identifiers=] mentioned in the extended attribute. - -Each of the [=identifiers=] in the -[{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifiers|identifiers=] +Each of the [=LegacyWindowAlias identifier|identifiers=] of [{{LegacyWindowAlias}}] must not be the same as one used by a [{{LegacyWindowAlias}}] extended attribute on this interface or another interface, -must not be the same as that used by a [{{NamedConstructor}}] +must not be the same as the [=NamedConstructor identifier|identifier=] used by a [{{NamedConstructor}}] extended attribute on this interface or another interface, -must not be the same as an identifier of an interface that has an [=interface object=], +must not be the same as an [=identifier=] of an interface that has an [=interface object=], and must not be one of the [=reserved identifiers=]. The [{{LegacyWindowAlias}}] and [{{NoInterfaceObject}}] @@ -8971,11 +8969,11 @@ implements the interface by passing the specified arguments to the constructor f that is the value of the aforementioned property. The [=NamedConstructor identifier|identifier=] used for the named constructor must not -be the same as that used by an [{{NamedConstructor}}] +be the same as that used by a [{{NamedConstructor}}] extended attribute on another interface, must not -be the same as one used by an [{{LegacyWindowAlias}}] +be the same as an [=LegacyWindowAlias identifier|identifier=] used by a [{{LegacyWindowAlias}}] extended attribute on this interface or another interface, -be the same as an identifier of an interface +must not be the same as an [=identifier=] of an interface that has an [=interface object=], and must not be one of the [=reserved identifiers=]. @@ -10201,9 +10199,9 @@ The property has the attributes { \[[Writable]]: true, \[[Enu The characteristics of an interface object are described in [[#interface-object]]. If the [{{LegacyWindowAlias}}] extended attribute was specified on an [=exposed=] interface, -then for each [=identifier=] in the [{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifiers|identifiers=], +then for each [=LegacyWindowAlias identifier|identifier=] in [{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifier|identifiers=] there must be a corresponding property on the [=primary global interface=]. -The name of the property is the given [=identifier=], +The name of the property is the given [=LegacyWindowAlias identifier|identifier=], and its value is a reference to the [=interface object=] for the [=interface=]. The property has the attributes { \[[Writable]]: true, \[[Enumerable]]: false, \[[Configurable]]: true }.