Update interfaces/html.idl (#23150)

Includes necessary idlharness.js updates (handling XYZ --> LegacyXYZ
renames) for https://github.com/web-platform-tests/wpt/issues/23148

Closes https://github.com/web-platform-tests/wpt/pull/23124
diff --git a/interfaces/html.idl b/interfaces/html.idl
index a8b9b42..c9018f1 100644
--- a/interfaces/html.idl
+++ b/interfaces/html.idl
@@ -45,10 +45,10 @@
 enum DocumentReadyState { "loading", "interactive", "complete" };
 typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
 
-[OverrideBuiltins]
+[LegacyOverrideBuiltIns]
 partial interface Document {
   // resource metadata management
-  [PutForwards=href, Unforgeable] readonly attribute Location? location;
+  [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
   attribute USVString domain;
   readonly attribute USVString referrer;
   attribute USVString cookie;
@@ -89,7 +89,7 @@
   DOMString queryCommandValue(DOMString commandId);
 
   // special event handler IDL attributes that only apply to Document objects
-  [LenientThis] attribute EventHandler onreadystatechange;
+  [LegacyLenientThis] attribute EventHandler onreadystatechange;
 
   // also has obsolete members
 };
@@ -119,7 +119,7 @@
   [CEReactions] attribute boolean spellcheck;
   [CEReactions] attribute DOMString autocapitalize;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
 
   ElementInternals attachInternals();
 };
@@ -145,7 +145,7 @@
 };
 
 [Exposed=Window,
- OverrideBuiltins]
+ LegacyOverrideBuiltIns]
 interface DOMStringMap {
   getter DOMString (DOMString name);
   [CEReactions] setter void (DOMString name, DOMString value);
@@ -365,7 +365,7 @@
 };
 
 [Exposed=Window,
- NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
+ LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height)]
 interface HTMLImageElement : HTMLElement {
   [HTMLConstructor] constructor();
 
@@ -463,7 +463,7 @@
 };
 
 [Exposed=Window,
- NamedConstructor=Audio(optional DOMString src)]
+ LegacyFactoryFunction=Audio(optional DOMString src)]
 interface HTMLAudioElement : HTMLMediaElement {
   [HTMLConstructor] constructor();
 };
@@ -766,7 +766,7 @@
 };
 
 [Exposed=Window,
- OverrideBuiltins,
+ LegacyOverrideBuiltIns,
  LegacyUnenumerableNamedProperties]
 interface HTMLFormElement : HTMLElement {
   [HTMLConstructor] constructor();
@@ -840,7 +840,7 @@
   [CEReactions] attribute DOMString step;
   [CEReactions] attribute DOMString type;
   [CEReactions] attribute DOMString defaultValue;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString value;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString value;
   attribute object? valueAsDate;
   attribute unrestricted double valueAsNumber;
   [CEReactions] attribute unsigned long width;
@@ -944,7 +944,7 @@
 };
 
 [Exposed=Window,
- NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
+ LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
 interface HTMLOptionElement : HTMLElement {
   [HTMLConstructor] constructor();
 
@@ -979,7 +979,7 @@
 
   readonly attribute DOMString type;
   [CEReactions] attribute DOMString defaultValue;
-  attribute [TreatNullAs=EmptyString] DOMString value;
+  attribute [LegacyNullToEmptyString] DOMString value;
   readonly attribute unsigned long textLength;
 
   readonly attribute boolean willValidate;
@@ -1269,7 +1269,7 @@
   attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
   CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
   CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
-  CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
+  CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition);
 
 };
 
@@ -1593,11 +1593,11 @@
  LegacyUnenumerableNamedProperties]
 interface Window : EventTarget {
   // the current browsing context
-  [Unforgeable] readonly attribute WindowProxy window;
+  [LegacyUnforgeable] readonly attribute WindowProxy window;
   [Replaceable] readonly attribute WindowProxy self;
-  [Unforgeable] readonly attribute Document document;
+  [LegacyUnforgeable] readonly attribute Document document;
   attribute DOMString name;
-  [PutForwards=href, Unforgeable] readonly attribute Location location;
+  [PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
   readonly attribute History history;
   readonly attribute CustomElementRegistry customElements;
   [Replaceable] readonly attribute BarProp locationbar;
@@ -1616,11 +1616,11 @@
   // other browsing contexts
   [Replaceable] readonly attribute WindowProxy frames;
   [Replaceable] readonly attribute unsigned long length;
-  [Unforgeable] readonly attribute WindowProxy? top;
+  [LegacyUnforgeable] readonly attribute WindowProxy? top;
   attribute any opener;
   [Replaceable] readonly attribute WindowProxy? parent;
   readonly attribute Element? frameElement;
-  WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = "");
+  WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");
   getter object (DOMString name);
   // Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
   // object on the prototype chain. Indeed, this does not make the global object an exotic object.
@@ -1668,21 +1668,21 @@
 
 [Exposed=Window]
 interface Location { // but see also additional creation steps and overridden internal methods
-  [Unforgeable] stringifier attribute USVString href;
-  [Unforgeable] readonly attribute USVString origin;
-  [Unforgeable] attribute USVString protocol;
-  [Unforgeable] attribute USVString host;
-  [Unforgeable] attribute USVString hostname;
-  [Unforgeable] attribute USVString port;
-  [Unforgeable] attribute USVString pathname;
-  [Unforgeable] attribute USVString search;
-  [Unforgeable] attribute USVString hash;
+  [LegacyUnforgeable] stringifier attribute USVString href;
+  [LegacyUnforgeable] readonly attribute USVString origin;
+  [LegacyUnforgeable] attribute USVString protocol;
+  [LegacyUnforgeable] attribute USVString host;
+  [LegacyUnforgeable] attribute USVString hostname;
+  [LegacyUnforgeable] attribute USVString port;
+  [LegacyUnforgeable] attribute USVString pathname;
+  [LegacyUnforgeable] attribute USVString search;
+  [LegacyUnforgeable] attribute USVString hash;
 
-  [Unforgeable] void assign(USVString url);
-  [Unforgeable] void replace(USVString url);
-  [Unforgeable] void reload();
+  [LegacyUnforgeable] void assign(USVString url);
+  [LegacyUnforgeable] void replace(USVString url);
+  [LegacyUnforgeable] void reload();
 
-  [Unforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
+  [LegacyUnforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
 };
 
 [Exposed=Window,
@@ -1787,15 +1787,15 @@
   any reason;
 };
 
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
 callback EventHandlerNonNull = any (Event event);
 typedef EventHandlerNonNull? EventHandler;
 
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
 callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long colno, optional any error);
 typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
 
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
 callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
 typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
 
@@ -1836,8 +1836,8 @@
   attribute EventHandler onloadedmetadata;
   attribute EventHandler onloadstart;
   attribute EventHandler onmousedown;
-  [LenientThis] attribute EventHandler onmouseenter;
-  [LenientThis] attribute EventHandler onmouseleave;
+  [LegacyLenientThis] attribute EventHandler onmouseenter;
+  [LegacyLenientThis] attribute EventHandler onmouseleave;
   attribute EventHandler onmousemove;
   attribute EventHandler onmouseout;
   attribute EventHandler onmouseover;
@@ -1969,7 +1969,7 @@
 };
 
 interface mixin NavigatorContentUtils {
-  [SecureContext] void registerProtocolHandler(DOMString scheme, USVString url, DOMString title);
+  [SecureContext] void registerProtocolHandler(DOMString scheme, USVString url);
   [SecureContext] void unregisterProtocolHandler(DOMString scheme, USVString url);
 };
 
@@ -2361,8 +2361,8 @@
   readonly attribute Document? contentDocument;
   readonly attribute WindowProxy? contentWindow;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginHeight;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginWidth;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginHeight;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginWidth;
 };
 
 partial interface HTMLAnchorElement {
@@ -2378,11 +2378,11 @@
 };
 
 partial interface HTMLBodyElement {
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString text;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString link;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vLink;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString aLink;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString text;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString link;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString vLink;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString aLink;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
   [CEReactions] attribute DOMString background;
 };
 
@@ -2426,7 +2426,7 @@
 interface HTMLFontElement : HTMLElement {
   [HTMLConstructor] constructor();
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString color;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString color;
   [CEReactions] attribute DOMString face;
   [CEReactions] attribute DOMString size;
 };
@@ -2453,8 +2453,8 @@
   [CEReactions] attribute DOMString frameBorder;
   [CEReactions] attribute USVString longDesc;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginHeight;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginWidth;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginHeight;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginWidth;
 };
 
 partial interface HTMLImageElement {
@@ -2465,7 +2465,7 @@
   [CEReactions] attribute unsigned long vspace;
   [CEReactions] attribute USVString longDesc;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString border;
 };
 
 partial interface HTMLInputElement {
@@ -2506,7 +2506,7 @@
   [CEReactions] attribute DOMString codeBase;
   [CEReactions] attribute DOMString codeType;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString border;
 };
 
 partial interface HTMLOListElement {
@@ -2544,9 +2544,9 @@
   [CEReactions] attribute DOMString summary;
   [CEReactions] attribute DOMString width;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString cellPadding;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString cellSpacing;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString cellPadding;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString cellSpacing;
 };
 
 partial interface HTMLTableSectionElement {
@@ -2567,7 +2567,7 @@
   [CEReactions] attribute boolean noWrap;
   [CEReactions] attribute DOMString vAlign;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
 };
 
 partial interface HTMLTableRowElement {
@@ -2576,7 +2576,7 @@
   [CEReactions] attribute DOMString chOff;
   [CEReactions] attribute DOMString vAlign;
 
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
 };
 
 partial interface HTMLUListElement {
@@ -2585,11 +2585,11 @@
 };
 
 partial interface Document {
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor;
-  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString fgColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString linkColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString vlinkColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString alinkColor;
+  [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
 
   [SameObject] readonly attribute HTMLCollection anchors;
   [SameObject] readonly attribute HTMLCollection applets;
diff --git a/resources/idlharness.js b/resources/idlharness.js
index d01da49..a5e2ca0 100644
--- a/resources/idlharness.js
+++ b/resources/idlharness.js
@@ -1333,7 +1333,8 @@
 
     /** An array of IdlInterfaceMembers. */
     this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); });
-    if (this.has_extended_attribute("Unforgeable")) {
+    if (this.has_extended_attribute("Unforgeable") ||
+        this.has_extended_attribute("LegacyUnforgeable")) {
         this.members
             .filter(function(m) { return m.special !== "static" && (m.type == "attribute" || m.type == "operation"); })
             .forEach(function(m) { return m.isUnforgeable = true; });
@@ -1795,11 +1796,12 @@
         }.bind(this), this.name + " interface: legacy window alias");
     }
 
-    if (this.has_extended_attribute("NamedConstructor")) {
+    if (this.has_extended_attribute("NamedConstructor") ||
+        this.has_extended_attribute("LegacyFactoryFunction")) {
         var constructors = this.extAttrs
-            .filter(function(attr) { return attr.name == "NamedConstructor"; });
+            .filter(function(attr) { return attr.name == "NamedConstructor" || attr.name == "LegacyFactoryFunction"; });
         if (constructors.length !== 1) {
-            throw new IdlHarnessError("Internal error: missing support for multiple NamedConstructor extended attributes");
+            throw new IdlHarnessError("Internal error: missing support for multiple LegacyFactoryFunction extended attributes");
         }
         var constructor = constructors[0];
         var min_length = minOverloadLength([constructor]);
@@ -1808,10 +1810,10 @@
         {
             // This function tests WebIDL as of 2019-01-14.
 
-            // "for every [NamedConstructor] extended attribute on an exposed
+            // "for every [LegacyFactoryFunction] 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 identifier, and its value is an object
+            // [LegacyFactoryFunction]'s identifier, and its value is an object
             // called a named constructor, ... . The property has the attributes
             // { [[Writable]]: true, [[Enumerable]]: false,
             // [[Configurable]]: true }."
@@ -2371,7 +2373,8 @@
                 "The prototype object must have a property " +
                 format_value(member.name));
 
-            if (!member.has_extended_attribute("LenientThis")) {
+            if (!member.has_extended_attribute("LenientThis") &&
+                !member.has_extended_attribute("LegacyLenientThis")) {
                 if (member.idlType.generic !== "Promise") {
                     // this.get_interface_object() returns a thing in our global
                     assert_throws_js(TypeError, function() {
@@ -3027,7 +3030,7 @@
     // "The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
     // true, [[Configurable]]: configurable }, where:
     // "configurable is false if the attribute was declared with the
-    // [Unforgeable] extended attribute and true otherwise;
+    // [LegacyUnforgeable] extended attribute and true otherwise;
     // "G is the attribute getter, defined below; and
     // "S is the attribute setter, also defined below."
     var desc = Object.getOwnPropertyDescriptor(obj, member.name);
@@ -3036,7 +3039,7 @@
     assert_true(desc.enumerable, "property should be enumerable");
     if (member.isUnforgeable)
     {
-        assert_false(desc.configurable, "[Unforgeable] property must not be configurable");
+        assert_false(desc.configurable, "[LegacyUnforgeable] property must not be configurable");
     }
     else
     {
@@ -3051,10 +3054,11 @@
     // "If the attribute is a regular attribute, then:"
     if (member.special !== "static") {
         // "If O is not a platform object that implements I, then:
-        // "If the attribute was specified with the [LenientThis] extended
+        // "If the attribute was specified with the [LegacyLenientThis] extended
         // attribute, then return undefined.
         // "Otherwise, throw a TypeError."
-        if (!member.has_extended_attribute("LenientThis")) {
+        if (!member.has_extended_attribute("LenientThis") &&
+            !member.has_extended_attribute("LegacyLenientThis")) {
             if (member.idlType.generic !== "Promise") {
                 assert_throws_js(globalOf(desc.get).TypeError, function() {
                     desc.get.call({});
@@ -3101,12 +3105,13 @@
         // "If the attribute is a regular attribute, then:"
         if (member.special !== "static") {
             // "If /validThis/ is false and the attribute was not specified
-            // with the [LenientThis] extended attribute, then throw a
+            // with the [LegacyLenientThis] extended attribute, then throw a
             // TypeError."
             // "If the attribute is declared with a [Replaceable] extended
             // attribute, then: ..."
             // "If validThis is false, then return."
-            if (!member.has_extended_attribute("LenientThis")) {
+            if (!member.has_extended_attribute("LenientThis") &&
+                !member.has_extended_attribute("LegacyLenientThis")) {
                 assert_throws_js(globalOf(desc.set).TypeError, function() {
                     desc.set.call({});
                 }.bind(this), "calling setter on wrong object type must throw TypeError");
@@ -3146,7 +3151,8 @@
         this.extAttrs = [];
     }
 
-    this.isUnforgeable = this.has_extended_attribute("Unforgeable");
+    this.isUnforgeable = this.has_extended_attribute("Unforgeable") ||
+        this.has_extended_attribute("LegacyUnforgeable");
     this.isUnscopable = this.has_extended_attribute("Unscopable");
 }