aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/testbinding.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-25 22:43:13 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2015-11-11 14:52:21 +0100
commitacb13dc899e48a753cdeb7e7b8e1e5491c2a51f0 (patch)
treed4cd7a05def7978adc35723815e75d15003937b9 /components/script/dom/testbinding.rs
parente66a361e08bd777d21f26d62e18936d3995e0190 (diff)
downloadservo-acb13dc899e48a753cdeb7e7b8e1e5491c2a51f0.tar.gz
servo-acb13dc899e48a753cdeb7e7b8e1e5491c2a51f0.zip
Support variadic interface arguments (fixes #8159)
We use a RootedVec value in codegen, of which we use the `r()` method to pass `&[&T]` to the interface methods.
Diffstat (limited to 'components/script/dom/testbinding.rs')
-rw-r--r--components/script/dom/testbinding.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index e88bb70a191..df098b98aa5 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -6,13 +6,14 @@
use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
use dom::bindings::codegen::Bindings::FunctionBinding::Function;
-use dom::bindings::codegen::Bindings::TestBindingBinding::{TestBindingMethods, TestEnum};
+use dom::bindings::codegen::Bindings::TestBindingBinding::{self, TestBindingMethods, TestEnum};
use dom::bindings::codegen::UnionTypes::{BlobOrString, EventOrString};
use dom::bindings::codegen::UnionTypes::{EventOrUSVString, HTMLElementOrLong};
+use dom::bindings::error::Fallible;
use dom::bindings::global::{GlobalRef, global_root_from_reflector};
use dom::bindings::js::Root;
use dom::bindings::num::Finite;
-use dom::bindings::reflector::Reflector;
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString};
use dom::blob::Blob;
use js::jsapi::{HandleValue, JSContext, JSObject};
@@ -27,6 +28,23 @@ pub struct TestBinding {
reflector_: Reflector,
}
+impl TestBinding {
+ fn new_inherited() -> TestBinding {
+ TestBinding {
+ reflector_: Reflector::new(),
+ }
+ }
+
+ pub fn new(global: GlobalRef) -> Root<TestBinding> {
+ reflect_dom_object(box TestBinding::new_inherited(),
+ global, TestBindingBinding::Wrap)
+ }
+
+ pub fn Constructor(global: GlobalRef) -> Fallible<Root<TestBinding>> {
+ Ok(TestBinding::new(global))
+ }
+}
+
impl TestBindingMethods for TestBinding {
fn BooleanAttribute(&self) -> bool { false }
fn SetBooleanAttribute(&self, _: bool) {}
@@ -360,7 +378,7 @@ impl TestBindingMethods for TestBinding {
fn PassVariadicUsvstring(&self, _: Vec<USVString>) {}
fn PassVariadicByteString(&self, _: Vec<ByteString>) {}
fn PassVariadicEnum(&self, _: Vec<TestEnum>) {}
- // fn PassVariadicInterface(self, _: Vec<&Blob>) {}
+ fn PassVariadicInterface(&self, _: &[&Blob]) {}
fn PassVariadicUnion(&self, _: Vec<HTMLElementOrLong>) {}
fn PassVariadicUnion2(&self, _: Vec<EventOrString>) {}
fn PassVariadicUnion3(&self, _: Vec<BlobOrString>) {}