From c396b8ef371ab9ec9a3c95f1de0fba7dc38bbd41 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 8 Apr 2020 17:51:42 -0400 Subject: [PATCH] Align with Web IDL extended attribute changes Follows https://github.com/heycam/webidl/pull/870. Additionally, this cross-links all of these extended attributes from their usage sites, since I was updating them anyway. --- source | 137 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/source b/source index 1a212f18f7f..cb6d7bd3946 100644 --- a/source +++ b/source @@ -2739,6 +2739,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute sequence of Unicode scalar values
  • overload resolution algorithm
  • exposed
  • +
  • [LegacyFactoryFunction]
  • +
  • [LegacyLenientThis]
  • +
  • [LegacyNullToEmptyString]
  • +
  • [LegacyOverrideBuiltIns]
  • +
  • [LegacyTreatNonObjectAsNull]
  • +
  • [LegacyUnenumerableNamedProperties]
  • +
  • [LegacyUnforgeable]
  • The Web IDL also defines the following types that are used in Web IDL fragments @@ -8904,10 +8911,10 @@ o.myself = o;

    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;
    @@ -8948,7 +8955,7 @@ partial interface Document {
       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
     };
    @@ -9561,7 +9568,7 @@ partial interface Document {
       
       
     
    @@ -9854,7 +9861,7 @@ interface HTMLElement : Element {
       [CEReactions] attribute boolean spellcheck;
       [CEReactions] attribute DOMString autocapitalize;
     
    -  [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
    +  [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
     
       ElementInternals attachInternals();
     };
    @@ -12105,7 +12112,7 @@ translate="no">HTML</span> markup.</p>
    data-x="concept-DOMStringMap-element">associated element.

    [Exposed=Window,
    - OverrideBuiltins]
    + LegacyOverrideBuiltIns]
     interface DOMStringMap {
       getter DOMString (DOMString name);
       [CEReactions] setter void (DOMString name, DOMString value);
    @@ -25772,7 +25779,7 @@ interface HTMLSourceElement : HTMLElement {
        
    DOM interface:
    [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();
     
    @@ -31770,7 +31777,7 @@ zero or more track elements, then
        
    DOM interface:
    [Exposed=Window,
    - NamedConstructor=Audio(optional DOMString src)]
    + LegacyFactoryFunction=Audio(optional DOMString src)]
     interface HTMLAudioElement : HTMLMediaElement {
       [HTMLConstructor] constructor();
     };
    @@ -42091,8 +42098,8 @@ interface HTMLTableCellElement : HTMLElement {
    DOM interface:
    [Exposed=Window,
    - OverrideBuiltins,
    - LegacyUnenumerableNamedProperties]
    + LegacyOverrideBuiltIns,
    + LegacyUnenumerableNamedProperties]
     interface HTMLFormElement : HTMLElement {
       [HTMLConstructor] constructor();
     
    @@ -42909,7 +42916,7 @@ interface HTMLInputElement : HTMLElement {
       [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;
    @@ -49951,7 +49958,7 @@ interface HTMLOptGroupElement : HTMLElement {
        
    DOM interface:
    [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();
     
    @@ -50238,7 +50245,7 @@ interface HTMLTextAreaElement : HTMLElement {
     
       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;
    @@ -59268,7 +59275,7 @@ interface mixin CanvasFillStrokeStyles {
       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);
     
    -  [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;
    @@ -77662,11 +77669,11 @@ interface Window : Eve
       // 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.
    @@ -80502,12 +80509,12 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
     
       

    The addition of valueOf and @@toPrimitive own data properties, as well as the fact that all of Location's IDL attributes are marked - [Unforgeable], is required by legacy code that consulted the - Location interface, or stringified it, to determine the [LegacyUnforgeable], is required by legacy code that consulted + the Location interface, or stringified it, to determine the document URL, and then used it in a security-sensitive way. In particular, the valueOf, @@toPrimitive, and [Unforgeable] stringifier mitigations ensure that code such as foo[location] = bar or location + "" cannot be + data-x="">[LegacyUnforgeable] stringifier mitigations ensure that code such as + foo[location] = bar or location + "" cannot be misdirected.

    @@ -80544,21 +80551,21 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
    [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;
    -
    -  [Unforgeable] void assign(USVString url);
    -  [Unforgeable] void replace(USVString url);
    -  [Unforgeable] void reload();
    -
    -  [Unforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
    +  [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;
    +
    +  [LegacyUnforgeable] void assign(USVString url);
    +  [LegacyUnforgeable] void replace(USVString url);
    +  [LegacyUnforgeable] void reload();
    +
    +  [LegacyUnforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
     };
    @@ -90424,7 +90431,7 @@ dictionary PromiseRejectionEventInit : EventInit {

    The EventHandler callback function type represents a callback used for event handlers. It is represented in Web IDL as follows:

    -
    [TreatNonObjectAsNull]
    +  
    [LegacyTreatNonObjectAsNull]
     callback EventHandlerNonNull = any (Event event);
     typedef EventHandlerNonNull? EventHandler;
    @@ -90461,7 +90468,7 @@ typedef EventHandlerNonNull? EventHandler;

    For historical reasons, the onerror handler has different arguments:

    -
    [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;
    @@ -90472,7 +90479,7 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;

    Similarly, the onbeforeunload handler has a different return value: it will be cast to a string.

    -
    [TreatNonObjectAsNull]
    +  
    [LegacyTreatNonObjectAsNull]
     callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
     typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
    @@ -90905,8 +90912,8 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEvent 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; @@ -114275,8 +114282,8 @@ interface HTMLFrameElement : HTMLElement { 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; };

    The name, scrolling, and src IDL attributes of the frame element must @@ -114349,11 +114356,11 @@ interface HTMLFrameElement : HTMLElement {


    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;
     };
    @@ -114480,7 +114487,7 @@ interface HTMLDirectoryElement : HTMLElement { interface HTMLFontElement : HTMLElement { [HTMLConstructor] constructor(); - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString color; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString color; [CEReactions] attribute DOMString face; [CEReactions] attribute DOMString size; };
    @@ -114541,8 +114548,8 @@ interface HTMLFontElement : HTMLElement { [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; };

    The align and scrolling IDL attributes of the @@ -114576,7 +114583,7 @@ interface HTMLFontElement : HTMLElement { [CEReactions] attribute unsigned long vspace; [CEReactions] attribute USVString longDesc; - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString border; };

    The name, align, border, hspace, and vspace IDL attributes of the img element @@ -114703,7 +114710,7 @@ interface HTMLFontElement : HTMLElement { [CEReactions] attribute DOMString codeBase; [CEReactions] attribute DOMString codeType; - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString border; };

    The align, archive, border, code, declare, hspace, standby, and vspace IDL attributes of the object @@ -114801,9 +114808,9 @@ interface HTMLFontElement : HTMLElement { [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; };

    The align, border, frame, summary, rules, and width, IDL attributes of the table element @@ -114859,7 +114866,7 @@ interface HTMLFontElement : HTMLElement { [CEReactions] attribute boolean noWrap; [CEReactions] attribute DOMString vAlign; - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor; };

    The align, axis, height, and width IDL attributes of the td and @@ -114894,7 +114901,7 @@ interface HTMLFontElement : HTMLElement { [CEReactions] attribute DOMString chOff; [CEReactions] attribute DOMString vAlign; - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor; };

    The align IDL attribute of the tr @@ -114935,11 +114942,11 @@ interface HTMLFontElement : HTMLElement {


    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;