tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TrustedTypes.webidl (2458B)


      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 * The origin of this IDL file is
      7 * <https://w3c.github.io/trusted-types/dist/spec/>.
      8 * It is augmented with Gecko-specific annotations.
      9 */
     10 
     11 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
     12 interface TrustedHTML {
     13  stringifier;
     14  DOMString toJSON();
     15 };
     16 
     17 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
     18 interface TrustedScript {
     19  stringifier;
     20  DOMString toJSON();
     21 };
     22 
     23 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
     24 interface TrustedScriptURL {
     25  stringifier;
     26  USVString toJSON();
     27 };
     28 
     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);
     35 };
     36 
     37 dictionary TrustedTypePolicyOptions {
     38   CreateHTMLCallback createHTML;
     39   CreateScriptCallback createScript;
     40   CreateScriptURLCallback createScriptURL;
     41 };
     42 
     43 callback CreateHTMLCallback = DOMString? (DOMString input, any... arguments);
     44 callback CreateScriptCallback = DOMString? (DOMString input, any... arguments);
     45 callback CreateScriptURLCallback = USVString? (DOMString input, any... arguments);
     46 
     47 [Exposed=(Window,Worker), Pref="dom.security.trusted_types.enabled"]
     48 interface TrustedTypePolicyFactory {
     49    [Throws] 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(
     56      DOMString tagName,
     57      DOMString attribute,
     58      optional DOMString? elementNs = "",
     59      optional DOMString? attrNs = "");
     60    DOMString? getPropertyType(
     61        DOMString tagName,
     62        DOMString property,
     63        optional DOMString? elementNs = "");
     64    readonly attribute TrustedTypePolicy? defaultPolicy;
     65 };