"Fossies" - the Fresh Open Source Software Archive

Member "firefox-69.0.1/dom/webidl/Document.webidl" (17 Sep 2019, 24750 Bytes) of package /linux/www/firefox-69.0.1.source.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Document.webidl": 68.0.2_vs_69.0.

    1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    2 /* This Source Code Form is subject to the terms of the Mozilla Public
    3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
    4  * You can obtain one at http://mozilla.org/MPL/2.0/.
    5  *
    6  * https://dom.spec.whatwg.org/#interface-document
    7  * https://html.spec.whatwg.org/multipage/dom.html#the-document-object
    8  * https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis
    9  * https://fullscreen.spec.whatwg.org/#api
   10  * https://w3c.github.io/pointerlock/#extensions-to-the-document-interface
   11  * https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
   12  * https://w3c.github.io/page-visibility/#extensions-to-the-document-interface
   13  * https://drafts.csswg.org/cssom/#extensions-to-the-document-interface
   14  * https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
   15  * https://wicg.github.io/feature-policy/#policy
   16  */
   17 
   18 interface ContentSecurityPolicy;
   19 interface Principal;
   20 interface WindowProxy;
   21 interface nsISupports;
   22 interface URI;
   23 interface nsIDocShell;
   24 interface nsILoadGroup;
   25 interface nsIReferrerInfo;
   26 
   27 enum VisibilityState { "hidden", "visible" };
   28 
   29 /* https://dom.spec.whatwg.org/#dictdef-elementcreationoptions */
   30 dictionary ElementCreationOptions {
   31   DOMString is;
   32 
   33   [ChromeOnly]
   34   DOMString pseudo;
   35 };
   36 
   37 /* https://dom.spec.whatwg.org/#interface-document */
   38 [Constructor]
   39 interface Document : Node {
   40   [Throws]
   41   readonly attribute DOMImplementation implementation;
   42   [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType]
   43   readonly attribute DOMString URL;
   44   [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType]
   45   readonly attribute DOMString documentURI;
   46   [Pure]
   47   readonly attribute DOMString compatMode;
   48   [Pure]
   49   readonly attribute DOMString characterSet;
   50   [Pure,BinaryName="characterSet"]
   51   readonly attribute DOMString charset; // legacy alias of .characterSet
   52   [Pure,BinaryName="characterSet"]
   53   readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
   54   [Pure]
   55   readonly attribute DOMString contentType;
   56 
   57   [Pure]
   58   readonly attribute DocumentType? doctype;
   59   [Pure]
   60   readonly attribute Element? documentElement;
   61   [Pure]
   62   HTMLCollection getElementsByTagName(DOMString localName);
   63   [Pure, Throws]
   64   HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
   65   [Pure]
   66   HTMLCollection getElementsByClassName(DOMString classNames);
   67   [Pure]
   68   Element? getElementById(DOMString elementId);
   69 
   70   // These DOM methods cannot be accessed by UA Widget scripts
   71   // because the DOM element reflectors will be in the content scope,
   72   // instead of the desired UA Widget scope.
   73   [CEReactions, NewObject, Throws, Func="IsNotUAWidget"]
   74   Element createElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});
   75   [CEReactions, NewObject, Throws, Func="IsNotUAWidget"]
   76   Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (ElementCreationOptions or DOMString) options = {});
   77   [NewObject]
   78   DocumentFragment createDocumentFragment();
   79   [NewObject, Func="IsNotUAWidget"]
   80   Text createTextNode(DOMString data);
   81   [NewObject, Func="IsNotUAWidget"]
   82   Comment createComment(DOMString data);
   83   [NewObject, Throws]
   84   ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
   85 
   86   [CEReactions, Throws, Func="IsNotUAWidget"]
   87   Node importNode(Node node, optional boolean deep = false);
   88   [CEReactions, Throws, Func="IsNotUAWidget"]
   89   Node adoptNode(Node node);
   90 
   91   [NewObject, Throws, NeedsCallerType]
   92   Event createEvent(DOMString interface);
   93 
   94   [NewObject, Throws]
   95   Range createRange();
   96 
   97   // NodeFilter.SHOW_ALL = 0xFFFFFFFF
   98   [NewObject, Throws]
   99   NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  100   [NewObject, Throws]
  101   TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  102 
  103   // NEW
  104   // No support for prepend/append yet
  105   // void prepend((Node or DOMString)... nodes);
  106   // void append((Node or DOMString)... nodes);
  107 
  108   // These are not in the spec, but leave them for now for backwards compat.
  109   // So sort of like Gecko extensions
  110   [NewObject, Throws]
  111   CDATASection createCDATASection(DOMString data);
  112   [NewObject, Throws]
  113   Attr createAttribute(DOMString name);
  114   [NewObject, Throws]
  115   Attr createAttributeNS(DOMString? namespace, DOMString name);
  116 };
  117 
  118 // https://html.spec.whatwg.org/multipage/dom.html#the-document-object
  119 partial interface Document {
  120   [PutForwards=href, Unforgeable] readonly attribute Location? location;
  121   [SetterThrows]                           attribute DOMString domain;
  122   readonly attribute DOMString referrer;
  123   [Throws] attribute DOMString cookie;
  124   readonly attribute DOMString lastModified;
  125   readonly attribute DOMString readyState;
  126 
  127   // DOM tree accessors
  128   //(Not proxy yet)getter object (DOMString name);
  129   [CEReactions, SetterThrows, Pure]
  130            attribute DOMString title;
  131   [CEReactions, Pure]
  132            attribute DOMString dir;
  133   [CEReactions, Pure, SetterThrows]
  134            attribute HTMLElement? body;
  135   [Pure]
  136   readonly attribute HTMLHeadElement? head;
  137   [SameObject] readonly attribute HTMLCollection images;
  138   [SameObject] readonly attribute HTMLCollection embeds;
  139   [SameObject] readonly attribute HTMLCollection plugins;
  140   [SameObject] readonly attribute HTMLCollection links;
  141   [SameObject] readonly attribute HTMLCollection forms;
  142   [SameObject] readonly attribute HTMLCollection scripts;
  143   [Pure]
  144   NodeList getElementsByName(DOMString elementName);
  145   //(Not implemented)readonly attribute DOMElementMap cssElementMap;
  146 
  147   // dynamic markup insertion
  148   [CEReactions, Throws]
  149   Document open(optional DOMString type, optional DOMString replace = ""); // type is ignored
  150   [CEReactions, Throws]
  151   WindowProxy? open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
  152   [CEReactions, Throws]
  153   void close();
  154   [CEReactions, Throws]
  155   void write(DOMString... text);
  156   [CEReactions, Throws]
  157   void writeln(DOMString... text);
  158 
  159   // user interaction
  160   [Pure]
  161   readonly attribute WindowProxy? defaultView;
  162   [Throws]
  163   boolean hasFocus();
  164   [CEReactions, SetterThrows, SetterNeedsSubjectPrincipal]
  165            attribute DOMString designMode;
  166   [CEReactions, Throws, NeedsSubjectPrincipal]
  167   boolean execCommand(DOMString commandId, optional boolean showUI = false,
  168                       optional DOMString value = "");
  169   [Throws, NeedsSubjectPrincipal]
  170   boolean queryCommandEnabled(DOMString commandId);
  171   [Throws]
  172   boolean queryCommandIndeterm(DOMString commandId);
  173   [Throws]
  174   boolean queryCommandState(DOMString commandId);
  175   [Throws, NeedsCallerType]
  176   boolean queryCommandSupported(DOMString commandId);
  177   [Throws]
  178   DOMString queryCommandValue(DOMString commandId);
  179   //(Not implemented)readonly attribute HTMLCollection commands;
  180 
  181   // special event handler IDL attributes that only apply to Document objects
  182   [LenientThis] attribute EventHandler onreadystatechange;
  183 
  184   // Gecko extensions?
  185                 attribute EventHandler onbeforescriptexecute;
  186                 attribute EventHandler onafterscriptexecute;
  187 
  188                 [Pref="dom.select_events.enabled"]
  189                 attribute EventHandler onselectionchange;
  190 
  191   /**
  192    * True if this document is synthetic : stand alone image, video, audio file,
  193    * etc.
  194    */
  195   [Func="IsChromeOrXBLOrUAWidget"] readonly attribute boolean mozSyntheticDocument;
  196   /**
  197    * Returns the script element whose script is currently being processed.
  198    *
  199    * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
  200    */
  201   [Pure]
  202   readonly attribute Element? currentScript;
  203   /**
  204    * Release the current mouse capture if it is on an element within this
  205    * document.
  206    *
  207    * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture>
  208    */
  209   void releaseCapture();
  210   /**
  211    * Use the given DOM element as the source image of target |-moz-element()|.
  212    *
  213    * This function introduces a new special ID (called "image element ID"),
  214    * which is only used by |-moz-element()|, and associates it with the given
  215    * DOM element.  Image elements ID's have the higher precedence than general
  216    * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called,
  217    * |-moz-element(#<id>)| uses |<element>| as the source image even if there
  218    * is another element with id attribute = |<id>|.  To unregister an image
  219    * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|.
  220    *
  221    * Example:
  222    * <script>
  223    *   canvas = document.createElement("canvas");
  224    *   canvas.setAttribute("width", 100);
  225    *   canvas.setAttribute("height", 100);
  226    *   // draw to canvas
  227    *   document.mozSetImageElement("canvasbg", canvas);
  228    * </script>
  229    * <div style="background-image: -moz-element(#canvasbg);"></div>
  230    *
  231    * @param aImageElementId an image element ID to associate with
  232    * |aImageElement|
  233    * @param aImageElement a DOM element to be used as the source image of
  234    * |-moz-element(#aImageElementId)|. If this is null, the function will
  235    * unregister the image element ID |aImageElementId|.
  236    *
  237    * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement>
  238    */
  239   void mozSetImageElement(DOMString aImageElementId,
  240                           Element? aImageElement);
  241 
  242   [ChromeOnly]
  243   readonly attribute URI? documentURIObject;
  244 
  245   /**
  246    * Current referrer policy - one of the REFERRER_POLICY_* constants
  247    * from nsIHttpChannel.
  248    */
  249   [ChromeOnly]
  250   readonly attribute unsigned long referrerPolicy;
  251 
  252     /**
  253    * Current referrer info, which holds all referrer related information
  254    * including referrer policy and raw referrer of document.
  255    */
  256   [ChromeOnly]
  257   readonly attribute nsIReferrerInfo referrerInfo;
  258 
  259 };
  260 
  261 // https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis
  262 partial interface Document {
  263   [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor;
  264   [CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor;
  265   [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor;
  266   [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor;
  267   [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
  268 
  269   [SameObject] readonly attribute HTMLCollection anchors;
  270   [SameObject] readonly attribute HTMLCollection applets;
  271 
  272   //(HTML only)void clear();
  273   //(HTML only)void captureEvents();
  274   //(HTML only)void releaseEvents();
  275 
  276   //(HTML only)[SameObject] readonly attribute HTMLAllCollection all;
  277 };
  278 
  279 // https://fullscreen.spec.whatwg.org/#api
  280 partial interface Document {
  281   // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
  282   // versions have it uppercase.
  283   [LenientSetter, Unscopable, Func="Document::IsUnprefixedFullscreenEnabled"]
  284   readonly attribute boolean fullscreen;
  285   [BinaryName="fullscreen"]
  286   readonly attribute boolean mozFullScreen;
  287   [LenientSetter, Func="Document::IsUnprefixedFullscreenEnabled", NeedsCallerType]
  288   readonly attribute boolean fullscreenEnabled;
  289   [BinaryName="fullscreenEnabled", NeedsCallerType]
  290   readonly attribute boolean mozFullScreenEnabled;
  291 
  292   [Throws, Func="Document::IsUnprefixedFullscreenEnabled"]
  293   Promise<void> exitFullscreen();
  294   [Throws, BinaryName="exitFullscreen"]
  295   Promise<void> mozCancelFullScreen();
  296 
  297   // Events handlers
  298   [Func="Document::IsUnprefixedFullscreenEnabled"]
  299   attribute EventHandler onfullscreenchange;
  300   [Func="Document::IsUnprefixedFullscreenEnabled"]
  301   attribute EventHandler onfullscreenerror;
  302 };
  303 
  304 // https://w3c.github.io/pointerlock/#extensions-to-the-document-interface
  305 // https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
  306 partial interface Document {
  307   void exitPointerLock();
  308 
  309   // Event handlers
  310   attribute EventHandler onpointerlockchange;
  311   attribute EventHandler onpointerlockerror;
  312 };
  313 
  314 partial interface Document {
  315   [Func="Document::CallerIsTrustedAboutCertError", Throws]
  316   FailedCertSecurityInfo getFailedCertSecurityInfo();
  317 };
  318 
  319 // https://w3c.github.io/page-visibility/#extensions-to-the-document-interface
  320 partial interface Document {
  321   readonly attribute boolean hidden;
  322   readonly attribute VisibilityState visibilityState;
  323            attribute EventHandler onvisibilitychange;
  324 };
  325 
  326 // https://drafts.csswg.org/cssom/#extensions-to-the-document-interface
  327 partial interface Document {
  328     attribute DOMString? selectedStyleSheetSet;
  329     readonly attribute DOMString? lastStyleSheetSet;
  330     readonly attribute DOMString? preferredStyleSheetSet;
  331     [Constant]
  332     readonly attribute DOMStringList styleSheetSets;
  333     void enableStyleSheetsForSet (DOMString? name);
  334 };
  335 
  336 // https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
  337 partial interface Document {
  338     CaretPosition? caretPositionFromPoint (float x, float y);
  339 
  340     readonly attribute Element? scrollingElement;
  341 };
  342 
  343 // http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
  344 partial interface Document {
  345   [Throws, Pure]
  346   Element?  querySelector(DOMString selectors);
  347   [Throws, Pure]
  348   NodeList  querySelectorAll(DOMString selectors);
  349 
  350   //(Not implemented)Element?  find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
  351   //(Not implemented)NodeList  findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
  352 };
  353 
  354 // https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface
  355 partial interface Document {
  356   [Func="Document::AreWebAnimationsTimelinesEnabled"]
  357   readonly attribute DocumentTimeline timeline;
  358   [Func="Document::IsWebAnimationsGetAnimationsEnabled"]
  359   sequence<Animation> getAnimations();
  360 };
  361 
  362 // https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions
  363 partial interface Document {
  364   [BinaryName="SVGRootElement"]
  365   readonly attribute SVGSVGElement? rootElement;
  366 };
  367 
  368 //  Mozilla extensions of various sorts
  369 partial interface Document {
  370   // XBL support.  Wish we could make these [ChromeOnly], but
  371   // that would likely break bindings running with the page principal.
  372   [Func="IsChromeOrXBL"]
  373   NodeList? getAnonymousNodes(Element elt);
  374   [Func="IsChromeOrXBL"]
  375   Element? getAnonymousElementByAttribute(Element elt, DOMString attrName,
  376                                           DOMString attrValue);
  377   [Func="IsChromeOrXBL"]
  378   Element? getBindingParent(Node node);
  379   [Throws, Func="IsChromeOrXBL", NeedsSubjectPrincipal]
  380   void loadBindingDocument(DOMString documentURL);
  381   // Creates a new XUL element regardless of the document's default type.
  382   [CEReactions, NewObject, Throws, Func="IsChromeOrXBL"]
  383   Element createXULElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});
  384   // Wether the document was loaded using a nsXULPrototypeDocument.
  385   [ChromeOnly]
  386   readonly attribute boolean loadedFromPrototype;
  387 
  388   // The principal to use for the storage area of this document
  389   [ChromeOnly]
  390   readonly attribute Principal effectiveStoragePrincipal;
  391 
  392   // Touch bits
  393   // XXXbz I can't find the sane spec for this stuff, so just cribbing
  394   // from our xpidl for now.
  395   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
  396   Touch createTouch(optional Window? view = null,
  397                     optional EventTarget? target = null,
  398                     optional long identifier = 0,
  399                     optional long pageX = 0,
  400                     optional long pageY = 0,
  401                     optional long screenX = 0,
  402                     optional long screenY = 0,
  403                     optional long clientX = 0,
  404                     optional long clientY = 0,
  405                     optional long radiusX = 0,
  406                     optional long radiusY = 0,
  407                     optional float rotationAngle = 0,
  408                     optional float force = 0);
  409   // XXXbz a hack to get around the fact that we don't support variadics as
  410   // distinguishing arguments yet.  Once this hack is removed. we can also
  411   // remove the corresponding overload on Document, since Touch... and
  412   // sequence<Touch> look the same in the C++.
  413   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
  414   TouchList createTouchList(Touch touch, Touch... touches);
  415   // XXXbz and another hack for the fact that we can't usefully have optional
  416   // distinguishing arguments but need a working zero-arg form of
  417   // createTouchList().
  418   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
  419   TouchList createTouchList();
  420   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
  421   TouchList createTouchList(sequence<Touch> touches);
  422 
  423   [ChromeOnly]
  424   attribute boolean styleSheetChangeEventsEnabled;
  425 
  426   [ChromeOnly] readonly attribute DOMString contentLanguage;
  427 
  428   [ChromeOnly] readonly attribute nsILoadGroup? documentLoadGroup;
  429 
  430   // Blocks the initial document parser until the given promise is settled.
  431   [ChromeOnly, Throws]
  432   Promise<any> blockParsing(Promise<any> promise,
  433                             optional BlockParsingOptions options = {});
  434 
  435   // like documentURI, except that for error pages, it returns the URI we were
  436   // trying to load when we hit an error, rather than the error page's own URI.
  437   [ChromeOnly] readonly attribute URI? mozDocumentURIIfNotForErrorPages;
  438 
  439   // A promise that is resolved, with this document itself, when we have both
  440   // fired DOMContentLoaded and are ready to start layout.  This is used for the
  441   // "document_idle" webextension script injection point.
  442   [ChromeOnly, Throws]
  443   readonly attribute Promise<Document> documentReadyForIdle;
  444 
  445   // Lazily created command dispatcher, returns null if the document is not
  446   // chrome privileged.
  447   [ChromeOnly]
  448   readonly attribute XULCommandDispatcher? commandDispatcher;
  449 
  450   [ChromeOnly]
  451   attribute Node? popupNode;
  452 
  453   /**
  454    * These attributes correspond to rangeParent and rangeOffset. They will help
  455    * you find where in the DOM the popup is happening. Can be accessed only
  456    * during a popup event. Accessing any other time will be an error.
  457    */
  458   [Throws, ChromeOnly]
  459   readonly attribute Node? popupRangeParent;
  460   [Throws, ChromeOnly]
  461   readonly attribute long  popupRangeOffset;
  462   [ChromeOnly]
  463   attribute Node? tooltipNode;
  464 };
  465 
  466 dictionary BlockParsingOptions {
  467   /**
  468    * If true, blocks script-created parsers (created via document.open()) in
  469    * addition to network-created parsers.
  470    */
  471   boolean blockScriptCreated = true;
  472 };
  473 
  474 // Extension to give chrome JS the ability to determine when a document was
  475 // created to satisfy an iframe with srcdoc attribute.
  476 partial interface Document {
  477   [ChromeOnly] readonly attribute boolean isSrcdocDocument;
  478 };
  479 
  480 
  481 // Extension to give chrome JS the ability to get the underlying
  482 // sandbox flag attribute
  483 partial interface Document {
  484   [ChromeOnly] readonly attribute DOMString? sandboxFlagsAsString;
  485 };
  486 
  487 
  488 /**
  489  * Chrome document anonymous content management.
  490  * This is a Chrome-only API that allows inserting fixed positioned anonymous
  491  * content on top of the current page displayed in the document.
  492  * The supplied content is cloned and inserted into the document's CanvasFrame.
  493  * Note that this only works for HTML documents.
  494  */
  495 partial interface Document {
  496   /**
  497    * Deep-clones the provided element and inserts it into the CanvasFrame.
  498    * Returns an AnonymousContent instance that can be used to manipulate the
  499    * inserted element.
  500    */
  501   [ChromeOnly, NewObject, Throws]
  502   AnonymousContent insertAnonymousContent(Element aElement);
  503 
  504   /**
  505    * Removes the element inserted into the CanvasFrame given an AnonymousContent
  506    * instance.
  507    */
  508   [ChromeOnly, Throws]
  509   void removeAnonymousContent(AnonymousContent aContent);
  510 };
  511 
  512 // http://w3c.github.io/selection-api/#extensions-to-document-interface
  513 partial interface Document {
  514   [Throws]
  515   Selection? getSelection();
  516 };
  517 
  518 // https://github.com/whatwg/html/issues/3338
  519 partial interface Document {
  520   [Pref="dom.storage_access.enabled", Throws]
  521   Promise<boolean> hasStorageAccess();
  522   [Pref="dom.storage_access.enabled", Throws]
  523   Promise<void> requestStorageAccess();
  524 };
  525 
  526 enum DocumentAutoplayPolicy {
  527   "allowed",       // autoplay is currently allowed
  528   "allowed-muted", // muted video autoplay is currently allowed
  529   "disallowed"     // autoplay is not current allowed
  530 };
  531 
  532 // https://github.com/WICG/autoplay/issues/1
  533 partial interface Document {
  534   [Pref="dom.media.autoplay.autoplay-policy-api"]
  535   readonly attribute DocumentAutoplayPolicy autoplayPolicy;
  536 };
  537 
  538 // Extension to give chrome JS the ability to determine whether
  539 // the user has interacted with the document or not.
  540 partial interface Document {
  541   [ChromeOnly] readonly attribute boolean userHasInteracted;
  542 };
  543 
  544 // Extension to give chrome JS the ability to simulate activate the docuement
  545 // by user gesture.
  546 partial interface Document {
  547   [ChromeOnly]
  548   void notifyUserGestureActivation();
  549   // For testing only.
  550   [ChromeOnly]
  551   void clearUserGestureActivation();
  552 };
  553 
  554 // Extension to give chrome JS the ability to set an event handler which is
  555 // called with certain events that happened while events were suppressed in the
  556 // document or one of its subdocuments.
  557 partial interface Document {
  558   [ChromeOnly]
  559   void setSuppressedEventListener(EventListener? aListener);
  560 };
  561 
  562 // Extension to give chrome and XBL JS the ability to determine whether
  563 // the document is sandboxed without permission to run scripts
  564 // and whether inline scripts are blocked by the document's CSP.
  565 partial interface Document {
  566   [Func="IsChromeOrXBL"] readonly attribute boolean hasScriptsBlockedBySandbox;
  567   [Func="IsChromeOrXBL"] readonly attribute boolean inlineScriptAllowedByCSP;
  568 };
  569 
  570 // Allows frontend code to query a CSP which needs to be passed for a
  571 // new load into docshell. Further, allows to query the CSP in JSON
  572 // format for testing purposes.
  573 partial interface Document {
  574   [ChromeOnly] readonly attribute ContentSecurityPolicy? csp;
  575   [ChromeOnly] readonly attribute DOMString cspJSON;
  576 };
  577 
  578 // For more information on Flash classification, see
  579 // toolkit/components/url-classifier/flash-block-lists.rst
  580 enum FlashClassification {
  581   "unknown",        // Site is not on the whitelist or blacklist
  582   "allowed",        // Site is on the Flash whitelist
  583   "denied"          // Site is on the Flash blacklist
  584 };
  585 partial interface Document {
  586   [ChromeOnly]
  587   readonly attribute FlashClassification documentFlashClassification;
  588 };
  589 
  590 partial interface Document {
  591   [Func="Document::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n;
  592 };
  593 
  594 Document implements XPathEvaluator;
  595 Document implements GlobalEventHandlers;
  596 Document implements DocumentAndElementEventHandlers;
  597 Document implements TouchEventHandlers;
  598 Document implements ParentNode;
  599 Document implements OnErrorEventHandlerForNodes;
  600 Document implements GeometryUtils;
  601 Document implements FontFaceSource;
  602 Document implements DocumentOrShadowRoot;
  603 
  604 // https://wicg.github.io/feature-policy/#policy
  605 partial interface Document {
  606     [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
  607     readonly attribute Policy policy;
  608 };
  609 
  610 /**
  611  * Document extensions to support devtools.
  612  */
  613 partial interface Document {
  614   // Is the Document embedded in a Responsive Design Mode pane. This property
  615   // is not propegated to descendant Documents upon settting.
  616   [ChromeOnly]
  617   attribute boolean inRDMPane;
  618   // Extension to give chrome JS the ability to set the window screen
  619   // orientation while in RDM.
  620   [ChromeOnly]
  621   void setRDMPaneOrientation(OrientationType type, float rotationAngle);
  622 };
  623 
  624 // Extension to give chrome JS the ability to specify a non-default keypress
  625 // event model.
  626 partial interface Document {
  627   /**
  628    * setKeyPressEventModel() is called when we need to check whether the web
  629    * app requires specific keypress event model or not.
  630    *
  631    * @param aKeyPressEventModel  Proper keypress event model for the web app.
  632    *   KEYPRESS_EVENT_MODEL_DEFAULT:
  633    *     Use default keypress event model.  I.e., depending on
  634    *     "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value"
  635    *     pref.
  636    *   KEYPRESS_EVENT_MODEL_SPLIT:
  637    *     Use split model.  I.e, if keypress event inputs a character,
  638    *     keyCode should be 0.  Otherwise, charCode should be 0.
  639    *   KEYPRESS_EVENT_MODEL_CONFLATED:
  640    *     Use conflated model.  I.e., keyCode and charCode values of each
  641    *     keypress event should be set to same value.
  642    */
  643   [ChromeOnly]
  644   const unsigned short KEYPRESS_EVENT_MODEL_DEFAULT = 0;
  645   [ChromeOnly]
  646   const unsigned short KEYPRESS_EVENT_MODEL_SPLIT = 1;
  647   [ChromeOnly]
  648   const unsigned short KEYPRESS_EVENT_MODEL_CONFLATED = 2;
  649   [ChromeOnly]
  650   void setKeyPressEventModel(unsigned short aKeyPressEventModel);
  651 };