Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / webidl / DOMParser.webidl
blob8c8e62cdbf57e57531e606a780bb26f874d355cf
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/.
4  *
5  * The origin of this IDL file is
6  * http://domparsing.spec.whatwg.org/#the-domparser-interface
7  */
9 interface Principal;
10 interface URI;
11 interface InputStream;
13 enum SupportedType {
14   "text/html",
15   "text/xml",
16   "application/xml",
17   "application/xhtml+xml",
18   "image/svg+xml"
21 [Exposed=Window]
22 interface DOMParser {
23   [Throws]
24   constructor();
26   [NewObject, Throws, UseCounter]
27   Document parseFromString(DOMString str, SupportedType type);
29   [NewObject, ChromeOnly, Throws]
30   Document parseFromSafeString(DOMString str, SupportedType type);
32   // Mozilla-specific stuff
33   [NewObject, Throws, ChromeOnly]
34   Document parseFromBuffer(sequence<octet> buf, SupportedType type);
35   [NewObject, Throws, ChromeOnly]
36   Document parseFromBuffer(Uint8Array buf, SupportedType type);
37   [NewObject, Throws, ChromeOnly]
38   Document parseFromStream(InputStream stream, DOMString? charset,
39                            long contentLength, SupportedType type);
40   // Can be used to allow a DOMParser to parse XUL/XBL no matter what
41   // principal it's using for the document.
42   [ChromeOnly]
43   undefined forceEnableXULXBL();
45   // Can be used to allow a DOMParser to load DTDs from URLs that
46   // normally would not be allowed based on the document principal.
47   [Func="IsChromeOrUAWidget"]
48   undefined forceEnableDTD();