mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Implement URLPattern::{text, exec}
(#37044)
With this change the URLPattern API is fully implemented. I'll look into the remaining failures and then enable the preference by default. Testing: Covered by web platform tests Depends on https://github.com/servo/servo/pull/37042 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
0ed2c4816c
commit
7fd0c81f55
5 changed files with 169 additions and 3633 deletions
|
@ -7,7 +7,7 @@
|
|||
use std::cmp::Eq;
|
||||
use std::hash::Hash;
|
||||
use std::marker::Sized;
|
||||
use std::ops::Deref;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
||||
|
@ -94,11 +94,17 @@ impl<K: RecordKey, V> Record<K, V> {
|
|||
impl<K: RecordKey, V> Deref for Record<K, V> {
|
||||
type Target = IndexMap<K, V>;
|
||||
|
||||
fn deref(&self) -> &IndexMap<K, V> {
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.map
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: RecordKey, V> DerefMut for Record<K, V> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.map
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, C> FromJSValConvertible for Record<K, V>
|
||||
where
|
||||
K: RecordKey,
|
||||
|
|
|
@ -11,9 +11,9 @@ interface URLPattern {
|
|||
[Throws] constructor(URLPatternInput input, USVString baseURL, optional URLPatternOptions options = {});
|
||||
[Throws] constructor(optional URLPatternInput input = {}, optional URLPatternOptions options = {});
|
||||
|
||||
// [Throws] boolean test(optional URLPatternInput input = {}, optional USVString baseURL);
|
||||
[Throws] boolean test(optional URLPatternInput input = {}, optional USVString baseURL);
|
||||
|
||||
// [Throws] URLPatternResult? exec(optional URLPatternInput input = {}, optional USVString baseURL);
|
||||
[Throws] URLPatternResult? exec(optional URLPatternInput input = {}, optional USVString baseURL);
|
||||
|
||||
readonly attribute USVString protocol;
|
||||
readonly attribute USVString username;
|
||||
|
@ -43,20 +43,20 @@ dictionary URLPatternOptions {
|
|||
boolean ignoreCase = false;
|
||||
};
|
||||
|
||||
// dictionary URLPatternResult {
|
||||
// sequence<URLPatternInput> inputs;
|
||||
dictionary URLPatternResult {
|
||||
sequence<URLPatternInput> inputs;
|
||||
|
||||
// URLPatternComponentResult protocol;
|
||||
// URLPatternComponentResult username;
|
||||
// URLPatternComponentResult password;
|
||||
// URLPatternComponentResult hostname;
|
||||
// URLPatternComponentResult port;
|
||||
// URLPatternComponentResult pathname;
|
||||
// URLPatternComponentResult search;
|
||||
// URLPatternComponentResult hash;
|
||||
// };
|
||||
URLPatternComponentResult protocol;
|
||||
URLPatternComponentResult username;
|
||||
URLPatternComponentResult password;
|
||||
URLPatternComponentResult hostname;
|
||||
URLPatternComponentResult port;
|
||||
URLPatternComponentResult pathname;
|
||||
URLPatternComponentResult search;
|
||||
URLPatternComponentResult hash;
|
||||
};
|
||||
|
||||
// dictionary URLPatternComponentResult {
|
||||
// USVString input;
|
||||
// record<USVString, (USVString or undefined)> groups;
|
||||
// };
|
||||
dictionary URLPatternComponentResult {
|
||||
USVString input;
|
||||
record<USVString, (USVString or undefined)> groups;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue