mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #24377 - saschanaz:record-support, r=nox
Support WebIDL `record<>` <!-- Please describe your changes on the following line: --> Rebased @taki-zaro's work (#20318). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #15012 and closes #20318. Possibly also closes #21463. <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24377) <!-- Reviewable:end -->
This commit is contained in:
commit
c5d6bb604d
12 changed files with 316 additions and 249 deletions
|
@ -77,14 +77,13 @@ def innerContainerType(type):
|
|||
|
||||
def wrapInNativeContainerType(type, inner):
|
||||
if type.isSequence():
|
||||
containerType = "Vec"
|
||||
return CGWrapper(inner, pre="Vec<", post=">")
|
||||
elif type.isRecord():
|
||||
containerType = "MozMap"
|
||||
key = type.inner.keyType if type.nullable() else type.keyType
|
||||
return CGRecord(key, inner)
|
||||
else:
|
||||
raise TypeError("Unexpected container type %s", type)
|
||||
|
||||
return CGWrapper(inner, pre=containerType + "<", post=">")
|
||||
|
||||
|
||||
builtinNames = {
|
||||
IDLType.Tags.bool: 'bool',
|
||||
|
@ -1905,6 +1904,30 @@ class CGWrapper(CGThing):
|
|||
return self.pre + defn + self.post
|
||||
|
||||
|
||||
class CGRecord(CGThing):
|
||||
"""
|
||||
CGThing that wraps value CGThing in record with key type equal to keyType parameter
|
||||
"""
|
||||
def __init__(self, keyType, value):
|
||||
CGThing.__init__(self)
|
||||
assert keyType.isString()
|
||||
self.keyType = keyType
|
||||
self.value = value
|
||||
|
||||
def define(self):
|
||||
if self.keyType.isByteString():
|
||||
keyDef = "ByteString"
|
||||
elif self.keyType.isDOMString():
|
||||
keyDef = "DOMString"
|
||||
elif self.keyType.isUSVString():
|
||||
keyDef = "USVString"
|
||||
else:
|
||||
assert False
|
||||
|
||||
defn = keyDef + ", " + self.value.define()
|
||||
return "Record<" + defn + ">"
|
||||
|
||||
|
||||
class CGImports(CGWrapper):
|
||||
"""
|
||||
Generates the appropriate import/use statements.
|
||||
|
@ -2024,7 +2047,7 @@ class CGImports(CGWrapper):
|
|||
extras += [descriptor.path, descriptor.bindingPath]
|
||||
parentName = descriptor.getParentName()
|
||||
elif t.isType() and t.isRecord():
|
||||
extras += ['crate::dom::bindings::mozmap::MozMap']
|
||||
extras += ['crate::dom::bindings::record::Record']
|
||||
elif isinstance(t, IDLPromiseType):
|
||||
extras += ['crate::dom::promise::Promise']
|
||||
else:
|
||||
|
@ -2373,7 +2396,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
|
|||
'crate::dom::bindings::conversions::StringificationBehavior',
|
||||
'crate::dom::bindings::conversions::root_from_handlevalue',
|
||||
'std::ptr::NonNull',
|
||||
'crate::dom::bindings::mozmap::MozMap',
|
||||
'crate::dom::bindings::record::Record',
|
||||
'crate::dom::bindings::num::Finite',
|
||||
'crate::dom::bindings::root::DomRoot',
|
||||
'crate::dom::bindings::str::ByteString',
|
||||
|
@ -6054,7 +6077,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
|||
'crate::dom::bindings::proxyhandler::ensure_expando_object',
|
||||
'crate::dom::bindings::proxyhandler::fill_property_descriptor',
|
||||
'crate::dom::bindings::proxyhandler::get_expando_object',
|
||||
'crate::dom::bindings::mozmap::MozMap',
|
||||
'crate::dom::bindings::record::Record',
|
||||
'std::ptr::NonNull',
|
||||
'crate::dom::bindings::num::Finite',
|
||||
'crate::dom::bindings::str::ByteString',
|
||||
|
|
|
@ -143,10 +143,10 @@ pub mod htmlconstructor;
|
|||
pub mod inheritance;
|
||||
pub mod interface;
|
||||
pub mod iterable;
|
||||
pub mod mozmap;
|
||||
pub mod namespace;
|
||||
pub mod num;
|
||||
pub mod proxyhandler;
|
||||
pub mod record;
|
||||
pub mod refcounted;
|
||||
pub mod reflector;
|
||||
pub mod root;
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! The `MozMap` (open-ended dictionary) type.
|
||||
|
||||
use crate::dom::bindings::conversions::jsid_to_string;
|
||||
use crate::dom::bindings::error::report_pending_exception;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use indexmap::IndexMap;
|
||||
use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsapi::JS_NewPlainObject;
|
||||
use js::jsapi::JSITER_HIDDEN;
|
||||
use js::jsapi::JSITER_OWNONLY;
|
||||
use js::jsapi::JSITER_SYMBOLS;
|
||||
use js::jsapi::JSPROP_ENUMERATE;
|
||||
use js::jsval::ObjectValue;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::wrappers::GetPropertyKeys;
|
||||
use js::rust::wrappers::JS_DefineUCProperty2;
|
||||
use js::rust::wrappers::JS_GetPropertyById;
|
||||
use js::rust::HandleValue;
|
||||
use js::rust::IdVector;
|
||||
use js::rust::MutableHandleValue;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// The `MozMap` (open-ended dictionary) type.
|
||||
#[derive(Clone, JSTraceable)]
|
||||
pub struct MozMap<T> {
|
||||
map: IndexMap<DOMString, T>,
|
||||
}
|
||||
|
||||
impl<T> MozMap<T> {
|
||||
/// Create an empty `MozMap`.
|
||||
pub fn new() -> Self {
|
||||
MozMap {
|
||||
map: IndexMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for MozMap<T> {
|
||||
type Target = IndexMap<DOMString, T>;
|
||||
|
||||
fn deref(&self) -> &IndexMap<DOMString, T> {
|
||||
&self.map
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, C> FromJSValConvertible for MozMap<T>
|
||||
where
|
||||
T: FromJSValConvertible<Config = C>,
|
||||
C: Clone,
|
||||
{
|
||||
type Config = C;
|
||||
unsafe fn from_jsval(
|
||||
cx: *mut JSContext,
|
||||
value: HandleValue,
|
||||
config: C,
|
||||
) -> Result<ConversionResult<Self>, ()> {
|
||||
if !value.is_object() {
|
||||
return Ok(ConversionResult::Failure(
|
||||
"MozMap value was not an object".into(),
|
||||
));
|
||||
}
|
||||
|
||||
rooted!(in(cx) let object = value.to_object());
|
||||
let ids = IdVector::new(cx);
|
||||
if !GetPropertyKeys(
|
||||
cx,
|
||||
object.handle(),
|
||||
JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS,
|
||||
ids.get(),
|
||||
) {
|
||||
// TODO: can GetPropertyKeys fail?
|
||||
// (it does so if the object has duplicate keys)
|
||||
// https://github.com/servo/servo/issues/21462
|
||||
report_pending_exception(cx, false);
|
||||
return Ok(ConversionResult::Failure(
|
||||
"Getting MozMap value property keys failed".into(),
|
||||
));
|
||||
}
|
||||
|
||||
let mut map = IndexMap::new();
|
||||
for id in &*ids {
|
||||
rooted!(in(cx) let id = *id);
|
||||
|
||||
rooted!(in(cx) let mut property = UndefinedValue());
|
||||
if !JS_GetPropertyById(cx, object.handle(), id.handle(), property.handle_mut()) {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
let property = match T::from_jsval(cx, property.handle(), config.clone())? {
|
||||
ConversionResult::Success(property) => property,
|
||||
ConversionResult::Failure(message) => {
|
||||
return Ok(ConversionResult::Failure(message))
|
||||
},
|
||||
};
|
||||
|
||||
// TODO: Is this guaranteed to succeed?
|
||||
// https://github.com/servo/servo/issues/21463
|
||||
if let Some(key) = jsid_to_string(cx, id.handle()) {
|
||||
map.insert(key, property);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ConversionResult::Success(MozMap { map: map }))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJSValConvertible> ToJSValConvertible for MozMap<T> {
|
||||
#[inline]
|
||||
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
|
||||
rooted!(in(cx) let js_object = JS_NewPlainObject(cx));
|
||||
assert!(!js_object.handle().is_null());
|
||||
|
||||
rooted!(in(cx) let mut js_value = UndefinedValue());
|
||||
for (key, value) in &self.map {
|
||||
let key = key.encode_utf16().collect::<Vec<_>>();
|
||||
value.to_jsval(cx, js_value.handle_mut());
|
||||
|
||||
assert!(JS_DefineUCProperty2(
|
||||
cx,
|
||||
js_object.handle(),
|
||||
key.as_ptr(),
|
||||
key.len(),
|
||||
js_value.handle(),
|
||||
JSPROP_ENUMERATE as u32
|
||||
));
|
||||
}
|
||||
|
||||
rval.set(ObjectValue(js_object.handle().get()));
|
||||
}
|
||||
}
|
199
components/script/dom/bindings/record.rs
Normal file
199
components/script/dom/bindings/record.rs
Normal file
|
@ -0,0 +1,199 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! The `Record` (open-ended dictionary) type.
|
||||
|
||||
use crate::dom::bindings::conversions::jsid_to_string;
|
||||
use crate::dom::bindings::str::{ByteString, DOMString, USVString};
|
||||
use indexmap::IndexMap;
|
||||
use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
||||
use js::jsapi::HandleId as RawHandleId;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsapi::JS_NewPlainObject;
|
||||
use js::jsapi::PropertyDescriptor;
|
||||
use js::jsapi::JSITER_HIDDEN;
|
||||
use js::jsapi::JSITER_OWNONLY;
|
||||
use js::jsapi::JSITER_SYMBOLS;
|
||||
use js::jsapi::JSPROP_ENUMERATE;
|
||||
use js::jsval::ObjectValue;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::wrappers::GetPropertyKeys;
|
||||
use js::rust::wrappers::JS_DefineUCProperty2;
|
||||
use js::rust::wrappers::JS_GetOwnPropertyDescriptorById;
|
||||
use js::rust::wrappers::JS_GetPropertyById;
|
||||
use js::rust::wrappers::JS_IdToValue;
|
||||
use js::rust::HandleId;
|
||||
use js::rust::HandleValue;
|
||||
use js::rust::IdVector;
|
||||
use js::rust::MutableHandleValue;
|
||||
use std::cmp::Eq;
|
||||
use std::hash::Hash;
|
||||
use std::marker::Sized;
|
||||
use std::ops::Deref;
|
||||
|
||||
pub trait RecordKey: Eq + Hash + Sized {
|
||||
fn to_utf16_vec(&self) -> Vec<u16>;
|
||||
unsafe fn from_id(cx: *mut JSContext, id: HandleId) -> Result<ConversionResult<Self>, ()>;
|
||||
}
|
||||
|
||||
impl RecordKey for DOMString {
|
||||
fn to_utf16_vec(&self) -> Vec<u16> {
|
||||
self.encode_utf16().collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
unsafe fn from_id(cx: *mut JSContext, id: HandleId) -> Result<ConversionResult<Self>, ()> {
|
||||
match jsid_to_string(cx, id) {
|
||||
Some(s) => Ok(ConversionResult::Success(s)),
|
||||
None => Ok(ConversionResult::Failure("Failed to get DOMString".into())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RecordKey for USVString {
|
||||
fn to_utf16_vec(&self) -> Vec<u16> {
|
||||
self.0.encode_utf16().collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
unsafe fn from_id(cx: *mut JSContext, id: HandleId) -> Result<ConversionResult<Self>, ()> {
|
||||
rooted!(in(cx) let mut jsid_value = UndefinedValue());
|
||||
let raw_id: RawHandleId = id.into();
|
||||
JS_IdToValue(cx, *raw_id.ptr, jsid_value.handle_mut());
|
||||
|
||||
USVString::from_jsval(cx, jsid_value.handle(), ())
|
||||
}
|
||||
}
|
||||
|
||||
impl RecordKey for ByteString {
|
||||
fn to_utf16_vec(&self) -> Vec<u16> {
|
||||
self.iter().map(|&x| x as u16).collect::<Vec<u16>>()
|
||||
}
|
||||
|
||||
unsafe fn from_id(cx: *mut JSContext, id: HandleId) -> Result<ConversionResult<Self>, ()> {
|
||||
rooted!(in(cx) let mut jsid_value = UndefinedValue());
|
||||
let raw_id: RawHandleId = id.into();
|
||||
JS_IdToValue(cx, *raw_id.ptr, jsid_value.handle_mut());
|
||||
|
||||
ByteString::from_jsval(cx, jsid_value.handle(), ())
|
||||
}
|
||||
}
|
||||
|
||||
/// The `Record` (open-ended dictionary) type.
|
||||
#[derive(Clone, JSTraceable)]
|
||||
pub struct Record<K: RecordKey, V> {
|
||||
map: IndexMap<K, V>,
|
||||
}
|
||||
|
||||
impl<K: RecordKey, V> Record<K, V> {
|
||||
/// Create an empty `Record`.
|
||||
pub fn new() -> Self {
|
||||
Record {
|
||||
map: IndexMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: RecordKey, V> Deref for Record<K, V> {
|
||||
type Target = IndexMap<K, V>;
|
||||
|
||||
fn deref(&self) -> &IndexMap<K, V> {
|
||||
&self.map
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, C> FromJSValConvertible for Record<K, V>
|
||||
where
|
||||
K: RecordKey,
|
||||
V: FromJSValConvertible<Config = C>,
|
||||
C: Clone,
|
||||
{
|
||||
type Config = C;
|
||||
unsafe fn from_jsval(
|
||||
cx: *mut JSContext,
|
||||
value: HandleValue,
|
||||
config: C,
|
||||
) -> Result<ConversionResult<Self>, ()> {
|
||||
if !value.is_object() {
|
||||
return Ok(ConversionResult::Failure(
|
||||
"Record value was not an object".into(),
|
||||
));
|
||||
}
|
||||
|
||||
rooted!(in(cx) let object = value.to_object());
|
||||
let ids = IdVector::new(cx);
|
||||
if !GetPropertyKeys(
|
||||
cx,
|
||||
object.handle(),
|
||||
JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS,
|
||||
ids.get(),
|
||||
) {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
let mut map = IndexMap::new();
|
||||
for id in &*ids {
|
||||
rooted!(in(cx) let id = *id);
|
||||
rooted!(in(cx) let mut desc = PropertyDescriptor::default());
|
||||
|
||||
if !JS_GetOwnPropertyDescriptorById(cx, object.handle(), id.handle(), desc.handle_mut())
|
||||
{
|
||||
return Err(());
|
||||
}
|
||||
|
||||
if (JSPROP_ENUMERATE as u32) & desc.attrs == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let key = match K::from_id(cx, id.handle())? {
|
||||
ConversionResult::Success(key) => key,
|
||||
ConversionResult::Failure(message) => {
|
||||
return Ok(ConversionResult::Failure(message))
|
||||
},
|
||||
};
|
||||
|
||||
rooted!(in(cx) let mut property = UndefinedValue());
|
||||
if !JS_GetPropertyById(cx, object.handle(), id.handle(), property.handle_mut()) {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
let property = match V::from_jsval(cx, property.handle(), config.clone())? {
|
||||
ConversionResult::Success(property) => property,
|
||||
ConversionResult::Failure(message) => {
|
||||
return Ok(ConversionResult::Failure(message))
|
||||
},
|
||||
};
|
||||
map.insert(key, property);
|
||||
}
|
||||
|
||||
Ok(ConversionResult::Success(Record { map: map }))
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> ToJSValConvertible for Record<K, V>
|
||||
where
|
||||
K: RecordKey,
|
||||
V: ToJSValConvertible,
|
||||
{
|
||||
#[inline]
|
||||
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
|
||||
rooted!(in(cx) let js_object = JS_NewPlainObject(cx));
|
||||
assert!(!js_object.handle().is_null());
|
||||
|
||||
rooted!(in(cx) let mut js_value = UndefinedValue());
|
||||
for (key, value) in &self.map {
|
||||
let key = key.to_utf16_vec();
|
||||
value.to_jsval(cx, js_value.handle_mut());
|
||||
|
||||
assert!(JS_DefineUCProperty2(
|
||||
cx,
|
||||
js_object.handle(),
|
||||
key.as_ptr(),
|
||||
key.len(),
|
||||
js_value.handle(),
|
||||
JSPROP_ENUMERATE as u32
|
||||
));
|
||||
}
|
||||
|
||||
rval.set(ObjectValue(js_object.handle().get()));
|
||||
}
|
||||
}
|
|
@ -74,7 +74,7 @@ impl ops::Deref for ByteString {
|
|||
|
||||
/// A string that is constructed from a UCS-2 buffer by replacing invalid code
|
||||
/// points with the replacement character.
|
||||
#[derive(Clone, Default, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Default, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
||||
pub struct USVString(pub String);
|
||||
|
||||
impl Borrow<str> for USVString {
|
||||
|
|
|
@ -215,11 +215,9 @@ impl Headers {
|
|||
}
|
||||
Ok(())
|
||||
},
|
||||
Some(HeadersInit::StringByteStringRecord(m)) => {
|
||||
Some(HeadersInit::ByteStringByteStringRecord(m)) => {
|
||||
for (key, value) in m.iter() {
|
||||
let key_vec = key.as_ref().to_string().into();
|
||||
let headers_key = ByteString::new(key_vec);
|
||||
self.Append(headers_key, value.clone())?;
|
||||
self.Append(key.clone(), value.clone())?;
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
|
|
|
@ -311,9 +311,10 @@ impl Request {
|
|||
init_sequence.clone(),
|
||||
)))?;
|
||||
},
|
||||
&HeadersInit::StringByteStringRecord(ref init_map) => {
|
||||
headers_copy
|
||||
.fill(Some(HeadersInit::StringByteStringRecord(init_map.clone())))?;
|
||||
&HeadersInit::ByteStringByteStringRecord(ref init_map) => {
|
||||
headers_copy.fill(Some(HeadersInit::ByteStringByteStringRecord(
|
||||
init_map.clone(),
|
||||
)))?;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -859,8 +860,8 @@ impl Clone for HeadersInit {
|
|||
&HeadersInit::ByteStringSequenceSequence(ref b) => {
|
||||
HeadersInit::ByteStringSequenceSequence(b.clone())
|
||||
},
|
||||
&HeadersInit::StringByteStringRecord(ref m) => {
|
||||
HeadersInit::StringByteStringRecord(m.clone())
|
||||
&HeadersInit::ByteStringByteStringRecord(ref m) => {
|
||||
HeadersInit::ByteStringByteStringRecord(m.clone())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ use crate::dom::bindings::codegen::UnionTypes::{
|
|||
StringOrUnsignedLong, StringSequenceOrUnsignedLong,
|
||||
};
|
||||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::mozmap::MozMap;
|
||||
use crate::dom::bindings::num::Finite;
|
||||
use crate::dom::bindings::record::Record;
|
||||
use crate::dom::bindings::refcounted::TrustedPromise;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
|
@ -894,50 +894,64 @@ impl TestBindingMethods for TestBinding {
|
|||
fn FuncControlledMethodDisabled(&self) {}
|
||||
fn FuncControlledMethodEnabled(&self) {}
|
||||
|
||||
fn PassMozMap(&self, _: MozMap<i32>) {}
|
||||
fn PassNullableMozMap(&self, _: Option<MozMap<i32>>) {}
|
||||
fn PassMozMapOfNullableInts(&self, _: MozMap<Option<i32>>) {}
|
||||
fn PassOptionalMozMapOfNullableInts(&self, _: Option<MozMap<Option<i32>>>) {}
|
||||
fn PassOptionalNullableMozMapOfNullableInts(&self, _: Option<Option<MozMap<Option<i32>>>>) {}
|
||||
fn PassCastableObjectMozMap(&self, _: MozMap<DomRoot<TestBinding>>) {}
|
||||
fn PassNullableCastableObjectMozMap(&self, _: MozMap<Option<DomRoot<TestBinding>>>) {}
|
||||
fn PassCastableObjectNullableMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
|
||||
fn PassNullableCastableObjectNullableMozMap(
|
||||
fn PassRecord(&self, _: Record<DOMString, i32>) {}
|
||||
fn PassRecordWithUSVStringKey(&self, _: Record<USVString, i32>) {}
|
||||
fn PassRecordWithByteStringKey(&self, _: Record<ByteString, i32>) {}
|
||||
fn PassNullableRecord(&self, _: Option<Record<DOMString, i32>>) {}
|
||||
fn PassRecordOfNullableInts(&self, _: Record<DOMString, Option<i32>>) {}
|
||||
fn PassOptionalRecordOfNullableInts(&self, _: Option<Record<DOMString, Option<i32>>>) {}
|
||||
fn PassOptionalNullableRecordOfNullableInts(
|
||||
&self,
|
||||
_: Option<MozMap<Option<DomRoot<TestBinding>>>>,
|
||||
_: Option<Option<Record<DOMString, Option<i32>>>>,
|
||||
) {
|
||||
}
|
||||
fn PassOptionalMozMap(&self, _: Option<MozMap<i32>>) {}
|
||||
fn PassOptionalNullableMozMap(&self, _: Option<Option<MozMap<i32>>>) {}
|
||||
fn PassOptionalNullableMozMapWithDefaultValue(&self, _: Option<MozMap<i32>>) {}
|
||||
fn PassOptionalObjectMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
|
||||
fn PassStringMozMap(&self, _: MozMap<DOMString>) {}
|
||||
fn PassByteStringMozMap(&self, _: MozMap<ByteString>) {}
|
||||
fn PassMozMapOfMozMaps(&self, _: MozMap<MozMap<i32>>) {}
|
||||
fn PassMozMapUnion(&self, _: UnionTypes::LongOrStringByteStringRecord) {}
|
||||
fn PassMozMapUnion2(&self, _: UnionTypes::TestBindingOrStringByteStringRecord) {}
|
||||
fn PassMozMapUnion3(
|
||||
fn PassCastableObjectRecord(&self, _: Record<DOMString, DomRoot<TestBinding>>) {}
|
||||
fn PassNullableCastableObjectRecord(&self, _: Record<DOMString, Option<DomRoot<TestBinding>>>) {
|
||||
}
|
||||
fn PassCastableObjectNullableRecord(&self, _: Option<Record<DOMString, DomRoot<TestBinding>>>) {
|
||||
}
|
||||
fn PassNullableCastableObjectNullableRecord(
|
||||
&self,
|
||||
_: Option<Record<DOMString, Option<DomRoot<TestBinding>>>>,
|
||||
) {
|
||||
}
|
||||
fn PassOptionalRecord(&self, _: Option<Record<DOMString, i32>>) {}
|
||||
fn PassOptionalNullableRecord(&self, _: Option<Option<Record<DOMString, i32>>>) {}
|
||||
fn PassOptionalNullableRecordWithDefaultValue(&self, _: Option<Record<DOMString, i32>>) {}
|
||||
fn PassOptionalObjectRecord(&self, _: Option<Record<DOMString, DomRoot<TestBinding>>>) {}
|
||||
fn PassStringRecord(&self, _: Record<DOMString, DOMString>) {}
|
||||
fn PassByteStringRecord(&self, _: Record<DOMString, ByteString>) {}
|
||||
fn PassRecordOfRecords(&self, _: Record<DOMString, Record<DOMString, i32>>) {}
|
||||
fn PassRecordUnion(&self, _: UnionTypes::LongOrStringByteStringRecord) {}
|
||||
fn PassRecordUnion2(&self, _: UnionTypes::TestBindingOrStringByteStringRecord) {}
|
||||
fn PassRecordUnion3(
|
||||
&self,
|
||||
_: UnionTypes::TestBindingOrByteStringSequenceSequenceOrStringByteStringRecord,
|
||||
) {
|
||||
}
|
||||
fn ReceiveMozMap(&self) -> MozMap<i32> {
|
||||
MozMap::new()
|
||||
fn ReceiveRecord(&self) -> Record<DOMString, i32> {
|
||||
Record::new()
|
||||
}
|
||||
fn ReceiveNullableMozMap(&self) -> Option<MozMap<i32>> {
|
||||
Some(MozMap::new())
|
||||
fn ReceiveRecordWithUSVStringKey(&self) -> Record<USVString, i32> {
|
||||
Record::new()
|
||||
}
|
||||
fn ReceiveMozMapOfNullableInts(&self) -> MozMap<Option<i32>> {
|
||||
MozMap::new()
|
||||
fn ReceiveRecordWithByteStringKey(&self) -> Record<ByteString, i32> {
|
||||
Record::new()
|
||||
}
|
||||
fn ReceiveNullableMozMapOfNullableInts(&self) -> Option<MozMap<Option<i32>>> {
|
||||
Some(MozMap::new())
|
||||
fn ReceiveNullableRecord(&self) -> Option<Record<DOMString, i32>> {
|
||||
Some(Record::new())
|
||||
}
|
||||
fn ReceiveMozMapOfMozMaps(&self) -> MozMap<MozMap<i32>> {
|
||||
MozMap::new()
|
||||
fn ReceiveRecordOfNullableInts(&self) -> Record<DOMString, Option<i32>> {
|
||||
Record::new()
|
||||
}
|
||||
fn ReceiveAnyMozMap(&self) -> MozMap<JSVal> {
|
||||
MozMap::new()
|
||||
fn ReceiveNullableRecordOfNullableInts(&self) -> Option<Record<DOMString, Option<i32>>> {
|
||||
Some(Record::new())
|
||||
}
|
||||
fn ReceiveRecordOfRecords(&self) -> Record<DOMString, Record<DOMString, i32>> {
|
||||
Record::new()
|
||||
}
|
||||
fn ReceiveAnyRecord(&self) -> Record<DOMString, JSVal> {
|
||||
Record::new()
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://fetch.spec.whatwg.org/#headers-class
|
||||
|
||||
typedef (Headers or sequence<sequence<ByteString>> or record<DOMString, ByteString>) HeadersInit;
|
||||
typedef (Headers or sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit;
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface Headers {
|
||||
|
|
|
@ -461,33 +461,37 @@ interface TestBinding {
|
|||
sequence<sequence<long>> returnSequenceSequence();
|
||||
void passUnionSequenceSequence((long or sequence<sequence<long>>) seq);
|
||||
|
||||
void passMozMap(record<DOMString, long> arg);
|
||||
void passNullableMozMap(record<DOMString, long>? arg);
|
||||
void passMozMapOfNullableInts(record<DOMString, long?> arg);
|
||||
void passOptionalMozMapOfNullableInts(optional record<DOMString, long?> arg);
|
||||
void passOptionalNullableMozMapOfNullableInts(optional record<DOMString, long?>? arg);
|
||||
void passCastableObjectMozMap(record<DOMString, TestBinding> arg);
|
||||
void passNullableCastableObjectMozMap(record<DOMString, TestBinding?> arg);
|
||||
void passCastableObjectNullableMozMap(record<DOMString, TestBinding>? arg);
|
||||
void passNullableCastableObjectNullableMozMap(record<DOMString, TestBinding?>? arg);
|
||||
void passOptionalMozMap(optional record<DOMString, long> arg);
|
||||
void passOptionalNullableMozMap(optional record<DOMString, long>? arg);
|
||||
void passOptionalNullableMozMapWithDefaultValue(optional record<DOMString, long>? arg = null);
|
||||
void passOptionalObjectMozMap(optional record<DOMString, TestBinding> arg);
|
||||
void passStringMozMap(record<DOMString, DOMString> arg);
|
||||
void passByteStringMozMap(record<DOMString, ByteString> arg);
|
||||
void passMozMapOfMozMaps(record<DOMString, record<DOMString, long>> arg);
|
||||
void passRecord(record<DOMString, long> arg);
|
||||
void passRecordWithUSVStringKey(record<USVString, long> arg);
|
||||
void passRecordWithByteStringKey(record<ByteString, long> arg);
|
||||
void passNullableRecord(record<DOMString, long>? arg);
|
||||
void passRecordOfNullableInts(record<DOMString, long?> arg);
|
||||
void passOptionalRecordOfNullableInts(optional record<DOMString, long?> arg);
|
||||
void passOptionalNullableRecordOfNullableInts(optional record<DOMString, long?>? arg);
|
||||
void passCastableObjectRecord(record<DOMString, TestBinding> arg);
|
||||
void passNullableCastableObjectRecord(record<DOMString, TestBinding?> arg);
|
||||
void passCastableObjectNullableRecord(record<DOMString, TestBinding>? arg);
|
||||
void passNullableCastableObjectNullableRecord(record<DOMString, TestBinding?>? arg);
|
||||
void passOptionalRecord(optional record<DOMString, long> arg);
|
||||
void passOptionalNullableRecord(optional record<DOMString, long>? arg);
|
||||
void passOptionalNullableRecordWithDefaultValue(optional record<DOMString, long>? arg = null);
|
||||
void passOptionalObjectRecord(optional record<DOMString, TestBinding> arg);
|
||||
void passStringRecord(record<DOMString, DOMString> arg);
|
||||
void passByteStringRecord(record<DOMString, ByteString> arg);
|
||||
void passRecordOfRecords(record<DOMString, record<DOMString, long>> arg);
|
||||
|
||||
void passMozMapUnion((long or record<DOMString, ByteString>) init);
|
||||
void passMozMapUnion2((TestBinding or record<DOMString, ByteString>) init);
|
||||
void passMozMapUnion3((TestBinding or sequence<sequence<ByteString>> or record<DOMString, ByteString>) init);
|
||||
void passRecordUnion((long or record<DOMString, ByteString>) init);
|
||||
void passRecordUnion2((TestBinding or record<DOMString, ByteString>) init);
|
||||
void passRecordUnion3((TestBinding or sequence<sequence<ByteString>> or record<DOMString, ByteString>) init);
|
||||
|
||||
record<DOMString, long> receiveMozMap();
|
||||
record<DOMString, long>? receiveNullableMozMap();
|
||||
record<DOMString, long?> receiveMozMapOfNullableInts();
|
||||
record<DOMString, long?>? receiveNullableMozMapOfNullableInts();
|
||||
record<DOMString, record<DOMString, long>> receiveMozMapOfMozMaps();
|
||||
record<DOMString, any> receiveAnyMozMap();
|
||||
record<DOMString, long> receiveRecord();
|
||||
record<USVString, long> receiveRecordWithUSVStringKey();
|
||||
record<ByteString, long> receiveRecordWithByteStringKey();
|
||||
record<DOMString, long>? receiveNullableRecord();
|
||||
record<DOMString, long?> receiveRecordOfNullableInts();
|
||||
record<DOMString, long?>? receiveNullableRecordOfNullableInts();
|
||||
record<DOMString, record<DOMString, long>> receiveRecordOfRecords();
|
||||
record<DOMString, any> receiveAnyRecord();
|
||||
|
||||
static attribute boolean booleanAttributeStatic;
|
||||
static void receiveVoidStatic();
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
[headers-record.html]
|
||||
type: testharness
|
||||
[Basic operation with one property]
|
||||
expected: FAIL
|
||||
|
||||
[Basic operation with one property and a proto]
|
||||
expected: FAIL
|
||||
|
||||
[Correct operation ordering with two properties]
|
||||
expected: FAIL
|
||||
|
||||
[Correct operation ordering with two properties one of which has an invalid name]
|
||||
expected: FAIL
|
||||
|
||||
[Correct operation ordering with two properties one of which has an invalid value]
|
||||
expected: FAIL
|
||||
|
||||
[Correct operation ordering with non-enumerable properties]
|
||||
expected: FAIL
|
||||
|
||||
[Correct operation ordering with undefined descriptors]
|
||||
expected: FAIL
|
||||
|
||||
[Basic operation with Symbol keys]
|
||||
expected: FAIL
|
||||
|
||||
[Operation with non-enumerable Symbol keys]
|
||||
expected: FAIL
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[urlsearchparams-constructor.any.worker.html]
|
||||
[URLSearchParams constructor, DOMException as argument]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[urlsearchparams-constructor.any.html]
|
||||
[URLSearchParams constructor, DOMException as argument]
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue