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/.
6 * The origin of this IDL file is
7 * <https://w3c.github.io/trusted-types/dist/spec/>.
8 * It is augmented with Gecko-specific annotations.
11 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
12 interface TrustedHTML {
17 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
18 interface TrustedScript {
23 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
24 interface TrustedScriptURL {
29 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
30 interface TrustedTypePolicy {
31 readonly attribute DOMString name;
32 [NewObject, Throws] TrustedHTML createHTML(DOMString input, any... arguments);
33 [NewObject, Throws] TrustedScript createScript(DOMString input, any... arguments);
34 [NewObject, Throws] TrustedScriptURL createScriptURL(DOMString input, any... arguments);
37 dictionary TrustedTypePolicyOptions {
38 CreateHTMLCallback createHTML;
39 CreateScriptCallback createScript;
40 CreateScriptURLCallback createScriptURL;
43 callback CreateHTMLCallback = DOMString? (DOMString input, any... arguments);
44 callback CreateScriptCallback = DOMString? (DOMString input, any... arguments);
45 callback CreateScriptURLCallback = USVString? (DOMString input, any... arguments);
47 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
48 interface TrustedTypePolicyFactory {
49 TrustedTypePolicy createPolicy(DOMString policyName , optional TrustedTypePolicyOptions policyOptions = {});
50 boolean isHTML(any value);
51 boolean isScript(any value);
52 boolean isScriptURL(any value);
53 [Pure, StoreInSlot] readonly attribute TrustedHTML emptyHTML;
54 [Pure, StoreInSlot] readonly attribute TrustedScript emptyScript;
55 DOMString? getAttributeType(
58 optional DOMString elementNs = "",
59 optional DOMString attrNs = "");
60 DOMString? getPropertyType(
63 optional DOMString elementNs = "");
64 readonly attribute TrustedTypePolicy? defaultPolicy;