URLPattern.webidl (2142B)
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 * Source: URL Pattern Standard (https://urlpattern.spec.whatwg.org/) 7 */ 8 9 typedef (UTF8String or URLPatternInit) URLPatternInput; 10 11 [Exposed=(Window,Worker), 12 Pref="dom.urlpattern.enabled"] 13 interface URLPattern { 14 15 [Throws] 16 constructor(URLPatternInput input, UTF8String baseURL, optional URLPatternOptions options = {}); 17 [Throws] 18 constructor(optional URLPatternInput input = {}, optional URLPatternOptions options = {}); 19 20 [Throws] 21 boolean test(optional URLPatternInput input = {}, optional UTF8String baseURL); 22 23 [Throws] 24 URLPatternResult? exec(optional URLPatternInput input = {}, optional UTF8String baseURL); 25 26 readonly attribute UTF8String protocol; 27 readonly attribute UTF8String username; 28 readonly attribute UTF8String password; 29 readonly attribute UTF8String hostname; 30 readonly attribute UTF8String port; 31 readonly attribute UTF8String pathname; 32 readonly attribute UTF8String search; 33 readonly attribute UTF8String hash; 34 35 readonly attribute boolean hasRegExpGroups; 36 }; 37 38 dictionary URLPatternInit { 39 UTF8String protocol; 40 UTF8String username; 41 UTF8String password; 42 UTF8String hostname; 43 UTF8String port; 44 UTF8String pathname; 45 UTF8String search; 46 UTF8String hash; 47 UTF8String baseURL; 48 }; 49 50 dictionary URLPatternOptions { 51 boolean ignoreCase = false; 52 }; 53 54 dictionary URLPatternResult { 55 sequence<URLPatternInput> inputs; 56 57 URLPatternComponentResult protocol; 58 URLPatternComponentResult username; 59 URLPatternComponentResult password; 60 URLPatternComponentResult hostname; 61 URLPatternComponentResult port; 62 URLPatternComponentResult pathname; 63 URLPatternComponentResult search; 64 URLPatternComponentResult hash; 65 }; 66 67 dictionary URLPatternComponentResult { 68 UTF8String input; 69 record<UTF8String, (UTF8String or undefined)> groups; 70 }; 71 72 typedef (UTF8String or URLPatternInit or URLPattern) URLPatternCompatible;