DOMParser.webidl (1735B)
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 */ 8 9 interface Principal; 10 interface URI; 11 interface InputStream; 12 13 enum SupportedType { 14 "text/html", 15 "text/xml", 16 "application/xml", 17 "application/xhtml+xml", 18 "image/svg+xml" 19 }; 20 21 [Exposed=Window] 22 interface DOMParser { 23 [Throws] 24 constructor(); 25 26 // For UA Widgets use parseFromSafeString instead. 27 // This avoids Trusted Types in the web content unexpectedly breaking the widget. 28 [NewObject, NeedsSubjectPrincipal=NonSystem, Throws, UseCounter, Func="IsNotUAWidget"] 29 Document parseFromString((TrustedHTML or DOMString) str, SupportedType type); 30 31 // Mozilla-specific stuff 32 [NewObject, Throws, Func="IsChromeOrUAWidget"] 33 Document parseFromSafeString(DOMString str, SupportedType type); 34 [NewObject, Throws, ChromeOnly] 35 Document parseFromBuffer(sequence<octet> buf, SupportedType type); 36 [NewObject, Throws, ChromeOnly] 37 Document parseFromBuffer(Uint8Array buf, SupportedType type); 38 [NewObject, Throws, ChromeOnly] 39 Document parseFromStream(InputStream stream, DOMString? charset, 40 long contentLength, SupportedType type); 41 // Can be used to allow a DOMParser to parse XUL/XBL no matter what 42 // principal it's using for the document. 43 [ChromeOnly] 44 undefined forceEnableXULXBL(); 45 46 // Can be used to allow a DOMParser to load DTDs from URLs that 47 // normally would not be allowed based on the document principal. 48 [Func="IsChromeOrUAWidget"] 49 undefined forceEnableDTD(); 50 };