Bug 1835529 [wpt PR 40276] - Update wpt metadata, a=testonly
[gecko.git] / dom / webidl / Sanitizer.webidl
blob894896a46f498ee05cfe4302bc8e16104e6f0818
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://wicg.github.io/sanitizer-api/#sanitizer
8  * https://wicg.github.io/sanitizer-api/#config
9  *
10  * * Copyright © 2020 the Contributors to the HTML Sanitizer API Specification,
11  * published by the Web Platform Incubator Community Group under the W3C Community Contributor License Agreement (CLA).
12  */
14 // NOTE: This IDL is still under development:
15 // https://github.com/WICG/sanitizer-api/issues/181
17 typedef (DocumentFragment or Document) SanitizerInput;
19 [GenerateConversionToJS]
20 dictionary SanitizerElementNamespace {
21   required DOMString name;
22   required DOMString _namespace;
25 typedef (DOMString or SanitizerElementNamespace) SanitizerElement;
27 enum Star {
28   "*"
31 dictionary SanitizerAttribute {
32   required DOMString name;
33   DOMString? _namespace = null;
34   required (Star or sequence<SanitizerElement>) elements;
37 [Exposed=Window, SecureContext, Pref="dom.security.sanitizer.enabled"]
38 interface Sanitizer {
39   [Throws, UseCounter]
40   constructor(optional SanitizerConfig sanitizerConfig = {});
41   [UseCounter, Throws]
42   DocumentFragment sanitize(SanitizerInput input);
45 dictionary SanitizerConfig {
46   sequence<SanitizerElement> allowElements;
47   sequence<SanitizerElement> blockElements;
48   sequence<SanitizerElement> dropElements;
49   sequence<SanitizerAttribute> allowAttributes;
50   sequence<SanitizerAttribute> dropAttributes;
51   boolean allowCustomElements;
52   boolean allowUnknownMarkup;
53   boolean allowComments;