Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / dom / webidl / Document.webidl
blob47ed0b7ab2224c32226a0bec1d896957003884e5
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  * https://wicg.github.io/scroll-to-text-fragment/#feature-detectability
17  */
19 interface ContentSecurityPolicy;
20 interface Principal;
21 interface WindowProxy;
22 interface nsISupports;
23 interface URI;
24 interface nsIDocShell;
25 interface nsILoadGroup;
26 interface nsIReferrerInfo;
27 interface nsICookieJarSettings;
28 interface nsIPermissionDelegateHandler;
29 interface XULCommandDispatcher;
31 enum VisibilityState { "hidden", "visible" };
33 /* https://dom.spec.whatwg.org/#dictdef-elementcreationoptions */
34 dictionary ElementCreationOptions {
35   DOMString is;
37   [ChromeOnly]
38   DOMString pseudo;
41 /* https://dom.spec.whatwg.org/#interface-document */
42 [Exposed=Window,
43  InstrumentedProps=(caretRangeFromPoint,
44                     exitPictureInPicture,
45                     featurePolicy,
46                     onbeforecopy,
47                     onbeforecut,
48                     onbeforepaste,
49                     oncancel,
50                     onfreeze,
51                     onmousewheel,
52                     onresume,
53                     onsearch,
54                     onwebkitfullscreenchange,
55                     onwebkitfullscreenerror,
56                     pictureInPictureElement,
57                     pictureInPictureEnabled,
58                     registerElement,
59                     wasDiscarded,
60                     webkitCancelFullScreen,
61                     webkitCurrentFullScreenElement,
62                     webkitExitFullscreen,
63                     webkitFullscreenElement,
64                     webkitFullscreenEnabled,
65                     webkitHidden,
66                     webkitIsFullScreen,
67                     webkitVisibilityState,
68                     xmlEncoding,
69                     xmlStandalone,
70                     xmlVersion)]
71 interface Document : Node {
72   [Throws]
73   constructor();
75   [Throws]
76   readonly attribute DOMImplementation implementation;
77   [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType]
78   readonly attribute DOMString URL;
79   [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType]
80   readonly attribute DOMString documentURI;
81   [Pure]
82   readonly attribute DOMString compatMode;
83   [Pure]
84   readonly attribute DOMString characterSet;
85   [Pure,BinaryName="characterSet"]
86   readonly attribute DOMString charset; // legacy alias of .characterSet
87   [Pure,BinaryName="characterSet"]
88   readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
89   [Pure]
90   readonly attribute DOMString contentType;
92   [Pure]
93   readonly attribute DocumentType? doctype;
94   [Pure]
95   readonly attribute Element? documentElement;
96   [Pure]
97   HTMLCollection getElementsByTagName(DOMString localName);
98   [Pure, Throws]
99   HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
100   [Pure]
101   HTMLCollection getElementsByClassName(DOMString classNames);
103   // These DOM methods cannot be accessed by UA Widget scripts
104   // because the DOM element reflectors will be in the content scope,
105   // instead of the desired UA Widget scope.
106   [CEReactions, NewObject, Throws, Func="IsNotUAWidget"]
107   Element createElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});
108   [CEReactions, NewObject, Throws, Func="IsNotUAWidget"]
109   Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (ElementCreationOptions or DOMString) options = {});
110   [NewObject]
111   DocumentFragment createDocumentFragment();
112   [NewObject, Func="IsNotUAWidget"]
113   Text createTextNode(DOMString data);
114   [NewObject, Func="IsNotUAWidget"]
115   Comment createComment(DOMString data);
116   [NewObject, Throws]
117   ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
119   [CEReactions, Throws, Func="IsNotUAWidget"]
120   Node importNode(Node node, optional boolean deep = false);
121   [CEReactions, Throws, Func="IsNotUAWidget"]
122   Node adoptNode(Node node);
124   [NewObject, Throws, NeedsCallerType]
125   Event createEvent(DOMString interface);
127   [NewObject, Throws]
128   Range createRange();
130   // NodeFilter.SHOW_ALL = 0xFFFFFFFF
131   [NewObject, Throws]
132   NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
133   [NewObject, Throws]
134   TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
136   // NEW
137   // No support for prepend/append yet
138   // undefined prepend((Node or DOMString)... nodes);
139   // undefined append((Node or DOMString)... nodes);
141   // These are not in the spec, but leave them for now for backwards compat.
142   // So sort of like Gecko extensions
143   [NewObject, Throws]
144   CDATASection createCDATASection(DOMString data);
145   [NewObject, Throws]
146   Attr createAttribute(DOMString name);
147   [NewObject, Throws]
148   Attr createAttributeNS(DOMString? namespace, DOMString name);
151 // https://html.spec.whatwg.org/multipage/dom.html#the-document-object
152 partial interface Document {
153   [Pref="dom.webcomponents.shadowdom.declarative.enabled"]
154   static Document parseHTMLUnsafe(DOMString html);
156   [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
157   [SetterThrows]                           attribute DOMString domain;
158   readonly attribute DOMString referrer;
159   [Throws] attribute DOMString cookie;
160   readonly attribute DOMString lastModified;
161   readonly attribute DOMString readyState;
163   // DOM tree accessors
164   //(Not proxy yet)getter object (DOMString name);
165   [CEReactions, SetterThrows, Pure]
166            attribute DOMString title;
167   [CEReactions, Pure]
168            attribute DOMString dir;
169   [CEReactions, Pure, SetterThrows]
170            attribute HTMLElement? body;
171   [Pure]
172   readonly attribute HTMLHeadElement? head;
173   [SameObject] readonly attribute HTMLCollection images;
174   [SameObject] readonly attribute HTMLCollection embeds;
175   [SameObject] readonly attribute HTMLCollection plugins;
176   [SameObject] readonly attribute HTMLCollection links;
177   [SameObject] readonly attribute HTMLCollection forms;
178   [SameObject] readonly attribute HTMLCollection scripts;
179   [Pure]
180   NodeList getElementsByName(DOMString elementName);
181   //(Not implemented)readonly attribute DOMElementMap cssElementMap;
183   // dynamic markup insertion
184   [CEReactions, Throws]
185   Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored
186   [CEReactions, Throws]
187   WindowProxy? open(USVString url, DOMString name, DOMString features);
188   [CEReactions, Throws]
189   undefined close();
190   [CEReactions, Throws]
191   undefined write(DOMString... text);
192   [CEReactions, Throws]
193   undefined writeln(DOMString... text);
195   // user interaction
196   [Pure]
197   readonly attribute WindowProxy? defaultView;
198   [Throws]
199   boolean hasFocus();
200   [CEReactions, SetterThrows, SetterNeedsSubjectPrincipal]
201            attribute DOMString designMode;
202   [CEReactions, Throws, NeedsSubjectPrincipal]
203   boolean execCommand(DOMString commandId, optional boolean showUI = false,
204                       optional DOMString value = "");
205   [Throws, NeedsSubjectPrincipal]
206   boolean queryCommandEnabled(DOMString commandId);
207   [Throws]
208   boolean queryCommandIndeterm(DOMString commandId);
209   [Throws]
210   boolean queryCommandState(DOMString commandId);
211   [Throws, NeedsCallerType]
212   boolean queryCommandSupported(DOMString commandId);
213   [Throws]
214   DOMString queryCommandValue(DOMString commandId);
215   //(Not implemented)readonly attribute HTMLCollection commands;
217   // special event handler IDL attributes that only apply to Document objects
218   [LegacyLenientThis] attribute EventHandler onreadystatechange;
220   // Gecko extensions?
221                 attribute EventHandler onbeforescriptexecute;
222                 attribute EventHandler onafterscriptexecute;
224   /**
225    * True if this document is synthetic : stand alone image, video, audio file,
226    * etc.
227    */
228   [Func="IsChromeOrUAWidget"] readonly attribute boolean mozSyntheticDocument;
229   /**
230    * Returns the script element whose script is currently being processed.
231    *
232    * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
233    */
234   [Pure]
235   readonly attribute Element? currentScript;
236   /**
237    * Release the current mouse capture if it is on an element within this
238    * document.
239    *
240    * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture>
241    */
242   [Deprecated=DocumentReleaseCapture, Pref="dom.mouse_capture.enabled"]
243   undefined releaseCapture();
244   /**
245    * Use the given DOM element as the source image of target |-moz-element()|.
246    *
247    * This function introduces a new special ID (called "image element ID"),
248    * which is only used by |-moz-element()|, and associates it with the given
249    * DOM element.  Image elements ID's have the higher precedence than general
250    * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called,
251    * |-moz-element(#<id>)| uses |<element>| as the source image even if there
252    * is another element with id attribute = |<id>|.  To unregister an image
253    * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|.
254    *
255    * Example:
256    * <script>
257    *   canvas = document.createElement("canvas");
258    *   canvas.setAttribute("width", 100);
259    *   canvas.setAttribute("height", 100);
260    *   // draw to canvas
261    *   document.mozSetImageElement("canvasbg", canvas);
262    * </script>
263    * <div style="background-image: -moz-element(#canvasbg);"></div>
264    *
265    * @param aImageElementId an image element ID to associate with
266    * |aImageElement|
267    * @param aImageElement a DOM element to be used as the source image of
268    * |-moz-element(#aImageElementId)|. If this is null, the function will
269    * unregister the image element ID |aImageElementId|.
270    *
271    * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement>
272    */
273   [UseCounter]
274   undefined mozSetImageElement(DOMString aImageElementId,
275                                Element? aImageElement);
277   [ChromeOnly]
278   readonly attribute URI? documentURIObject;
280   /**
281    * Current referrer policy - one of the referrer policy value from
282    * ReferrerPolicy.webidl.
283    */
284   [ChromeOnly]
285   readonly attribute ReferrerPolicy referrerPolicy;
287     /**
288    * Current referrer info, which holds all referrer related information
289    * including referrer policy and raw referrer of document.
290    */
291   [ChromeOnly]
292   readonly attribute nsIReferrerInfo referrerInfo;
296 // https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis
297 partial interface Document {
298   [CEReactions] attribute [LegacyNullToEmptyString] DOMString fgColor;
299   [CEReactions] attribute [LegacyNullToEmptyString] DOMString linkColor;
300   [CEReactions] attribute [LegacyNullToEmptyString] DOMString vlinkColor;
301   [CEReactions] attribute [LegacyNullToEmptyString] DOMString alinkColor;
302   [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
304   [SameObject] readonly attribute HTMLCollection anchors;
305   [SameObject] readonly attribute HTMLCollection applets;
307   undefined clear();
308   // @deprecated These are old Netscape 4 methods. Do not use,
309   //             the implementation is no-op.
310   // XXXbz do we actually need these anymore?
311   undefined captureEvents();
312   undefined releaseEvents();
314   [SameObject] readonly attribute HTMLAllCollection all;
317 // https://fullscreen.spec.whatwg.org/#api
318 partial interface Document {
319   // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
320   // versions have it uppercase.
321   [LegacyLenientSetter, Unscopable]
322   readonly attribute boolean fullscreen;
323   [BinaryName="fullscreen"]
324   readonly attribute boolean mozFullScreen;
325   [LegacyLenientSetter, NeedsCallerType]
326   readonly attribute boolean fullscreenEnabled;
327   [BinaryName="fullscreenEnabled", NeedsCallerType]
328   readonly attribute boolean mozFullScreenEnabled;
330   [NewObject]
331   Promise<undefined> exitFullscreen();
332   [NewObject, BinaryName="exitFullscreen"]
333   Promise<undefined> mozCancelFullScreen();
335   // Events handlers
336   attribute EventHandler onfullscreenchange;
337   attribute EventHandler onfullscreenerror;
340 // https://w3c.github.io/pointerlock/#extensions-to-the-document-interface
341 // https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
342 partial interface Document {
343   undefined exitPointerLock();
345   // Event handlers
346   attribute EventHandler onpointerlockchange;
347   attribute EventHandler onpointerlockerror;
350 // Mozilla-internal document extensions specific to error pages.
351 partial interface Document {
352   [Func="Document::CallerIsTrustedAboutCertError", NewObject]
353   Promise<any> addCertException(boolean isTemporary);
355   [Func="Document::CallerIsTrustedAboutHttpsOnlyError"]
356   undefined reloadWithHttpsOnlyException();
358   [Func="Document::CallerIsTrustedAboutCertError", Throws]
359   FailedCertSecurityInfo getFailedCertSecurityInfo();
361   [Func="Document::CallerIsTrustedAboutNetError", Throws]
362   NetErrorInfo getNetErrorInfo();
365 // https://w3c.github.io/page-visibility/#extensions-to-the-document-interface
366 partial interface Document {
367   readonly attribute boolean hidden;
368   readonly attribute VisibilityState visibilityState;
369            attribute EventHandler onvisibilitychange;
372 // https://drafts.csswg.org/cssom/#extensions-to-the-document-interface
373 partial interface Document {
374     attribute DOMString? selectedStyleSheetSet;
375     readonly attribute DOMString? lastStyleSheetSet;
376     readonly attribute DOMString? preferredStyleSheetSet;
377     [Constant]
378     readonly attribute DOMStringList styleSheetSets;
379     undefined enableStyleSheetsForSet (DOMString? name);
382 // https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
383 partial interface Document {
384     CaretPosition? caretPositionFromPoint (float x, float y);
386     readonly attribute Element? scrollingElement;
389 // https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface
390 partial interface Document {
391   [Func="Document::AreWebAnimationsTimelinesEnabled"]
392   readonly attribute DocumentTimeline timeline;
395 // https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions
396 partial interface Document {
397   [BinaryName="SVGRootElement"]
398   readonly attribute SVGSVGElement? rootElement;
401 //  Mozilla extensions of various sorts
402 partial interface Document {
403   // Creates a new XUL element regardless of the document's default type.
404   [ChromeOnly, CEReactions, NewObject, Throws]
405   Element createXULElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});
406   // Wether the document was loaded using a nsXULPrototypeDocument.
407   [ChromeOnly]
408   readonly attribute boolean loadedFromPrototype;
410   // The principal to use for the storage area of this document
411   [ChromeOnly]
412   readonly attribute Principal effectiveStoragePrincipal;
414   // You should probably not be using this principal getter since it performs
415   // no checks to ensure that the partitioned principal should really be used
416   // here.  It is only designed to be used in very specific circumstances, such
417   // as when inheriting the document/storage principal.
418   [ChromeOnly]
419   readonly attribute Principal partitionedPrincipal;
421   // The cookieJarSettings of this document
422   [ChromeOnly]
423   readonly attribute nsICookieJarSettings cookieJarSettings;
425   // Touch bits
426   // XXXbz I can't find the sane spec for this stuff, so just cribbing
427   // from our xpidl for now.
428   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
429   Touch createTouch(optional Window? view = null,
430                     optional EventTarget? target = null,
431                     optional long identifier = 0,
432                     optional long pageX = 0,
433                     optional long pageY = 0,
434                     optional long screenX = 0,
435                     optional long screenY = 0,
436                     optional long clientX = 0,
437                     optional long clientY = 0,
438                     optional long radiusX = 0,
439                     optional long radiusY = 0,
440                     optional float rotationAngle = 0,
441                     optional float force = 0);
442   // XXXbz a hack to get around the fact that we don't support variadics as
443   // distinguishing arguments yet.  Once this hack is removed. we can also
444   // remove the corresponding overload on Document, since Touch... and
445   // sequence<Touch> look the same in the C++.
446   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
447   TouchList createTouchList(Touch touch, Touch... touches);
448   // XXXbz and another hack for the fact that we can't usefully have optional
449   // distinguishing arguments but need a working zero-arg form of
450   // createTouchList().
451   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
452   TouchList createTouchList();
453   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
454   TouchList createTouchList(sequence<Touch> touches);
456   [ChromeOnly]
457   attribute boolean styleSheetChangeEventsEnabled;
459   [ChromeOnly]
460   attribute boolean devToolsAnonymousAndShadowEventsEnabled;
462   [ChromeOnly, BinaryName="contentLanguageForBindings"] readonly attribute DOMString contentLanguage;
464   [ChromeOnly] readonly attribute nsILoadGroup? documentLoadGroup;
466   // Blocks the initial document parser until the given promise is settled.
467   [ChromeOnly, NewObject]
468   Promise<any> blockParsing(Promise<any> promise,
469                             optional BlockParsingOptions options = {});
471   [Func="nsContentUtils::IsSystemOrPDFJS", BinaryName="blockUnblockOnloadForSystemOrPDFJS"]
472   undefined blockUnblockOnload(boolean block);
474   // like documentURI, except that for error pages, it returns the URI we were
475   // trying to load when we hit an error, rather than the error page's own URI.
476   [ChromeOnly] readonly attribute URI? mozDocumentURIIfNotForErrorPages;
478   // A promise that is resolved when we have both fired DOMContentLoaded and
479   // are ready to start layout.
480   // This is used for the  "document_idle" webextension script injection point.
481   [ChromeOnly, Throws]
482   readonly attribute Promise<undefined> documentReadyForIdle;
484   // Lazily created command dispatcher, returns null if the document is not
485   // chrome privileged.
486   [ChromeOnly]
487   readonly attribute XULCommandDispatcher? commandDispatcher;
489   [ChromeOnly]
490   attribute boolean devToolsWatchingDOMMutations;
492   /**
493    * Returns all the shadow roots connected to the document, in no particular
494    * order, and without regard to open/closed-ness. Also returns UA widgets
495    * (like <video> controls), which can be checked using
496    * ShadowRoot.isUAWidget().
497    */
498   [ChromeOnly]
499   sequence<ShadowRoot> getConnectedShadowRoots();
502 dictionary BlockParsingOptions {
503   /**
504    * If true, blocks script-created parsers (created via document.open()) in
505    * addition to network-created parsers.
506    */
507   boolean blockScriptCreated = true;
510 // Extension to give chrome JS the ability to determine when a document was
511 // created to satisfy an iframe with srcdoc attribute.
512 partial interface Document {
513   [ChromeOnly] readonly attribute boolean isSrcdocDocument;
517 // Extension to give chrome JS the ability to get the underlying
518 // sandbox flag attribute
519 partial interface Document {
520   [ChromeOnly] readonly attribute DOMString? sandboxFlagsAsString;
525  * Chrome document anonymous content management.
526  * This is a Chrome-only API that allows inserting fixed positioned anonymous
527  * content on top of the current page displayed in the document.
528  */
529 partial interface Document {
530   /**
531    * If aForce is true, tries to update layout to be able to insert the element
532    * synchronously.
533    */
534   [ChromeOnly, NewObject, Throws]
535   AnonymousContent insertAnonymousContent(optional boolean aForce = false);
537   /**
538    * Removes the element inserted into the CanvasFrame given an AnonymousContent
539    * instance.
540    */
541   [ChromeOnly]
542   undefined removeAnonymousContent(AnonymousContent aContent);
545 // http://w3c.github.io/selection-api/#extensions-to-document-interface
546 partial interface Document {
547   [Throws]
548   Selection? getSelection();
551 // https://github.com/whatwg/html/issues/3338
552 partial interface Document {
553   [Pref="dom.storage_access.enabled", NewObject]
554   Promise<boolean> hasStorageAccess();
555   [Pref="dom.storage_access.enabled", NewObject]
556   Promise<undefined> requestStorageAccess();
557   // https://github.com/privacycg/storage-access/pull/100
558   [Pref="dom.storage_access.forward_declared.enabled", NewObject]
559   Promise<undefined> requestStorageAccessUnderSite(DOMString serializedSite);
560   [Pref="dom.storage_access.forward_declared.enabled", NewObject]
561   Promise<undefined> completeStorageAccessRequestFromSite(DOMString serializedSite);
564 // A privileged API to give chrome privileged code and the content script of the
565 // webcompat extension the ability to request the storage access for a given
566 // third party.
567 partial interface Document {
568   [Func="Document::CallerCanAccessPrivilegeSSA", NewObject]
569   Promise<undefined> requestStorageAccessForOrigin(DOMString thirdPartyOrigin, optional boolean requireUserInteraction = true);
572 // Extension to give chrome JS the ability to determine whether
573 // the user has interacted with the document or not.
574 partial interface Document {
575   [ChromeOnly] readonly attribute boolean userHasInteracted;
578 // Extension to give chrome JS the ability to simulate activate the document
579 // by user gesture.
580 partial interface Document {
581   [ChromeOnly]
582   undefined notifyUserGestureActivation();
583   // For testing only.
584   [ChromeOnly]
585   undefined clearUserGestureActivation();
586   [ChromeOnly]
587   readonly attribute boolean hasBeenUserGestureActivated;
588   [ChromeOnly]
589   readonly attribute boolean hasValidTransientUserGestureActivation;
590   [ChromeOnly]
591   readonly attribute DOMHighResTimeStamp lastUserGestureTimeStamp;
592   [ChromeOnly]
593   boolean consumeTransientUserGestureActivation();
596 // Extension to give chrome JS the ability to set an event handler which is
597 // called with certain events that happened while events were suppressed in the
598 // document or one of its subdocuments.
599 partial interface Document {
600   [ChromeOnly]
601   undefined setSuppressedEventListener(EventListener? aListener);
604 // Allows frontend code to query a CSP which needs to be passed for a
605 // new load into docshell. Further, allows to query the CSP in JSON
606 // format for testing purposes.
607 partial interface Document {
608   [ChromeOnly] readonly attribute ContentSecurityPolicy? csp;
609   [ChromeOnly] readonly attribute DOMString cspJSON;
612 partial interface Document {
613   [Func="Document::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n;
614   [Func="Document::DocumentSupportsL10n"] readonly attribute boolean hasPendingL10nMutations;
617 Document includes XPathEvaluatorMixin;
618 Document includes GlobalEventHandlers;
619 Document includes TouchEventHandlers;
620 Document includes ParentNode;
621 Document includes OnErrorEventHandlerForNodes;
622 Document includes GeometryUtils;
623 Document includes FontFaceSource;
624 Document includes DocumentOrShadowRoot;
626 // https://w3c.github.io/webappsec-feature-policy/#idl-index
627 partial interface Document {
628     [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
629     readonly attribute FeaturePolicy featurePolicy;
632 // Extension to give chrome JS the ability to specify a non-default keypress
633 // event model.
634 partial interface Document {
635   /**
636    * setKeyPressEventModel() is called when we need to check whether the web
637    * app requires specific keypress event model or not.
638    *
639    * @param aKeyPressEventModel  Proper keypress event model for the web app.
640    *   KEYPRESS_EVENT_MODEL_DEFAULT:
641    *     Use default keypress event model.  I.e., depending on
642    *     "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value"
643    *     pref.
644    *   KEYPRESS_EVENT_MODEL_SPLIT:
645    *     Use split model.  I.e, if keypress event inputs a character,
646    *     keyCode should be 0.  Otherwise, charCode should be 0.
647    *   KEYPRESS_EVENT_MODEL_CONFLATED:
648    *     Use conflated model.  I.e., keyCode and charCode values of each
649    *     keypress event should be set to same value.
650    */
651   [ChromeOnly]
652   const unsigned short KEYPRESS_EVENT_MODEL_DEFAULT = 0;
653   [ChromeOnly]
654   const unsigned short KEYPRESS_EVENT_MODEL_SPLIT = 1;
655   [ChromeOnly]
656   const unsigned short KEYPRESS_EVENT_MODEL_CONFLATED = 2;
657   [ChromeOnly]
658   undefined setKeyPressEventModel(unsigned short aKeyPressEventModel);
661 // Extensions to return information about about the nodes blocked by the
662 // Safebrowsing API inside a document.
663 partial interface Document {
664   /*
665    * Number of nodes that have been blocked by the Safebrowsing API to prevent
666    * tracking, cryptomining and so on. This method is for testing only.
667    */
668   [ChromeOnly, Pure]
669   readonly attribute long blockedNodeByClassifierCount;
671   /*
672    * List of nodes that have been blocked by the Safebrowsing API to prevent
673    * tracking, fingerprinting, cryptomining and so on. This method is for
674    * testing only.
675    */
676   [ChromeOnly, Pure]
677   readonly attribute NodeList blockedNodesByClassifier;
680 // Extension to programmatically simulate a user interaction on a document,
681 // used for testing.
682 partial interface Document {
683   [ChromeOnly, BinaryName="setUserHasInteracted"]
684   undefined userInteractionForTesting();
687 // Extension for permission delegation.
688 partial interface Document {
689   [ChromeOnly, Pure]
690   readonly attribute nsIPermissionDelegateHandler permDelegateHandler;
693 // Extension used by the password manager to infer form submissions.
694 partial interface Document {
695   /*
696    * Set whether the document notifies an event when a fetch or
697    * XHR completes successfully.
698    */
699   [ChromeOnly]
700   undefined setNotifyFetchSuccess(boolean aShouldNotify);
702   /*
703    * Set whether a form and a password field notify an event when it is
704    * removed from the DOM tree.
705    */
706   [ChromeOnly]
707   undefined setNotifyFormOrPasswordRemoved(boolean aShouldNotify);
710 // Extension to allow chrome code to detect initial about:blank documents.
711 partial interface Document {
712   [ChromeOnly]
713   readonly attribute boolean isInitialDocument;
716 // Extension to allow chrome code to get some wireframe-like structure.
717 enum WireframeRectType {
718   "image",
719   "background",
720   "text",
721   "unknown",
723 dictionary WireframeTaggedRect {
724   unrestricted double x = 0;
725   unrestricted double y = 0;
726   unrestricted double width = 0;
727   unrestricted double height = 0;
728   unsigned long color = 0; // in nscolor format
729   WireframeRectType type;
730   Node? node;
732 [GenerateInit]
733 dictionary Wireframe {
734   unsigned long canvasBackground = 0; // in nscolor format
735   sequence<WireframeTaggedRect> rects;
736   unsigned long version = 1; // Increment when the wireframe structure changes in backwards-incompatible ways
738 partial interface Document {
739   [ChromeOnly]
740   Wireframe? getWireframe(optional boolean aIncludeNodes = false);
743 partial interface Document {
744   // Returns true if the document is the current active document in a browsing
745   // context which isn't in bfcache.
746   [ChromeOnly]
747   boolean isActive();
750 Document includes NonElementParentNode;
753  * Extension to add the fragmentDirective property.
754  * https://wicg.github.io/scroll-to-text-fragment/#feature-detectability
755  */
756 partial interface Document {
757     [Pref="dom.text_fragments.enabled", Exposed=Window, SameObject]
758     readonly attribute FragmentDirective fragmentDirective;