Bug 1705705 [wpt PR 28543] - [idlharness.js] Drop support for [Constructor] extended attributes, a=testonly
authorPhilip Jägenstedt <philip@foolip.org>
Fri, 23 Apr 2021 10:21:35 +0000
changeset 577282 c55e1f69fdb49ece151f770ebeea835d7b1056d8
parent 577281 5057120ee8ccfdf1807fd33dd534e05fb09de79a
child 577283 40a18d383fd68d890164d400d973df18dc2fd464
push id141827
push userwptsync@mozilla.com
push dateSat, 24 Apr 2021 02:11:12 +0000
treeherderautoland@3a7d9d49c316 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1705705, 28543
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1705705 [wpt PR 28543] - [idlharness.js] Drop support for [Constructor] extended attributes, a=testonly Automatic update from web-platform-tests [idlharness.js] Drop support for [Constructor] extended attributes (#28543) These are complete gone from interfaces/*.idl so this code is unused. -- wpt-commits: b9feb6c7a65f986cc30aa1d4a0933e3b11053c1a wpt-pr: 28543
testing/web-platform/tests/resources/idlharness.js
testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html
testing/web-platform/tests/resources/test/tests/unit/IdlInterface/constructors.html
testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
testing/web-platform/tests/webvr/idlharness.https.html
--- a/testing/web-platform/tests/resources/idlharness.js
+++ b/testing/web-platform/tests/resources/idlharness.js
@@ -1598,25 +1598,20 @@ IdlInterface.prototype.test = function()
     // members might themselves be marked as .untested.  This might happen to
     // interfaces if the interface itself is untested but a partial interface
     // that extends it is tested -- then the interface itself and its initial
     // members will be marked as untested, but the members added by the partial
     // interface are still tested.
     this.test_members();
 };
 
-// This supports both Constructor extended attributes and constructor
-// operations until all idl fragments have been updated.
 IdlInterface.prototype.constructors = function()
 {
-    var extendedAttributes = this.extAttrs
-        .filter(function(attr) { return attr.name == "Constructor"; });
-    var operations = this.members
+    return this.members
         .filter(function(m) { return m.type == "constructor"; });
-    return extendedAttributes.concat(operations);
 }
 
 IdlInterface.prototype.test_self = function()
 {
     subsetTestByKey(this.name, test, function()
     {
         // This function tests WebIDL as of 2015-01-13.
 
@@ -1691,21 +1686,17 @@ IdlInterface.prototype.test_self = funct
             // "If the interface doesn't inherit from any other interface, the
             // value of [[Prototype]] is %FunctionPrototype% ([ECMA-262],
             // section 6.1.7.4)."
             assert_equals(prototype, Function.prototype,
                           "prototype of self's property " + format_value(this.name) + " is not Function.prototype");
         }
 
         if (!this.constructors().length) {
-            // "The internal [[Call]] method of the interface object behaves as
-            // follows . . .
-            //
-            // "If I was not declared with a [Constructor] extended attribute,
-            // then throw a TypeError."
+            // "If I was not declared with a constructor operation, then throw a TypeError."
             var interface_object = this.get_interface_object();
             assert_throws_js(globalOf(interface_object).TypeError, function() {
                 interface_object();
             }, "interface object didn't throw TypeError when called as a function");
             assert_throws_js(globalOf(interface_object).TypeError, function() {
                 new interface_object();
             }, "interface object didn't throw TypeError when called as a constructor");
         }
--- a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
+++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
@@ -28,18 +28,18 @@ Object.defineProperty(window.Foo, "proto
 Foo.prototype[Symbol.toStringTag] = "Foo";
 
 var idlArray = new IdlArray();
 idlArray.add_untested_idls("interface EventTarget {};");
 idlArray.add_idls(
     "[Global=Window, Exposed=Window]\n" +
     "interface Window : EventTarget {};\n" +
 
-    "[Global=Window, Exposed=Window, Constructor()]\n" +
-    "interface Foo {};"
+    "[Global=Window, Exposed=Window]\n" +
+    "interface Foo { constructor(); };"
   );
 idlArray.add_objects({
   Foo: ["new Foo()"],
   Window: ["window"]
 });
 idlArray.test();
 </script>
 <script type="text/json" id="expected">
--- a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html
+++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html
@@ -35,18 +35,17 @@ Object.defineProperty(window.Foo.prototy
     value: window.Foo
   });
 Object.setPrototypeOf(Foo, FooParent);
 Foo.prototype[Symbol.toStringTag] = "Foo";
 
 var idlArray = new IdlArray();
 idlArray.add_untested_idls("interface FooParent {};");
 idlArray.add_idls(
-    "[Constructor()]\n" +
-    "interface Foo : FooParent {};"
+    "interface Foo : FooParent { constructor(); };"
   );
 idlArray.add_objects({
   Foo: ["new Foo()"],
   FooParent: ["new FooParent()"]
 });
 idlArray.test();
 </script>
 <script type="text/json" id="expected">
--- a/testing/web-platform/tests/resources/test/tests/unit/IdlInterface/constructors.html
+++ b/testing/web-platform/tests/resources/test/tests/unit/IdlInterface/constructors.html
@@ -3,23 +3,24 @@
 <div id="log"></div>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/WebIDLParser.js"></script>
 <script src="/resources/idlharness.js"></script>
 <script src="../../../idl-helper.js"></script>
 <script>
 "use strict";
+// [Constructor] extended attribute should not be supported:
 test(function() {
     var i = interfaceFrom('[Constructor] interface A { };');
-    assert_equals(i.constructors().length, 1);
+    assert_equals(i.constructors().length, 0);
 }, 'Interface with Constructor extended attribute.');
 
 test(function() {
     var i = interfaceFrom('interface A { constructor(); };');
     assert_equals(i.constructors().length, 1);
 }, 'Interface with constructor method');
 
 test(function() {
-    var i = interfaceFrom('[Constructor] interface A { constructor(); };');
+    var i = interfaceFrom('interface A { constructor(); constructor(any value); };');
     assert_equals(i.constructors().length, 2);
-}, 'Interface with both');
+}, 'Interface with constructor overloads');
 </script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
@@ -68,17 +68,17 @@ for (const args of gTestArguments) {
   test(t => {
     const effect = args.createEffect();
     const animation = new Animation(effect, args.timeline);
 
     assert_not_equals(animation, null,
                       'An animation sohuld be created');
     assert_equals(animation.effect, effect,
                   'Animation returns the same effect passed to ' +
-                  'the Constructor');
+                  'the constructor');
     assert_equals(animation.timeline, args.expectedTimeline,
                   'Animation timeline should be ' + args.expectedTimelineDescription);
     assert_equals(animation.playState, 'idle',
                   'Animation.playState should be initially \'idle\'');
   }, 'Animation can be constructed ' + args.description);
 }
 
 test(t => {
--- a/testing/web-platform/tests/webvr/idlharness.https.html
+++ b/testing/web-platform/tests/webvr/idlharness.https.html
@@ -139,18 +139,19 @@ interface VRPose {
   readonly attribute Float32Array? linearVelocity;
   readonly attribute Float32Array? linearAcceleration;
 
   readonly attribute Float32Array? orientation;
   readonly attribute Float32Array? angularVelocity;
   readonly attribute Float32Array? angularAcceleration;
 };
 
-[Constructor]
 interface VRFrameData {
+  constructor();
+
   readonly attribute Float32Array leftProjectionMatrix;
   readonly attribute Float32Array leftViewMatrix;
 
   readonly attribute Float32Array rightProjectionMatrix;
   readonly attribute Float32Array rightViewMatrix;
 
   readonly attribute VRPose pose;
 };
@@ -177,18 +178,18 @@ partial interface Navigator {
 
 enum VRDisplayEventReason {
   "mounted",
   "navigation",
   "requested",
   "unmounted"
 };
 
-[Constructor(DOMString type, VRDisplayEventInit eventInitDict)]
 interface VRDisplayEvent : Event {
+  constructor(DOMString type, VRDisplayEventInit eventInitDict);
   readonly attribute VRDisplay display;
   readonly attribute VRDisplayEventReason? reason;
 };
 
 dictionary VRDisplayEventInit : EventInit {
   required VRDisplay display;
   VRDisplayEventReason reason;
 };