chromium/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.idl

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://github.com/w3c/trusted-types/

[
    Exposed=(Window, Worker)
] interface TrustedTypePolicyFactory : EventTarget {
    [RaisesException] TrustedTypePolicy createPolicy(DOMString policyName, optional TrustedTypePolicyOptions policyOptions);
    // All the policy object names that have been created
    [CallWith=ScriptState, MeasureAs=TrustedTypesIsCheck] boolean isHTML(any checkedObject);
    [CallWith=ScriptState, MeasureAs=TrustedTypesIsCheck] boolean isScript(any checkedObject);
    [CallWith=ScriptState, MeasureAs=TrustedTypesIsCheck] boolean isScriptURL(any checkedObject);
    readonly attribute TrustedHTML emptyHTML;
    readonly attribute TrustedScript emptyScript;


    [MeasureAs=TrustedTypesIntrospectionAttributeType]
    DOMString? getAttributeType(DOMString tagName, DOMString attribute,
        optional DOMString? elementNS = "", optional DOMString? attrNs = "");
    [MeasureAs=TrustedTypesIntrospectionPropertyType]
    DOMString? getPropertyType(DOMString tagName, DOMString property,
        optional DOMString? elementNS = "");

    readonly attribute TrustedTypePolicy defaultPolicy;

    [CallWith=ScriptState, MeasureAs=TrustedTypesIntrospectionTypeMapping] object? getTypeMapping(optional DOMString ns);

    [RuntimeEnabled=TrustedTypeBeforePolicyCreationEvent] attribute EventHandler onbeforecreatepolicy;
};