1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 // check-tidy: no specs after this line
6 
7 use dom::bindings::callback::ExceptionHandling;
8 use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
9 use dom::bindings::codegen::Bindings::FunctionBinding::Function;
10 use dom::bindings::codegen::Bindings::TestBindingBinding::{self, SimpleCallback};
11 use dom::bindings::codegen::Bindings::TestBindingBinding::{TestBindingMethods, TestDictionary};
12 use dom::bindings::codegen::Bindings::TestBindingBinding::{TestDictionaryDefaults, TestEnum};
13 use dom::bindings::codegen::UnionTypes;
14 use dom::bindings::codegen::UnionTypes::{BlobOrBoolean, BlobOrBlobSequence, LongOrLongSequenceSequence};
15 use dom::bindings::codegen::UnionTypes::{BlobOrString, BlobOrUnsignedLong, EventOrString};
16 use dom::bindings::codegen::UnionTypes::{ByteStringOrLong, ByteStringSequenceOrLongOrString};
17 use dom::bindings::codegen::UnionTypes::{ByteStringSequenceOrLong, DocumentOrTestTypedef};
18 use dom::bindings::codegen::UnionTypes::{EventOrUSVString, HTMLElementOrLong, LongSequenceOrTestTypedef};
19 use dom::bindings::codegen::UnionTypes::{HTMLElementOrUnsignedLongOrStringOrBoolean, LongSequenceOrBoolean};
20 use dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence, StringSequenceOrUnsignedLong};
21 use dom::bindings::codegen::UnionTypes::{StringOrUnsignedLong, StringOrBoolean, UnsignedLongOrBoolean};
22 use dom::bindings::error::{Error, Fallible};
23 use dom::bindings::mozmap::MozMap;
24 use dom::bindings::num::Finite;
25 use dom::bindings::refcounted::TrustedPromise;
26 use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
27 use dom::bindings::root::DomRoot;
28 use dom::bindings::str::{ByteString, DOMString, USVString};
29 use dom::bindings::trace::RootedTraceableBox;
30 use dom::bindings::weakref::MutableWeakRef;
31 use dom::blob::{Blob, BlobImpl};
32 use dom::globalscope::GlobalScope;
33 use dom::promise::Promise;
34 use dom::promisenativehandler::{PromiseNativeHandler, Callback};
35 use dom::url::URL;
36 use dom_struct::dom_struct;
37 use js::jsapi::{HandleObject, HandleValue, Heap, JSContext, JSObject};
38 use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray};
39 use js::jsval::{JSVal, NullValue};
40 use js::rust::CustomAutoRooterGuard;
41 use script_traits::MsDuration;
42 use servo_config::prefs::PREFS;
43 use std::borrow::ToOwned;
44 use std::ptr;
45 use std::ptr::NonNull;
46 use std::rc::Rc;
47 use timers::OneshotTimerCallback;
48 
49 #[dom_struct]
50 pub struct TestBinding {
51     reflector_: Reflector,
52     url: MutableWeakRef<URL>,
53 }
54 
55 impl TestBinding {
new_inherited() -> TestBinding56     fn new_inherited() -> TestBinding {
57         TestBinding {
58             reflector_: Reflector::new(),
59             url: MutableWeakRef::new(None),
60         }
61     }
62 
new(global: &GlobalScope) -> DomRoot<TestBinding>63     pub fn new(global: &GlobalScope) -> DomRoot<TestBinding> {
64         reflect_dom_object(Box::new(TestBinding::new_inherited()),
65                            global, TestBindingBinding::Wrap)
66     }
67 
Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBinding>>68     pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBinding>> {
69         Ok(TestBinding::new(global))
70     }
71 
72     #[allow(unused_variables)]
Constructor_(global: &GlobalScope, nums: Vec<f64>) -> Fallible<DomRoot<TestBinding>>73     pub fn Constructor_(global: &GlobalScope, nums: Vec<f64>) -> Fallible<DomRoot<TestBinding>> {
74         Ok(TestBinding::new(global))
75     }
76 
77     #[allow(unused_variables)]
Constructor__(global: &GlobalScope, num: f64) -> Fallible<DomRoot<TestBinding>>78     pub fn Constructor__(global: &GlobalScope, num: f64) -> Fallible<DomRoot<TestBinding>> {
79         Ok(TestBinding::new(global))
80     }
81 }
82 
83 impl TestBindingMethods for TestBinding {
BooleanAttribute(&self) -> bool84     fn BooleanAttribute(&self) -> bool { false }
SetBooleanAttribute(&self, _: bool)85     fn SetBooleanAttribute(&self, _: bool) {}
ByteAttribute(&self) -> i886     fn ByteAttribute(&self) -> i8 { 0 }
SetByteAttribute(&self, _: i8)87     fn SetByteAttribute(&self, _: i8) {}
OctetAttribute(&self) -> u888     fn OctetAttribute(&self) -> u8 { 0 }
SetOctetAttribute(&self, _: u8)89     fn SetOctetAttribute(&self, _: u8) {}
ShortAttribute(&self) -> i1690     fn ShortAttribute(&self) -> i16 { 0 }
SetShortAttribute(&self, _: i16)91     fn SetShortAttribute(&self, _: i16) {}
UnsignedShortAttribute(&self) -> u1692     fn UnsignedShortAttribute(&self) -> u16 { 0 }
SetUnsignedShortAttribute(&self, _: u16)93     fn SetUnsignedShortAttribute(&self, _: u16) {}
LongAttribute(&self) -> i3294     fn LongAttribute(&self) -> i32 { 0 }
SetLongAttribute(&self, _: i32)95     fn SetLongAttribute(&self, _: i32) {}
UnsignedLongAttribute(&self) -> u3296     fn UnsignedLongAttribute(&self) -> u32 { 0 }
SetUnsignedLongAttribute(&self, _: u32)97     fn SetUnsignedLongAttribute(&self, _: u32) {}
LongLongAttribute(&self) -> i6498     fn LongLongAttribute(&self) -> i64 { 0 }
SetLongLongAttribute(&self, _: i64)99     fn SetLongLongAttribute(&self, _: i64) {}
UnsignedLongLongAttribute(&self) -> u64100     fn UnsignedLongLongAttribute(&self) -> u64 { 0 }
SetUnsignedLongLongAttribute(&self, _: u64)101     fn SetUnsignedLongLongAttribute(&self, _: u64) {}
UnrestrictedFloatAttribute(&self) -> f32102     fn UnrestrictedFloatAttribute(&self) -> f32 { 0. }
SetUnrestrictedFloatAttribute(&self, _: f32)103     fn SetUnrestrictedFloatAttribute(&self, _: f32) {}
FloatAttribute(&self) -> Finite<f32>104     fn FloatAttribute(&self) -> Finite<f32> { Finite::wrap(0.) }
SetFloatAttribute(&self, _: Finite<f32>)105     fn SetFloatAttribute(&self, _: Finite<f32>) {}
UnrestrictedDoubleAttribute(&self) -> f64106     fn UnrestrictedDoubleAttribute(&self) -> f64 { 0. }
SetUnrestrictedDoubleAttribute(&self, _: f64)107     fn SetUnrestrictedDoubleAttribute(&self, _: f64) {}
DoubleAttribute(&self) -> Finite<f64>108     fn DoubleAttribute(&self) -> Finite<f64> { Finite::wrap(0.) }
SetDoubleAttribute(&self, _: Finite<f64>)109     fn SetDoubleAttribute(&self, _: Finite<f64>) {}
StringAttribute(&self) -> DOMString110     fn StringAttribute(&self) -> DOMString { DOMString::new() }
SetStringAttribute(&self, _: DOMString)111     fn SetStringAttribute(&self, _: DOMString) {}
UsvstringAttribute(&self) -> USVString112     fn UsvstringAttribute(&self) -> USVString { USVString("".to_owned()) }
SetUsvstringAttribute(&self, _: USVString)113     fn SetUsvstringAttribute(&self, _: USVString) {}
ByteStringAttribute(&self) -> ByteString114     fn ByteStringAttribute(&self) -> ByteString { ByteString::new(vec!()) }
SetByteStringAttribute(&self, _: ByteString)115     fn SetByteStringAttribute(&self, _: ByteString) {}
EnumAttribute(&self) -> TestEnum116     fn EnumAttribute(&self) -> TestEnum { TestEnum::_empty }
SetEnumAttribute(&self, _: TestEnum)117     fn SetEnumAttribute(&self, _: TestEnum) {}
InterfaceAttribute(&self) -> DomRoot<Blob>118     fn InterfaceAttribute(&self) -> DomRoot<Blob> {
119         Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())
120     }
SetInterfaceAttribute(&self, _: &Blob)121     fn SetInterfaceAttribute(&self, _: &Blob) {}
UnionAttribute(&self) -> HTMLElementOrLong122     fn UnionAttribute(&self) -> HTMLElementOrLong { HTMLElementOrLong::Long(0) }
SetUnionAttribute(&self, _: HTMLElementOrLong)123     fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
Union2Attribute(&self) -> EventOrString124     fn Union2Attribute(&self) -> EventOrString { EventOrString::String(DOMString::new()) }
SetUnion2Attribute(&self, _: EventOrString)125     fn SetUnion2Attribute(&self, _: EventOrString) {}
Union3Attribute(&self) -> EventOrUSVString126     fn Union3Attribute(&self) -> EventOrUSVString {
127         EventOrUSVString::USVString(USVString("".to_owned()))
128     }
SetUnion3Attribute(&self, _: EventOrUSVString)129     fn SetUnion3Attribute(&self, _: EventOrUSVString) {}
Union4Attribute(&self) -> StringOrUnsignedLong130     fn Union4Attribute(&self) -> StringOrUnsignedLong {
131         StringOrUnsignedLong::UnsignedLong(0u32)
132     }
SetUnion4Attribute(&self, _: StringOrUnsignedLong)133     fn SetUnion4Attribute(&self, _: StringOrUnsignedLong) {}
Union5Attribute(&self) -> StringOrBoolean134     fn Union5Attribute(&self) -> StringOrBoolean {
135         StringOrBoolean::Boolean(true)
136     }
SetUnion5Attribute(&self, _: StringOrBoolean)137     fn SetUnion5Attribute(&self, _: StringOrBoolean) {}
Union6Attribute(&self) -> UnsignedLongOrBoolean138     fn Union6Attribute(&self) -> UnsignedLongOrBoolean {
139         UnsignedLongOrBoolean::Boolean(true)
140     }
SetUnion6Attribute(&self, _: UnsignedLongOrBoolean)141     fn SetUnion6Attribute(&self, _: UnsignedLongOrBoolean) {}
Union7Attribute(&self) -> BlobOrBoolean142     fn Union7Attribute(&self) -> BlobOrBoolean {
143         BlobOrBoolean::Boolean(true)
144     }
SetUnion7Attribute(&self, _: BlobOrBoolean)145     fn SetUnion7Attribute(&self, _: BlobOrBoolean) {}
Union8Attribute(&self) -> BlobOrUnsignedLong146     fn Union8Attribute(&self) -> BlobOrUnsignedLong {
147         BlobOrUnsignedLong::UnsignedLong(0u32)
148     }
SetUnion8Attribute(&self, _: BlobOrUnsignedLong)149     fn SetUnion8Attribute(&self, _: BlobOrUnsignedLong) {}
Union9Attribute(&self) -> ByteStringOrLong150     fn Union9Attribute(&self) -> ByteStringOrLong {
151         ByteStringOrLong::ByteString(ByteString::new(vec!()))
152     }
SetUnion9Attribute(&self, _: ByteStringOrLong)153     fn SetUnion9Attribute(&self, _: ByteStringOrLong) {}
154     #[allow(unsafe_code)]
ArrayAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject>155     unsafe fn ArrayAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject> {
156         rooted!(in(cx) let array = JS_NewUint8ClampedArray(cx, 16));
157         NonNull::new(array.get()).expect("got a null pointer")
158     }
159     #[allow(unsafe_code)]
AnyAttribute(&self, _: *mut JSContext) -> JSVal160     unsafe fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
161     #[allow(unsafe_code)]
SetAnyAttribute(&self, _: *mut JSContext, _: HandleValue)162     unsafe fn SetAnyAttribute(&self, _: *mut JSContext, _: HandleValue) {}
163     #[allow(unsafe_code)]
ObjectAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject>164     unsafe fn ObjectAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject> {
165         rooted!(in(cx) let obj = JS_NewPlainObject(cx));
166         NonNull::new(obj.get()).expect("got a null pointer")
167     }
168     #[allow(unsafe_code)]
SetObjectAttribute(&self, _: *mut JSContext, _: *mut JSObject)169     unsafe fn SetObjectAttribute(&self, _: *mut JSContext, _: *mut JSObject) {}
170 
GetBooleanAttributeNullable(&self) -> Option<bool>171     fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
SetBooleanAttributeNullable(&self, _: Option<bool>)172     fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
GetByteAttributeNullable(&self) -> Option<i8>173     fn GetByteAttributeNullable(&self) -> Option<i8> { Some(0) }
SetByteAttributeNullable(&self, _: Option<i8>)174     fn SetByteAttributeNullable(&self, _: Option<i8>) {}
GetOctetAttributeNullable(&self) -> Option<u8>175     fn GetOctetAttributeNullable(&self) -> Option<u8> { Some(0) }
SetOctetAttributeNullable(&self, _: Option<u8>)176     fn SetOctetAttributeNullable(&self, _: Option<u8>) {}
GetShortAttributeNullable(&self) -> Option<i16>177     fn GetShortAttributeNullable(&self) -> Option<i16> { Some(0) }
SetShortAttributeNullable(&self, _: Option<i16>)178     fn SetShortAttributeNullable(&self, _: Option<i16>) {}
GetUnsignedShortAttributeNullable(&self) -> Option<u16>179     fn GetUnsignedShortAttributeNullable(&self) -> Option<u16> { Some(0) }
SetUnsignedShortAttributeNullable(&self, _: Option<u16>)180     fn SetUnsignedShortAttributeNullable(&self, _: Option<u16>) {}
GetLongAttributeNullable(&self) -> Option<i32>181     fn GetLongAttributeNullable(&self) -> Option<i32> { Some(0) }
SetLongAttributeNullable(&self, _: Option<i32>)182     fn SetLongAttributeNullable(&self, _: Option<i32>) {}
GetUnsignedLongAttributeNullable(&self) -> Option<u32>183     fn GetUnsignedLongAttributeNullable(&self) -> Option<u32> { Some(0) }
SetUnsignedLongAttributeNullable(&self, _: Option<u32>)184     fn SetUnsignedLongAttributeNullable(&self, _: Option<u32>) {}
GetLongLongAttributeNullable(&self) -> Option<i64>185     fn GetLongLongAttributeNullable(&self) -> Option<i64> { Some(0) }
SetLongLongAttributeNullable(&self, _: Option<i64>)186     fn SetLongLongAttributeNullable(&self, _: Option<i64>) {}
GetUnsignedLongLongAttributeNullable(&self) -> Option<u64>187     fn GetUnsignedLongLongAttributeNullable(&self) -> Option<u64> { Some(0) }
SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>)188     fn SetUnsignedLongLongAttributeNullable(&self, _: Option<u64>) {}
GetUnrestrictedFloatAttributeNullable(&self) -> Option<f32>189     fn GetUnrestrictedFloatAttributeNullable(&self) -> Option<f32> { Some(0.) }
SetUnrestrictedFloatAttributeNullable(&self, _: Option<f32>)190     fn SetUnrestrictedFloatAttributeNullable(&self, _: Option<f32>) {}
GetFloatAttributeNullable(&self) -> Option<Finite<f32>>191     fn GetFloatAttributeNullable(&self) -> Option<Finite<f32>> { Some(Finite::wrap(0.)) }
SetFloatAttributeNullable(&self, _: Option<Finite<f32>>)192     fn SetFloatAttributeNullable(&self, _: Option<Finite<f32>>) {}
GetUnrestrictedDoubleAttributeNullable(&self) -> Option<f64>193     fn GetUnrestrictedDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
SetUnrestrictedDoubleAttributeNullable(&self, _: Option<f64>)194     fn SetUnrestrictedDoubleAttributeNullable(&self, _: Option<f64>) {}
GetDoubleAttributeNullable(&self) -> Option<Finite<f64>>195     fn GetDoubleAttributeNullable(&self) -> Option<Finite<f64>> { Some(Finite::wrap(0.)) }
SetDoubleAttributeNullable(&self, _: Option<Finite<f64>>)196     fn SetDoubleAttributeNullable(&self, _: Option<Finite<f64>>) {}
GetByteStringAttributeNullable(&self) -> Option<ByteString>197     fn GetByteStringAttributeNullable(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
SetByteStringAttributeNullable(&self, _: Option<ByteString>)198     fn SetByteStringAttributeNullable(&self, _: Option<ByteString>) {}
GetStringAttributeNullable(&self) -> Option<DOMString>199     fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(DOMString::new()) }
SetStringAttributeNullable(&self, _: Option<DOMString>)200     fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
GetUsvstringAttributeNullable(&self) -> Option<USVString>201     fn GetUsvstringAttributeNullable(&self) -> Option<USVString> { Some(USVString("".to_owned())) }
SetUsvstringAttributeNullable(&self, _: Option<USVString>)202     fn SetUsvstringAttributeNullable(&self, _: Option<USVString>) {}
SetBinaryRenamedAttribute(&self, _: DOMString)203     fn SetBinaryRenamedAttribute(&self, _: DOMString) {}
ForwardedAttribute(&self) -> DomRoot<TestBinding>204     fn ForwardedAttribute(&self) -> DomRoot<TestBinding> { DomRoot::from_ref(self) }
BinaryRenamedAttribute(&self) -> DOMString205     fn BinaryRenamedAttribute(&self) -> DOMString { DOMString::new() }
SetBinaryRenamedAttribute2(&self, _: DOMString)206     fn SetBinaryRenamedAttribute2(&self, _: DOMString) {}
BinaryRenamedAttribute2(&self) -> DOMString207     fn BinaryRenamedAttribute2(&self) -> DOMString { DOMString::new() }
Attr_to_automatically_rename(&self) -> DOMString208     fn Attr_to_automatically_rename(&self) -> DOMString { DOMString::new() }
SetAttr_to_automatically_rename(&self, _: DOMString)209     fn SetAttr_to_automatically_rename(&self, _: DOMString) {}
GetEnumAttributeNullable(&self) -> Option<TestEnum>210     fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(TestEnum::_empty) }
GetInterfaceAttributeNullable(&self) -> Option<DomRoot<Blob>>211     fn GetInterfaceAttributeNullable(&self) -> Option<DomRoot<Blob>> {
212         Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()))
213     }
SetInterfaceAttributeNullable(&self, _: Option<&Blob>)214     fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {}
GetInterfaceAttributeWeak(&self) -> Option<DomRoot<URL>>215     fn GetInterfaceAttributeWeak(&self) -> Option<DomRoot<URL>> {
216         self.url.root()
217     }
SetInterfaceAttributeWeak(&self, url: Option<&URL>)218     fn SetInterfaceAttributeWeak(&self, url: Option<&URL>) {
219         self.url.set(url);
220     }
221     #[allow(unsafe_code)]
GetObjectAttributeNullable(&self, _: *mut JSContext) -> Option<NonNull<JSObject>>222     unsafe fn GetObjectAttributeNullable(&self, _: *mut JSContext) -> Option<NonNull<JSObject>> { None }
223     #[allow(unsafe_code)]
SetObjectAttributeNullable(&self, _: *mut JSContext, _: *mut JSObject)224     unsafe fn SetObjectAttributeNullable(&self, _: *mut JSContext, _: *mut JSObject) {}
GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong>225     fn GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong> {
226         Some(HTMLElementOrLong::Long(0))
227     }
SetUnionAttributeNullable(&self, _: Option<HTMLElementOrLong>)228     fn SetUnionAttributeNullable(&self, _: Option<HTMLElementOrLong>) {}
GetUnion2AttributeNullable(&self) -> Option<EventOrString>229     fn GetUnion2AttributeNullable(&self) -> Option<EventOrString> {
230         Some(EventOrString::String(DOMString::new()))
231     }
SetUnion2AttributeNullable(&self, _: Option<EventOrString>)232     fn SetUnion2AttributeNullable(&self, _: Option<EventOrString>) {}
GetUnion3AttributeNullable(&self) -> Option<BlobOrBoolean>233     fn GetUnion3AttributeNullable(&self) -> Option<BlobOrBoolean> {
234         Some(BlobOrBoolean::Boolean(true))
235     }
SetUnion3AttributeNullable(&self, _: Option<BlobOrBoolean>)236     fn SetUnion3AttributeNullable(&self, _: Option<BlobOrBoolean>) {}
GetUnion4AttributeNullable(&self) -> Option<UnsignedLongOrBoolean>237     fn GetUnion4AttributeNullable(&self) -> Option<UnsignedLongOrBoolean> {
238         Some(UnsignedLongOrBoolean::Boolean(true))
239     }
SetUnion4AttributeNullable(&self, _: Option<UnsignedLongOrBoolean>)240     fn SetUnion4AttributeNullable(&self, _: Option<UnsignedLongOrBoolean>) {}
GetUnion5AttributeNullable(&self) -> Option<StringOrBoolean>241     fn GetUnion5AttributeNullable(&self) -> Option<StringOrBoolean> {
242         Some(StringOrBoolean::Boolean(true))
243     }
SetUnion5AttributeNullable(&self, _: Option<StringOrBoolean>)244     fn SetUnion5AttributeNullable(&self, _: Option<StringOrBoolean>) {}
GetUnion6AttributeNullable(&self) -> Option<ByteStringOrLong>245     fn GetUnion6AttributeNullable(&self) -> Option<ByteStringOrLong> {
246         Some(ByteStringOrLong::ByteString(ByteString::new(vec!())))
247     }
SetUnion6AttributeNullable(&self, _: Option<ByteStringOrLong>)248     fn SetUnion6AttributeNullable(&self, _: Option<ByteStringOrLong>) {}
BinaryRenamedMethod(&self)249     fn BinaryRenamedMethod(&self) {}
ReceiveVoid(&self)250     fn ReceiveVoid(&self) {}
ReceiveBoolean(&self) -> bool251     fn ReceiveBoolean(&self) -> bool { false }
ReceiveByte(&self) -> i8252     fn ReceiveByte(&self) -> i8 { 0 }
ReceiveOctet(&self) -> u8253     fn ReceiveOctet(&self) -> u8 { 0 }
ReceiveShort(&self) -> i16254     fn ReceiveShort(&self) -> i16 { 0 }
ReceiveUnsignedShort(&self) -> u16255     fn ReceiveUnsignedShort(&self) -> u16 { 0 }
ReceiveLong(&self) -> i32256     fn ReceiveLong(&self) -> i32 { 0 }
ReceiveUnsignedLong(&self) -> u32257     fn ReceiveUnsignedLong(&self) -> u32 { 0 }
ReceiveLongLong(&self) -> i64258     fn ReceiveLongLong(&self) -> i64 { 0 }
ReceiveUnsignedLongLong(&self) -> u64259     fn ReceiveUnsignedLongLong(&self) -> u64 { 0 }
ReceiveUnrestrictedFloat(&self) -> f32260     fn ReceiveUnrestrictedFloat(&self) -> f32 { 0. }
ReceiveFloat(&self) -> Finite<f32>261     fn ReceiveFloat(&self) -> Finite<f32> { Finite::wrap(0.) }
ReceiveUnrestrictedDouble(&self) -> f64262     fn ReceiveUnrestrictedDouble(&self) -> f64 { 0. }
ReceiveDouble(&self) -> Finite<f64>263     fn ReceiveDouble(&self) -> Finite<f64> { Finite::wrap(0.) }
ReceiveString(&self) -> DOMString264     fn ReceiveString(&self) -> DOMString { DOMString::new() }
ReceiveUsvstring(&self) -> USVString265     fn ReceiveUsvstring(&self) -> USVString { USVString("".to_owned()) }
ReceiveByteString(&self) -> ByteString266     fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) }
ReceiveEnum(&self) -> TestEnum267     fn ReceiveEnum(&self) -> TestEnum { TestEnum::_empty }
ReceiveInterface(&self) -> DomRoot<Blob>268     fn ReceiveInterface(&self) -> DomRoot<Blob> {
269         Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())
270     }
271     #[allow(unsafe_code)]
ReceiveAny(&self, _: *mut JSContext) -> JSVal272     unsafe fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
273     #[allow(unsafe_code)]
ReceiveObject(&self, cx: *mut JSContext) -> NonNull<JSObject>274     unsafe fn ReceiveObject(&self, cx: *mut JSContext) -> NonNull<JSObject> {
275         self.ObjectAttribute(cx)
276     }
ReceiveUnion(&self) -> HTMLElementOrLong277     fn ReceiveUnion(&self) -> HTMLElementOrLong { HTMLElementOrLong::Long(0) }
ReceiveUnion2(&self) -> EventOrString278     fn ReceiveUnion2(&self) -> EventOrString { EventOrString::String(DOMString::new()) }
ReceiveUnion3(&self) -> StringOrLongSequence279     fn ReceiveUnion3(&self) -> StringOrLongSequence { StringOrLongSequence::LongSequence(vec![]) }
ReceiveUnion4(&self) -> StringOrStringSequence280     fn ReceiveUnion4(&self) -> StringOrStringSequence { StringOrStringSequence::StringSequence(vec![]) }
ReceiveUnion5(&self) -> BlobOrBlobSequence281     fn ReceiveUnion5(&self) -> BlobOrBlobSequence { BlobOrBlobSequence::BlobSequence(vec![]) }
ReceiveUnion6(&self) -> StringOrUnsignedLong282     fn ReceiveUnion6(&self) -> StringOrUnsignedLong { StringOrUnsignedLong::String(DOMString::new()) }
ReceiveUnion7(&self) -> StringOrBoolean283     fn ReceiveUnion7(&self) -> StringOrBoolean { StringOrBoolean::Boolean(true) }
ReceiveUnion8(&self) -> UnsignedLongOrBoolean284     fn ReceiveUnion8(&self) -> UnsignedLongOrBoolean { UnsignedLongOrBoolean::UnsignedLong(0u32) }
ReceiveUnion9(&self) -> HTMLElementOrUnsignedLongOrStringOrBoolean285     fn ReceiveUnion9(&self) -> HTMLElementOrUnsignedLongOrStringOrBoolean {
286         HTMLElementOrUnsignedLongOrStringOrBoolean::Boolean(true)
287     }
ReceiveUnion10(&self) -> ByteStringOrLong288     fn ReceiveUnion10(&self) -> ByteStringOrLong { ByteStringOrLong::ByteString(ByteString::new(vec!())) }
ReceiveUnion11(&self) -> ByteStringSequenceOrLongOrString289     fn ReceiveUnion11(&self) -> ByteStringSequenceOrLongOrString {
290         ByteStringSequenceOrLongOrString::ByteStringSequence(vec!(ByteString::new(vec!())))
291     }
ReceiveSequence(&self) -> Vec<i32>292     fn ReceiveSequence(&self) -> Vec<i32> { vec![1] }
ReceiveInterfaceSequence(&self) -> Vec<DomRoot<Blob>>293     fn ReceiveInterfaceSequence(&self) -> Vec<DomRoot<Blob>> {
294         vec![Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())]
295     }
296 
ReceiveNullableBoolean(&self) -> Option<bool>297     fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) }
ReceiveNullableByte(&self) -> Option<i8>298     fn ReceiveNullableByte(&self) -> Option<i8> { Some(0) }
ReceiveNullableOctet(&self) -> Option<u8>299     fn ReceiveNullableOctet(&self) -> Option<u8> { Some(0) }
ReceiveNullableShort(&self) -> Option<i16>300     fn ReceiveNullableShort(&self) -> Option<i16> { Some(0) }
ReceiveNullableUnsignedShort(&self) -> Option<u16>301     fn ReceiveNullableUnsignedShort(&self) -> Option<u16> { Some(0) }
ReceiveNullableLong(&self) -> Option<i32>302     fn ReceiveNullableLong(&self) -> Option<i32> { Some(0) }
ReceiveNullableUnsignedLong(&self) -> Option<u32>303     fn ReceiveNullableUnsignedLong(&self) -> Option<u32> { Some(0) }
ReceiveNullableLongLong(&self) -> Option<i64>304     fn ReceiveNullableLongLong(&self) -> Option<i64> { Some(0) }
ReceiveNullableUnsignedLongLong(&self) -> Option<u64>305     fn ReceiveNullableUnsignedLongLong(&self) -> Option<u64> { Some(0) }
ReceiveNullableUnrestrictedFloat(&self) -> Option<f32>306     fn ReceiveNullableUnrestrictedFloat(&self) -> Option<f32> { Some(0.) }
ReceiveNullableFloat(&self) -> Option<Finite<f32>>307     fn ReceiveNullableFloat(&self) -> Option<Finite<f32>> { Some(Finite::wrap(0.)) }
ReceiveNullableUnrestrictedDouble(&self) -> Option<f64>308     fn ReceiveNullableUnrestrictedDouble(&self) -> Option<f64> { Some(0.) }
ReceiveNullableDouble(&self) -> Option<Finite<f64>>309     fn ReceiveNullableDouble(&self) -> Option<Finite<f64>> { Some(Finite::wrap(0.)) }
ReceiveNullableString(&self) -> Option<DOMString>310     fn ReceiveNullableString(&self) -> Option<DOMString> { Some(DOMString::new()) }
ReceiveNullableUsvstring(&self) -> Option<USVString>311     fn ReceiveNullableUsvstring(&self) -> Option<USVString> { Some(USVString("".to_owned())) }
ReceiveNullableByteString(&self) -> Option<ByteString>312     fn ReceiveNullableByteString(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
ReceiveNullableEnum(&self) -> Option<TestEnum>313     fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(TestEnum::_empty) }
ReceiveNullableInterface(&self) -> Option<DomRoot<Blob>>314     fn ReceiveNullableInterface(&self) -> Option<DomRoot<Blob>> {
315         Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()))
316     }
317     #[allow(unsafe_code)]
ReceiveNullableObject(&self, cx: *mut JSContext) -> Option<NonNull<JSObject>>318     unsafe fn ReceiveNullableObject(&self, cx: *mut JSContext) -> Option<NonNull<JSObject>> {
319         self.GetObjectAttributeNullable(cx)
320     }
ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong>321     fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> {
322         Some(HTMLElementOrLong::Long(0))
323     }
ReceiveNullableUnion2(&self) -> Option<EventOrString>324     fn ReceiveNullableUnion2(&self) -> Option<EventOrString> {
325         Some(EventOrString::String(DOMString::new()))
326     }
ReceiveNullableUnion3(&self) -> Option<StringOrLongSequence>327     fn ReceiveNullableUnion3(&self) -> Option<StringOrLongSequence> {
328         Some(StringOrLongSequence::String(DOMString::new()))
329     }
ReceiveNullableUnion4(&self) -> Option<LongSequenceOrBoolean>330     fn ReceiveNullableUnion4(&self) -> Option<LongSequenceOrBoolean> {
331         Some(LongSequenceOrBoolean::Boolean(true))
332     }
ReceiveNullableUnion5(&self) -> Option<UnsignedLongOrBoolean>333     fn ReceiveNullableUnion5(&self) -> Option<UnsignedLongOrBoolean> {
334         Some(UnsignedLongOrBoolean::UnsignedLong(0u32))
335     }
ReceiveNullableUnion6(&self) -> Option<ByteStringOrLong>336     fn ReceiveNullableUnion6(&self) -> Option<ByteStringOrLong> {
337         Some(ByteStringOrLong::ByteString(ByteString::new(vec!())))
338     }
ReceiveNullableSequence(&self) -> Option<Vec<i32>>339     fn ReceiveNullableSequence(&self) -> Option<Vec<i32>> { Some(vec![1]) }
ReceiveTestDictionaryWithSuccessOnKeyword(&self) -> RootedTraceableBox<TestDictionary>340     fn ReceiveTestDictionaryWithSuccessOnKeyword(&self) -> RootedTraceableBox<TestDictionary> {
341         RootedTraceableBox::new(TestDictionary {
342             anyValue: Heap::default(),
343             booleanValue: None,
344             byteValue: None,
345             dict: RootedTraceableBox::new(TestDictionaryDefaults {
346                 UnrestrictedDoubleValue: 0.0,
347                 anyValue: Heap::default(),
348                 booleanValue: false,
349                 bytestringValue: ByteString::new(vec![]),
350                 byteValue: 0,
351                 doubleValue: Finite::new(1.0).unwrap(),
352                 enumValue: TestEnum::Foo,
353                 floatValue: Finite::new(1.0).unwrap(),
354                 longLongValue: 54,
355                 longValue: 12,
356                 nullableBooleanValue: None,
357                 nullableBytestringValue: None,
358                 nullableByteValue: None,
359                 nullableDoubleValue: None,
360                 nullableFloatValue: None,
361                 nullableLongLongValue: None,
362                 nullableLongValue: None,
363                 nullableObjectValue: Heap::default(),
364                 nullableOctetValue: None,
365                 nullableShortValue: None,
366                 nullableStringValue: None,
367                 nullableUnrestrictedDoubleValue: None,
368                 nullableUnrestrictedFloatValue: None,
369                 nullableUnsignedLongLongValue: None,
370                 nullableUnsignedLongValue: None,
371                 nullableUnsignedShortValue: None,
372                 nullableUsvstringValue: None,
373                 octetValue: 0,
374                 shortValue: 0,
375                 stringValue: DOMString::new(),
376                 unrestrictedFloatValue: 0.0,
377                 unsignedLongLongValue: 0,
378                 unsignedLongValue: 0,
379                 unsignedShortValue: 0,
380                 usvstringValue: USVString("".to_owned()),
381             }),
382             doubleValue: None,
383             enumValue: None,
384             floatValue: None,
385             interfaceValue: None,
386             longLongValue: None,
387             longValue: None,
388             objectValue: None,
389             octetValue: None,
390             requiredValue: true,
391             seqDict: None,
392             elementSequence: None,
393             shortValue: None,
394             stringValue: None,
395             type_: Some(DOMString::from("success")),
396             unrestrictedDoubleValue: None,
397             unrestrictedFloatValue: None,
398             unsignedLongLongValue: None,
399             unsignedLongValue: None,
400             unsignedShortValue: None,
401             usvstringValue: None,
402             nonRequiredNullable: None,
403             nonRequiredNullable2: Some(None), // null
404         })
405     }
406 
DictMatchesPassedValues(&self, arg: RootedTraceableBox<TestDictionary>) -> bool407     fn DictMatchesPassedValues(&self, arg: RootedTraceableBox<TestDictionary>) -> bool {
408         arg.type_.as_ref().map(|s| s == "success").unwrap_or(false) &&
409             arg.nonRequiredNullable.is_none() &&
410             arg.nonRequiredNullable2 == Some(None)
411     }
412 
PassBoolean(&self, _: bool)413     fn PassBoolean(&self, _: bool) {}
PassByte(&self, _: i8)414     fn PassByte(&self, _: i8) {}
PassOctet(&self, _: u8)415     fn PassOctet(&self, _: u8) {}
PassShort(&self, _: i16)416     fn PassShort(&self, _: i16) {}
PassUnsignedShort(&self, _: u16)417     fn PassUnsignedShort(&self, _: u16) {}
PassLong(&self, _: i32)418     fn PassLong(&self, _: i32) {}
PassUnsignedLong(&self, _: u32)419     fn PassUnsignedLong(&self, _: u32) {}
PassLongLong(&self, _: i64)420     fn PassLongLong(&self, _: i64) {}
PassUnsignedLongLong(&self, _: u64)421     fn PassUnsignedLongLong(&self, _: u64) {}
PassUnrestrictedFloat(&self, _: f32)422     fn PassUnrestrictedFloat(&self, _: f32) {}
PassFloat(&self, _: Finite<f32>)423     fn PassFloat(&self, _: Finite<f32>) {}
PassUnrestrictedDouble(&self, _: f64)424     fn PassUnrestrictedDouble(&self, _: f64) {}
PassDouble(&self, _: Finite<f64>)425     fn PassDouble(&self, _: Finite<f64>) {}
PassString(&self, _: DOMString)426     fn PassString(&self, _: DOMString) {}
PassUsvstring(&self, _: USVString)427     fn PassUsvstring(&self, _: USVString) {}
PassByteString(&self, _: ByteString)428     fn PassByteString(&self, _: ByteString) {}
PassEnum(&self, _: TestEnum)429     fn PassEnum(&self, _: TestEnum) {}
PassInterface(&self, _: &Blob)430     fn PassInterface(&self, _: &Blob) {}
PassUnion(&self, _: HTMLElementOrLong)431     fn PassUnion(&self, _: HTMLElementOrLong) {}
PassUnion2(&self, _: EventOrString)432     fn PassUnion2(&self, _: EventOrString) {}
PassUnion3(&self, _: BlobOrString)433     fn PassUnion3(&self, _: BlobOrString) {}
PassUnion4(&self, _: StringOrStringSequence)434     fn PassUnion4(&self, _: StringOrStringSequence) {}
PassUnion5(&self, _: StringOrBoolean)435     fn PassUnion5(&self, _: StringOrBoolean) {}
PassUnion6(&self, _: UnsignedLongOrBoolean)436     fn PassUnion6(&self, _: UnsignedLongOrBoolean) {}
PassUnion7(&self, _: StringSequenceOrUnsignedLong)437     fn PassUnion7(&self, _: StringSequenceOrUnsignedLong) {}
PassUnion8(&self, _: ByteStringSequenceOrLong)438     fn PassUnion8(&self, _: ByteStringSequenceOrLong) {}
PassUnion9(&self, _: UnionTypes::TestDictionaryOrLong)439     fn PassUnion9(&self, _: UnionTypes::TestDictionaryOrLong) {}
440     #[allow(unsafe_code)]
PassUnion10(&self, _: *mut JSContext, _: UnionTypes::StringOrObject)441     unsafe fn PassUnion10(&self, _: *mut JSContext, _: UnionTypes::StringOrObject) {}
PassUnionWithTypedef(&self, _: DocumentOrTestTypedef)442     fn PassUnionWithTypedef(&self, _: DocumentOrTestTypedef) {}
PassUnionWithTypedef2(&self, _: LongSequenceOrTestTypedef)443     fn PassUnionWithTypedef2(&self, _: LongSequenceOrTestTypedef) {}
444     #[allow(unsafe_code)]
PassAny(&self, _: *mut JSContext, _: HandleValue)445     unsafe fn PassAny(&self, _: *mut JSContext, _: HandleValue) {}
446     #[allow(unsafe_code)]
PassObject(&self, _: *mut JSContext, _: *mut JSObject)447     unsafe fn PassObject(&self, _: *mut JSContext, _: *mut JSObject) {}
PassCallbackFunction(&self, _: Rc<Function>)448     fn PassCallbackFunction(&self, _: Rc<Function>) {}
PassCallbackInterface(&self, _: Rc<EventListener>)449     fn PassCallbackInterface(&self, _: Rc<EventListener>) {}
PassSequence(&self, _: Vec<i32>)450     fn PassSequence(&self, _: Vec<i32>) {}
451     #[allow(unsafe_code)]
PassAnySequence(&self, _: *mut JSContext, _: CustomAutoRooterGuard<Vec<JSVal>>)452     unsafe fn PassAnySequence(&self, _: *mut JSContext, _: CustomAutoRooterGuard<Vec<JSVal>>) {}
453     #[allow(unsafe_code)]
AnySequencePassthrough(&self, _: *mut JSContext, seq: CustomAutoRooterGuard<Vec<JSVal>>) -> Vec<JSVal>454     unsafe fn AnySequencePassthrough(&self, _: *mut JSContext, seq: CustomAutoRooterGuard<Vec<JSVal>>) -> Vec<JSVal> {
455         (*seq).clone()
456     }
457     #[allow(unsafe_code)]
PassObjectSequence(&self, _: *mut JSContext, _: CustomAutoRooterGuard<Vec<*mut JSObject>>)458     unsafe fn PassObjectSequence(&self, _: *mut JSContext, _: CustomAutoRooterGuard<Vec<*mut JSObject>>) {}
PassStringSequence(&self, _: Vec<DOMString>)459     fn PassStringSequence(&self, _: Vec<DOMString>) {}
PassInterfaceSequence(&self, _: Vec<DomRoot<Blob>>)460     fn PassInterfaceSequence(&self, _: Vec<DomRoot<Blob>>) {}
461 
PassNullableBoolean(&self, _: Option<bool>)462     fn PassNullableBoolean(&self, _: Option<bool>) {}
PassNullableByte(&self, _: Option<i8>)463     fn PassNullableByte(&self, _: Option<i8>) {}
PassNullableOctet(&self, _: Option<u8>)464     fn PassNullableOctet(&self, _: Option<u8>) {}
PassNullableShort(&self, _: Option<i16>)465     fn PassNullableShort(&self, _: Option<i16>) {}
PassNullableUnsignedShort(&self, _: Option<u16>)466     fn PassNullableUnsignedShort(&self, _: Option<u16>) {}
PassNullableLong(&self, _: Option<i32>)467     fn PassNullableLong(&self, _: Option<i32>) {}
PassNullableUnsignedLong(&self, _: Option<u32>)468     fn PassNullableUnsignedLong(&self, _: Option<u32>) {}
PassNullableLongLong(&self, _: Option<i64>)469     fn PassNullableLongLong(&self, _: Option<i64>) {}
PassNullableUnsignedLongLong(&self, _: Option<u64>)470     fn PassNullableUnsignedLongLong(&self, _: Option<u64>) {}
PassNullableUnrestrictedFloat(&self, _: Option<f32>)471     fn PassNullableUnrestrictedFloat(&self, _: Option<f32>) {}
PassNullableFloat(&self, _: Option<Finite<f32>>)472     fn PassNullableFloat(&self, _: Option<Finite<f32>>) {}
PassNullableUnrestrictedDouble(&self, _: Option<f64>)473     fn PassNullableUnrestrictedDouble(&self, _: Option<f64>) {}
PassNullableDouble(&self, _: Option<Finite<f64>>)474     fn PassNullableDouble(&self, _: Option<Finite<f64>>) {}
PassNullableString(&self, _: Option<DOMString>)475     fn PassNullableString(&self, _: Option<DOMString>) {}
PassNullableUsvstring(&self, _: Option<USVString>)476     fn PassNullableUsvstring(&self, _: Option<USVString>) {}
PassNullableByteString(&self, _: Option<ByteString>)477     fn PassNullableByteString(&self, _: Option<ByteString>) {}
478     // fn PassNullableEnum(self, _: Option<TestEnum>) {}
PassNullableInterface(&self, _: Option<&Blob>)479     fn PassNullableInterface(&self, _: Option<&Blob>) {}
480     #[allow(unsafe_code)]
PassNullableObject(&self, _: *mut JSContext, _: *mut JSObject)481     unsafe fn PassNullableObject(&self, _: *mut JSContext, _: *mut JSObject) {}
PassNullableUnion(&self, _: Option<HTMLElementOrLong>)482     fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>) {}
PassNullableUnion2(&self, _: Option<EventOrString>)483     fn PassNullableUnion2(&self, _: Option<EventOrString>) {}
PassNullableUnion3(&self, _: Option<StringOrLongSequence>)484     fn PassNullableUnion3(&self, _: Option<StringOrLongSequence>) {}
PassNullableUnion4(&self, _: Option<LongSequenceOrBoolean>)485     fn PassNullableUnion4(&self, _: Option<LongSequenceOrBoolean>) {}
PassNullableUnion5(&self, _: Option<UnsignedLongOrBoolean>)486     fn PassNullableUnion5(&self, _: Option<UnsignedLongOrBoolean>) {}
PassNullableUnion6(&self, _: Option<ByteStringOrLong>)487     fn PassNullableUnion6(&self, _: Option<ByteStringOrLong>) {}
PassNullableCallbackFunction(&self, _: Option<Rc<Function>>)488     fn PassNullableCallbackFunction(&self, _: Option<Rc<Function>>) {}
PassNullableCallbackInterface(&self, _: Option<Rc<EventListener>>)489     fn PassNullableCallbackInterface(&self, _: Option<Rc<EventListener>>) {}
PassNullableSequence(&self, _: Option<Vec<i32>>)490     fn PassNullableSequence(&self, _: Option<Vec<i32>>) {}
491 
PassOptionalBoolean(&self, _: Option<bool>)492     fn PassOptionalBoolean(&self, _: Option<bool>) {}
PassOptionalByte(&self, _: Option<i8>)493     fn PassOptionalByte(&self, _: Option<i8>) {}
PassOptionalOctet(&self, _: Option<u8>)494     fn PassOptionalOctet(&self, _: Option<u8>) {}
PassOptionalShort(&self, _: Option<i16>)495     fn PassOptionalShort(&self, _: Option<i16>) {}
PassOptionalUnsignedShort(&self, _: Option<u16>)496     fn PassOptionalUnsignedShort(&self, _: Option<u16>) {}
PassOptionalLong(&self, _: Option<i32>)497     fn PassOptionalLong(&self, _: Option<i32>) {}
PassOptionalUnsignedLong(&self, _: Option<u32>)498     fn PassOptionalUnsignedLong(&self, _: Option<u32>) {}
PassOptionalLongLong(&self, _: Option<i64>)499     fn PassOptionalLongLong(&self, _: Option<i64>) {}
PassOptionalUnsignedLongLong(&self, _: Option<u64>)500     fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
PassOptionalUnrestrictedFloat(&self, _: Option<f32>)501     fn PassOptionalUnrestrictedFloat(&self, _: Option<f32>) {}
PassOptionalFloat(&self, _: Option<Finite<f32>>)502     fn PassOptionalFloat(&self, _: Option<Finite<f32>>) {}
PassOptionalUnrestrictedDouble(&self, _: Option<f64>)503     fn PassOptionalUnrestrictedDouble(&self, _: Option<f64>) {}
PassOptionalDouble(&self, _: Option<Finite<f64>>)504     fn PassOptionalDouble(&self, _: Option<Finite<f64>>) {}
PassOptionalString(&self, _: Option<DOMString>)505     fn PassOptionalString(&self, _: Option<DOMString>) {}
PassOptionalUsvstring(&self, _: Option<USVString>)506     fn PassOptionalUsvstring(&self, _: Option<USVString>) {}
PassOptionalByteString(&self, _: Option<ByteString>)507     fn PassOptionalByteString(&self, _: Option<ByteString>) {}
PassOptionalEnum(&self, _: Option<TestEnum>)508     fn PassOptionalEnum(&self, _: Option<TestEnum>) {}
PassOptionalInterface(&self, _: Option<&Blob>)509     fn PassOptionalInterface(&self, _: Option<&Blob>) {}
PassOptionalUnion(&self, _: Option<HTMLElementOrLong>)510     fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
PassOptionalUnion2(&self, _: Option<EventOrString>)511     fn PassOptionalUnion2(&self, _: Option<EventOrString>) {}
PassOptionalUnion3(&self, _: Option<StringOrLongSequence>)512     fn PassOptionalUnion3(&self, _: Option<StringOrLongSequence>) {}
PassOptionalUnion4(&self, _: Option<LongSequenceOrBoolean>)513     fn PassOptionalUnion4(&self, _: Option<LongSequenceOrBoolean>) {}
PassOptionalUnion5(&self, _: Option<UnsignedLongOrBoolean>)514     fn PassOptionalUnion5(&self, _: Option<UnsignedLongOrBoolean>) {}
PassOptionalUnion6(&self, _: Option<ByteStringOrLong>)515     fn PassOptionalUnion6(&self, _: Option<ByteStringOrLong>) {}
516     #[allow(unsafe_code)]
PassOptionalAny(&self, _: *mut JSContext, _: HandleValue)517     unsafe fn PassOptionalAny(&self, _: *mut JSContext, _: HandleValue) {}
518     #[allow(unsafe_code)]
PassOptionalObject(&self, _: *mut JSContext, _: Option<*mut JSObject>)519     unsafe fn PassOptionalObject(&self, _: *mut JSContext, _: Option<*mut JSObject>) {}
PassOptionalCallbackFunction(&self, _: Option<Rc<Function>>)520     fn PassOptionalCallbackFunction(&self, _: Option<Rc<Function>>) {}
PassOptionalCallbackInterface(&self, _: Option<Rc<EventListener>>)521     fn PassOptionalCallbackInterface(&self, _: Option<Rc<EventListener>>) {}
PassOptionalSequence(&self, _: Option<Vec<i32>>)522     fn PassOptionalSequence(&self, _: Option<Vec<i32>>) {}
523 
PassOptionalNullableBoolean(&self, _: Option<Option<bool>>)524     fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
PassOptionalNullableByte(&self, _: Option<Option<i8>>)525     fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
PassOptionalNullableOctet(&self, _: Option<Option<u8>>)526     fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>) {}
PassOptionalNullableShort(&self, _: Option<Option<i16>>)527     fn PassOptionalNullableShort(&self, _: Option<Option<i16>>) {}
PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>)528     fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>) {}
PassOptionalNullableLong(&self, _: Option<Option<i32>>)529     fn PassOptionalNullableLong(&self, _: Option<Option<i32>>) {}
PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>)530     fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>) {}
PassOptionalNullableLongLong(&self, _: Option<Option<i64>>)531     fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>) {}
PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>)532     fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>) {}
PassOptionalNullableUnrestrictedFloat(&self, _: Option<Option<f32>>)533     fn PassOptionalNullableUnrestrictedFloat(&self, _: Option<Option<f32>>) {}
PassOptionalNullableFloat(&self, _: Option<Option<Finite<f32>>>)534     fn PassOptionalNullableFloat(&self, _: Option<Option<Finite<f32>>>) {}
PassOptionalNullableUnrestrictedDouble(&self, _: Option<Option<f64>>)535     fn PassOptionalNullableUnrestrictedDouble(&self, _: Option<Option<f64>>) {}
PassOptionalNullableDouble(&self, _: Option<Option<Finite<f64>>>)536     fn PassOptionalNullableDouble(&self, _: Option<Option<Finite<f64>>>) {}
PassOptionalNullableString(&self, _: Option<Option<DOMString>>)537     fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
PassOptionalNullableUsvstring(&self, _: Option<Option<USVString>>)538     fn PassOptionalNullableUsvstring(&self, _: Option<Option<USVString>>) {}
PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>)539     fn PassOptionalNullableByteString(&self, _: Option<Option<ByteString>>) {}
540     // fn PassOptionalNullableEnum(self, _: Option<Option<TestEnum>>) {}
PassOptionalNullableInterface(&self, _: Option<Option<&Blob>>)541     fn PassOptionalNullableInterface(&self, _: Option<Option<&Blob>>) {}
542     #[allow(unsafe_code)]
PassOptionalNullableObject(&self, _: *mut JSContext, _: Option<*mut JSObject>)543     unsafe fn PassOptionalNullableObject(&self, _: *mut JSContext, _: Option<*mut JSObject>) {}
PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>)544     fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
PassOptionalNullableUnion2(&self, _: Option<Option<EventOrString>>)545     fn PassOptionalNullableUnion2(&self, _: Option<Option<EventOrString>>) {}
PassOptionalNullableUnion3(&self, _: Option<Option<StringOrLongSequence>>)546     fn PassOptionalNullableUnion3(&self, _: Option<Option<StringOrLongSequence>>) {}
PassOptionalNullableUnion4(&self, _: Option<Option<LongSequenceOrBoolean>>)547     fn PassOptionalNullableUnion4(&self, _: Option<Option<LongSequenceOrBoolean>>) {}
PassOptionalNullableUnion5(&self, _: Option<Option<UnsignedLongOrBoolean>>)548     fn PassOptionalNullableUnion5(&self, _: Option<Option<UnsignedLongOrBoolean>>) {}
PassOptionalNullableUnion6(&self, _: Option<Option<ByteStringOrLong>>)549     fn PassOptionalNullableUnion6(&self, _: Option<Option<ByteStringOrLong>>) {}
PassOptionalNullableCallbackFunction(&self, _: Option<Option<Rc<Function>>>)550     fn PassOptionalNullableCallbackFunction(&self, _: Option<Option<Rc<Function>>>) {}
PassOptionalNullableCallbackInterface(&self, _: Option<Option<Rc<EventListener>>>)551     fn PassOptionalNullableCallbackInterface(&self, _: Option<Option<Rc<EventListener>>>) {}
PassOptionalNullableSequence(&self, _: Option<Option<Vec<i32>>>)552     fn PassOptionalNullableSequence(&self, _: Option<Option<Vec<i32>>>) {}
553 
PassOptionalBooleanWithDefault(&self, _: bool)554     fn PassOptionalBooleanWithDefault(&self, _: bool) {}
PassOptionalByteWithDefault(&self, _: i8)555     fn PassOptionalByteWithDefault(&self, _: i8) {}
PassOptionalOctetWithDefault(&self, _: u8)556     fn PassOptionalOctetWithDefault(&self, _: u8) {}
PassOptionalShortWithDefault(&self, _: i16)557     fn PassOptionalShortWithDefault(&self, _: i16) {}
PassOptionalUnsignedShortWithDefault(&self, _: u16)558     fn PassOptionalUnsignedShortWithDefault(&self, _: u16) {}
PassOptionalLongWithDefault(&self, _: i32)559     fn PassOptionalLongWithDefault(&self, _: i32) {}
PassOptionalUnsignedLongWithDefault(&self, _: u32)560     fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
PassOptionalLongLongWithDefault(&self, _: i64)561     fn PassOptionalLongLongWithDefault(&self, _: i64) {}
PassOptionalUnsignedLongLongWithDefault(&self, _: u64)562     fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
PassOptionalStringWithDefault(&self, _: DOMString)563     fn PassOptionalStringWithDefault(&self, _: DOMString) {}
PassOptionalUsvstringWithDefault(&self, _: USVString)564     fn PassOptionalUsvstringWithDefault(&self, _: USVString) {}
PassOptionalBytestringWithDefault(&self, _: ByteString)565     fn PassOptionalBytestringWithDefault(&self, _: ByteString) {}
PassOptionalEnumWithDefault(&self, _: TestEnum)566     fn PassOptionalEnumWithDefault(&self, _: TestEnum) {}
567 
PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>)568     fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
PassOptionalNullableByteWithDefault(&self, _: Option<i8>)569     fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
PassOptionalNullableOctetWithDefault(&self, _: Option<u8>)570     fn PassOptionalNullableOctetWithDefault(&self, _: Option<u8>) {}
PassOptionalNullableShortWithDefault(&self, _: Option<i16>)571     fn PassOptionalNullableShortWithDefault(&self, _: Option<i16>) {}
PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>)572     fn PassOptionalNullableUnsignedShortWithDefault(&self, _: Option<u16>) {}
PassOptionalNullableLongWithDefault(&self, _: Option<i32>)573     fn PassOptionalNullableLongWithDefault(&self, _: Option<i32>) {}
PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>)574     fn PassOptionalNullableUnsignedLongWithDefault(&self, _: Option<u32>) {}
PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>)575     fn PassOptionalNullableLongLongWithDefault(&self, _: Option<i64>) {}
PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>)576     fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
577     // fn PassOptionalNullableUnrestrictedFloatWithDefault(self, _: Option<f32>) {}
578     // fn PassOptionalNullableFloatWithDefault(self, _: Option<Finite<f32>>) {}
579     // fn PassOptionalNullableUnrestrictedDoubleWithDefault(self, _: Option<f64>) {}
580     // fn PassOptionalNullableDoubleWithDefault(self, _: Option<Finite<f64>>) {}
PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>)581     fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
PassOptionalNullableUsvstringWithDefault(&self, _: Option<USVString>)582     fn PassOptionalNullableUsvstringWithDefault(&self, _: Option<USVString>) {}
PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>)583     fn PassOptionalNullableByteStringWithDefault(&self, _: Option<ByteString>) {}
584     // fn PassOptionalNullableEnumWithDefault(self, _: Option<TestEnum>) {}
PassOptionalNullableInterfaceWithDefault(&self, _: Option<&Blob>)585     fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<&Blob>) {}
586     #[allow(unsafe_code)]
PassOptionalNullableObjectWithDefault(&self, _: *mut JSContext, _: *mut JSObject)587     unsafe fn PassOptionalNullableObjectWithDefault(&self, _: *mut JSContext, _: *mut JSObject) {}
PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>)588     fn PassOptionalNullableUnionWithDefault(&self, _: Option<HTMLElementOrLong>) {}
PassOptionalNullableUnion2WithDefault(&self, _: Option<EventOrString>)589     fn PassOptionalNullableUnion2WithDefault(&self, _: Option<EventOrString>) {}
590     // fn PassOptionalNullableCallbackFunctionWithDefault(self, _: Option<Function>) {}
PassOptionalNullableCallbackInterfaceWithDefault(&self, _: Option<Rc<EventListener>>)591     fn PassOptionalNullableCallbackInterfaceWithDefault(&self, _: Option<Rc<EventListener>>) {}
592     #[allow(unsafe_code)]
PassOptionalAnyWithDefault(&self, _: *mut JSContext, _: HandleValue)593     unsafe fn PassOptionalAnyWithDefault(&self, _: *mut JSContext, _: HandleValue) {}
594 
PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>)595     fn PassOptionalNullableBooleanWithNonNullDefault(&self, _: Option<bool>) {}
PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>)596     fn PassOptionalNullableByteWithNonNullDefault(&self, _: Option<i8>) {}
PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>)597     fn PassOptionalNullableOctetWithNonNullDefault(&self, _: Option<u8>) {}
PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>)598     fn PassOptionalNullableShortWithNonNullDefault(&self, _: Option<i16>) {}
PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>)599     fn PassOptionalNullableUnsignedShortWithNonNullDefault(&self, _: Option<u16>) {}
PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>)600     fn PassOptionalNullableLongWithNonNullDefault(&self, _: Option<i32>) {}
PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>)601     fn PassOptionalNullableUnsignedLongWithNonNullDefault(&self, _: Option<u32>) {}
PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>)602     fn PassOptionalNullableLongLongWithNonNullDefault(&self, _: Option<i64>) {}
PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>)603     fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(&self, _: Option<u64>) {}
604     // fn PassOptionalNullableUnrestrictedFloatWithNonNullDefault(self, _: Option<f32>) {}
605     // fn PassOptionalNullableFloatWithNonNullDefault(self, _: Option<Finite<f32>>) {}
606     // fn PassOptionalNullableUnrestrictedDoubleWithNonNullDefault(self, _: Option<f64>) {}
607     // fn PassOptionalNullableDoubleWithNonNullDefault(self, _: Option<Finite<f64>>) {}
PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>)608     fn PassOptionalNullableStringWithNonNullDefault(&self, _: Option<DOMString>) {}
PassOptionalNullableUsvstringWithNonNullDefault(&self, _: Option<USVString>)609     fn PassOptionalNullableUsvstringWithNonNullDefault(&self, _: Option<USVString>) {}
610     // fn PassOptionalNullableEnumWithNonNullDefault(self, _: Option<TestEnum>) {}
PassOptionalOverloaded(&self, a: &TestBinding, _: u32, _: u32) -> DomRoot<TestBinding>611     fn PassOptionalOverloaded(&self, a: &TestBinding, _: u32, _: u32) -> DomRoot<TestBinding> { DomRoot::from_ref(a) }
PassOptionalOverloaded_(&self, _: &Blob, _: u32)612     fn PassOptionalOverloaded_(&self, _: &Blob,  _: u32) { }
613 
PassVariadicBoolean(&self, _: Vec<bool>)614     fn PassVariadicBoolean(&self, _: Vec<bool>) {}
PassVariadicBooleanAndDefault(&self, _: bool, _: Vec<bool>)615     fn PassVariadicBooleanAndDefault(&self, _: bool, _: Vec<bool>) {}
PassVariadicByte(&self, _: Vec<i8>)616     fn PassVariadicByte(&self, _: Vec<i8>) {}
PassVariadicOctet(&self, _: Vec<u8>)617     fn PassVariadicOctet(&self, _: Vec<u8>) {}
PassVariadicShort(&self, _: Vec<i16>)618     fn PassVariadicShort(&self, _: Vec<i16>) {}
PassVariadicUnsignedShort(&self, _: Vec<u16>)619     fn PassVariadicUnsignedShort(&self, _: Vec<u16>) {}
PassVariadicLong(&self, _: Vec<i32>)620     fn PassVariadicLong(&self, _: Vec<i32>) {}
PassVariadicUnsignedLong(&self, _: Vec<u32>)621     fn PassVariadicUnsignedLong(&self, _: Vec<u32>) {}
PassVariadicLongLong(&self, _: Vec<i64>)622     fn PassVariadicLongLong(&self, _: Vec<i64>) {}
PassVariadicUnsignedLongLong(&self, _: Vec<u64>)623     fn PassVariadicUnsignedLongLong(&self, _: Vec<u64>) {}
PassVariadicUnrestrictedFloat(&self, _: Vec<f32>)624     fn PassVariadicUnrestrictedFloat(&self, _: Vec<f32>) {}
PassVariadicFloat(&self, _: Vec<Finite<f32>>)625     fn PassVariadicFloat(&self, _: Vec<Finite<f32>>) {}
PassVariadicUnrestrictedDouble(&self, _: Vec<f64>)626     fn PassVariadicUnrestrictedDouble(&self, _: Vec<f64>) {}
PassVariadicDouble(&self, _: Vec<Finite<f64>>)627     fn PassVariadicDouble(&self, _: Vec<Finite<f64>>) {}
PassVariadicString(&self, _: Vec<DOMString>)628     fn PassVariadicString(&self, _: Vec<DOMString>) {}
PassVariadicUsvstring(&self, _: Vec<USVString>)629     fn PassVariadicUsvstring(&self, _: Vec<USVString>) {}
PassVariadicByteString(&self, _: Vec<ByteString>)630     fn PassVariadicByteString(&self, _: Vec<ByteString>) {}
PassVariadicEnum(&self, _: Vec<TestEnum>)631     fn PassVariadicEnum(&self, _: Vec<TestEnum>) {}
PassVariadicInterface(&self, _: &[&Blob])632     fn PassVariadicInterface(&self, _: &[&Blob]) {}
PassVariadicUnion(&self, _: Vec<HTMLElementOrLong>)633     fn PassVariadicUnion(&self, _: Vec<HTMLElementOrLong>) {}
PassVariadicUnion2(&self, _: Vec<EventOrString>)634     fn PassVariadicUnion2(&self, _: Vec<EventOrString>) {}
PassVariadicUnion3(&self, _: Vec<BlobOrString>)635     fn PassVariadicUnion3(&self, _: Vec<BlobOrString>) {}
PassVariadicUnion4(&self, _: Vec<BlobOrBoolean>)636     fn PassVariadicUnion4(&self, _: Vec<BlobOrBoolean>) {}
PassVariadicUnion5(&self, _: Vec<StringOrUnsignedLong>)637     fn PassVariadicUnion5(&self, _: Vec<StringOrUnsignedLong>) {}
PassVariadicUnion6(&self, _: Vec<UnsignedLongOrBoolean>)638     fn PassVariadicUnion6(&self, _: Vec<UnsignedLongOrBoolean>) {}
PassVariadicUnion7(&self, _: Vec<ByteStringOrLong>)639     fn PassVariadicUnion7(&self, _: Vec<ByteStringOrLong>) {}
640     #[allow(unsafe_code)]
PassVariadicAny(&self, _: *mut JSContext, _: Vec<HandleValue>)641     unsafe fn PassVariadicAny(&self, _: *mut JSContext, _: Vec<HandleValue>) {}
642     #[allow(unsafe_code)]
PassVariadicObject(&self, _: *mut JSContext, _: Vec<*mut JSObject>)643     unsafe fn PassVariadicObject(&self, _: *mut JSContext, _: Vec<*mut JSObject>) {}
BooleanMozPreference(&self, pref_name: DOMString) -> bool644     fn BooleanMozPreference(&self, pref_name: DOMString) -> bool {
645         PREFS.get(pref_name.as_ref()).as_boolean().unwrap_or(false)
646     }
StringMozPreference(&self, pref_name: DOMString) -> DOMString647     fn StringMozPreference(&self, pref_name: DOMString) -> DOMString {
648         PREFS.get(pref_name.as_ref()).as_string().map(|s| DOMString::from(s)).unwrap_or_else(|| DOMString::new())
649     }
PrefControlledAttributeDisabled(&self) -> bool650     fn PrefControlledAttributeDisabled(&self) -> bool { false }
PrefControlledAttributeEnabled(&self) -> bool651     fn PrefControlledAttributeEnabled(&self) -> bool { false }
PrefControlledMethodDisabled(&self)652     fn PrefControlledMethodDisabled(&self) {}
PrefControlledMethodEnabled(&self)653     fn PrefControlledMethodEnabled(&self) {}
FuncControlledAttributeDisabled(&self) -> bool654     fn FuncControlledAttributeDisabled(&self) -> bool { false }
FuncControlledAttributeEnabled(&self) -> bool655     fn FuncControlledAttributeEnabled(&self) -> bool { false }
FuncControlledMethodDisabled(&self)656     fn FuncControlledMethodDisabled(&self) {}
FuncControlledMethodEnabled(&self)657     fn FuncControlledMethodEnabled(&self) {}
658 
PassMozMap(&self, _: MozMap<i32>)659     fn PassMozMap(&self, _: MozMap<i32>) {}
PassNullableMozMap(&self, _: Option<MozMap<i32> >)660     fn PassNullableMozMap(&self, _: Option<MozMap<i32> >) {}
PassMozMapOfNullableInts(&self, _: MozMap<Option<i32>>)661     fn PassMozMapOfNullableInts(&self, _: MozMap<Option<i32>>) {}
PassOptionalMozMapOfNullableInts(&self, _: Option<MozMap<Option<i32>>>)662     fn PassOptionalMozMapOfNullableInts(&self, _: Option<MozMap<Option<i32>>>) {}
PassOptionalNullableMozMapOfNullableInts(&self, _: Option<Option<MozMap<Option<i32>> >>)663     fn PassOptionalNullableMozMapOfNullableInts(&self, _: Option<Option<MozMap<Option<i32>> >>) {}
PassCastableObjectMozMap(&self, _: MozMap<DomRoot<TestBinding>>)664     fn PassCastableObjectMozMap(&self, _: MozMap<DomRoot<TestBinding>>) {}
PassNullableCastableObjectMozMap(&self, _: MozMap<Option<DomRoot<TestBinding>>>)665     fn PassNullableCastableObjectMozMap(&self, _: MozMap<Option<DomRoot<TestBinding>>>) {}
PassCastableObjectNullableMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>)666     fn PassCastableObjectNullableMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
PassNullableCastableObjectNullableMozMap(&self, _: Option<MozMap<Option<DomRoot<TestBinding>>>>)667     fn PassNullableCastableObjectNullableMozMap(&self, _: Option<MozMap<Option<DomRoot<TestBinding>>>>) {}
PassOptionalMozMap(&self, _: Option<MozMap<i32>>)668     fn PassOptionalMozMap(&self, _: Option<MozMap<i32>>) {}
PassOptionalNullableMozMap(&self, _: Option<Option<MozMap<i32>>>)669     fn PassOptionalNullableMozMap(&self, _: Option<Option<MozMap<i32>>>) {}
PassOptionalNullableMozMapWithDefaultValue(&self, _: Option<MozMap<i32>>)670     fn PassOptionalNullableMozMapWithDefaultValue(&self, _: Option<MozMap<i32>>) {}
PassOptionalObjectMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>)671     fn PassOptionalObjectMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
PassStringMozMap(&self, _: MozMap<DOMString>)672     fn PassStringMozMap(&self, _: MozMap<DOMString>) {}
PassByteStringMozMap(&self, _: MozMap<ByteString>)673     fn PassByteStringMozMap(&self, _: MozMap<ByteString>) {}
PassMozMapOfMozMaps(&self, _: MozMap<MozMap<i32>>)674     fn PassMozMapOfMozMaps(&self, _: MozMap<MozMap<i32>>) {}
PassMozMapUnion(&self, _: UnionTypes::LongOrStringByteStringRecord)675     fn PassMozMapUnion(&self, _: UnionTypes::LongOrStringByteStringRecord) {}
PassMozMapUnion2(&self, _: UnionTypes::TestBindingOrStringByteStringRecord)676     fn PassMozMapUnion2(&self, _: UnionTypes::TestBindingOrStringByteStringRecord) {}
PassMozMapUnion3(&self, _: UnionTypes::TestBindingOrByteStringSequenceSequenceOrStringByteStringRecord)677     fn PassMozMapUnion3(&self, _: UnionTypes::TestBindingOrByteStringSequenceSequenceOrStringByteStringRecord) {}
ReceiveMozMap(&self) -> MozMap<i32>678     fn ReceiveMozMap(&self) -> MozMap<i32> { MozMap::new() }
ReceiveNullableMozMap(&self) -> Option<MozMap<i32>>679     fn ReceiveNullableMozMap(&self) -> Option<MozMap<i32>> { Some(MozMap::new()) }
ReceiveMozMapOfNullableInts(&self) -> MozMap<Option<i32>>680     fn ReceiveMozMapOfNullableInts(&self) -> MozMap<Option<i32>> { MozMap::new() }
ReceiveNullableMozMapOfNullableInts(&self) -> Option<MozMap<Option<i32>>>681     fn ReceiveNullableMozMapOfNullableInts(&self) -> Option<MozMap<Option<i32>>> { Some(MozMap::new()) }
ReceiveMozMapOfMozMaps(&self) -> MozMap<MozMap<i32>>682     fn ReceiveMozMapOfMozMaps(&self) -> MozMap<MozMap<i32>> { MozMap::new() }
ReceiveAnyMozMap(&self) -> MozMap<JSVal>683     fn ReceiveAnyMozMap(&self) -> MozMap<JSVal> { MozMap::new() }
684 
685     #[allow(unrooted_must_root)]
686     #[allow(unsafe_code)]
ReturnResolvedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>>687     unsafe fn ReturnResolvedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>> {
688         Promise::new_resolved(&self.global(), cx, v)
689     }
690 
691     #[allow(unrooted_must_root)]
692     #[allow(unsafe_code)]
ReturnRejectedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>>693     unsafe fn ReturnRejectedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>> {
694         Promise::new_rejected(&self.global(), cx, v)
695     }
696 
697     #[allow(unsafe_code)]
PromiseResolveNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue)698     unsafe fn PromiseResolveNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue) {
699         p.resolve(cx, v);
700     }
701 
702     #[allow(unsafe_code)]
PromiseRejectNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue)703     unsafe fn PromiseRejectNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue) {
704         p.reject(cx, v);
705     }
706 
PromiseRejectWithTypeError(&self, p: &Promise, s: USVString)707     fn PromiseRejectWithTypeError(&self, p: &Promise, s: USVString) {
708         p.reject_error(Error::Type(s.0));
709     }
710 
711     #[allow(unrooted_must_root)]
ResolvePromiseDelayed(&self, p: &Promise, value: DOMString, delay: u64)712     fn ResolvePromiseDelayed(&self, p: &Promise, value: DOMString, delay: u64) {
713         let promise = p.duplicate();
714         let cb = TestBindingCallback {
715             promise: TrustedPromise::new(promise),
716             value: value,
717         };
718         let _ = self.global()
719             .schedule_callback(
720                 OneshotTimerCallback::TestBindingCallback(cb),
721                 MsDuration::new(delay));
722     }
723 
724     #[allow(unrooted_must_root)]
PromiseNativeHandler(&self, resolve: Option<Rc<SimpleCallback>>, reject: Option<Rc<SimpleCallback>>) -> Rc<Promise>725     fn PromiseNativeHandler(&self,
726                             resolve: Option<Rc<SimpleCallback>>,
727                             reject: Option<Rc<SimpleCallback>>) -> Rc<Promise> {
728         let global = self.global();
729         let handler = PromiseNativeHandler::new(&global,
730                                                 resolve.map(SimpleHandler::new),
731                                                 reject.map(SimpleHandler::new));
732         let p = Promise::new(&global);
733         p.append_native_handler(&handler);
734         return p;
735 
736         #[derive(JSTraceable, MallocSizeOf)]
737         struct SimpleHandler {
738             #[ignore_malloc_size_of = "Rc has unclear ownership semantics"]
739             handler: Rc<SimpleCallback>,
740         }
741         impl SimpleHandler {
742             fn new(callback: Rc<SimpleCallback>) -> Box<Callback> {
743                 Box::new(SimpleHandler { handler: callback })
744             }
745         }
746         impl Callback for SimpleHandler {
747             #[allow(unsafe_code)]
748             fn callback(&self, cx: *mut JSContext, v: HandleValue) {
749                 let global = unsafe { GlobalScope::from_context(cx) };
750                 let _ = self.handler.Call_(&*global, v, ExceptionHandling::Report);
751             }
752         }
753     }
754 
755     #[allow(unrooted_must_root)]
PromiseAttribute(&self) -> Rc<Promise>756     fn PromiseAttribute(&self) -> Rc<Promise> {
757         Promise::new(&self.global())
758     }
759 
AcceptPromise(&self, _promise: &Promise)760     fn AcceptPromise(&self, _promise: &Promise) {
761     }
762 
PassSequenceSequence(&self, _seq: Vec<Vec<i32>>)763     fn PassSequenceSequence(&self, _seq: Vec<Vec<i32>>) {}
ReturnSequenceSequence(&self) -> Vec<Vec<i32>>764     fn ReturnSequenceSequence(&self) -> Vec<Vec<i32>> { vec![] }
PassUnionSequenceSequence(&self, seq: LongOrLongSequenceSequence)765     fn PassUnionSequenceSequence(&self, seq: LongOrLongSequenceSequence) {
766         match seq {
767             LongOrLongSequenceSequence::Long(_) => (),
768             LongOrLongSequenceSequence::LongSequenceSequence(seq) => {
769                 let _seq: Vec<Vec<i32>> = seq;
770             }
771         }
772     }
773 
774     #[allow(unsafe_code)]
CrashHard(&self)775     fn CrashHard(&self) {
776         static READ_ONLY_VALUE: i32 = 0;
777         unsafe {
778             let p: *mut u32 = &READ_ONLY_VALUE as *const _ as *mut _;
779             ptr::write_volatile(p, 0xbaadc0de);
780         }
781     }
782 
AdvanceClock(&self, ms: i32, tick: bool)783     fn AdvanceClock(&self, ms: i32, tick: bool) {
784         self.global().as_window().advance_animation_clock(ms, tick);
785     }
786 
Panic(&self)787     fn Panic(&self) { panic!("explicit panic from script") }
788 
EntryGlobal(&self) -> DomRoot<GlobalScope>789     fn EntryGlobal(&self) -> DomRoot<GlobalScope> {
790         GlobalScope::entry()
791     }
IncumbentGlobal(&self) -> DomRoot<GlobalScope>792     fn IncumbentGlobal(&self) -> DomRoot<GlobalScope> {
793         GlobalScope::incumbent().unwrap()
794     }
795 }
796 
797 impl TestBinding {
BooleanAttributeStatic(_: &GlobalScope) -> bool798     pub fn BooleanAttributeStatic(_: &GlobalScope) -> bool { false }
SetBooleanAttributeStatic(_: &GlobalScope, _: bool)799     pub fn SetBooleanAttributeStatic(_: &GlobalScope, _: bool) {}
ReceiveVoidStatic(_: &GlobalScope)800     pub fn ReceiveVoidStatic(_: &GlobalScope) {}
PrefControlledStaticAttributeDisabled(_: &GlobalScope) -> bool801     pub fn PrefControlledStaticAttributeDisabled(_: &GlobalScope) -> bool { false }
PrefControlledStaticAttributeEnabled(_: &GlobalScope) -> bool802     pub fn PrefControlledStaticAttributeEnabled(_: &GlobalScope) -> bool { false }
PrefControlledStaticMethodDisabled(_: &GlobalScope)803     pub fn PrefControlledStaticMethodDisabled(_: &GlobalScope) {}
PrefControlledStaticMethodEnabled(_: &GlobalScope)804     pub fn PrefControlledStaticMethodEnabled(_: &GlobalScope) {}
FuncControlledStaticAttributeDisabled(_: &GlobalScope) -> bool805     pub fn FuncControlledStaticAttributeDisabled(_: &GlobalScope) -> bool { false }
FuncControlledStaticAttributeEnabled(_: &GlobalScope) -> bool806     pub fn FuncControlledStaticAttributeEnabled(_: &GlobalScope) -> bool { false }
FuncControlledStaticMethodDisabled(_: &GlobalScope)807     pub fn FuncControlledStaticMethodDisabled(_: &GlobalScope) {}
FuncControlledStaticMethodEnabled(_: &GlobalScope)808     pub fn FuncControlledStaticMethodEnabled(_: &GlobalScope) {}
809 }
810 
811 #[allow(unsafe_code)]
812 impl TestBinding {
condition_satisfied(_: *mut JSContext, _: HandleObject) -> bool813     pub unsafe fn condition_satisfied(_: *mut JSContext, _: HandleObject) -> bool { true }
condition_unsatisfied(_: *mut JSContext, _: HandleObject) -> bool814     pub unsafe fn condition_unsatisfied(_: *mut JSContext, _: HandleObject) -> bool { false }
815 }
816 
817 #[derive(JSTraceable, MallocSizeOf)]
818 pub struct TestBindingCallback {
819     #[ignore_malloc_size_of = "unclear ownership semantics"]
820     promise: TrustedPromise,
821     value: DOMString,
822 }
823 
824 impl TestBindingCallback {
825     #[allow(unrooted_must_root)]
invoke(self)826     pub fn invoke(self) {
827         self.promise.root().resolve_native(&self.value);
828     }
829 }
830