Move webidl tests to the webidl crate's test suite (#451)

* webidl: Remove exact-output tests

These have not been as effective, nor as easy to write and maintain, as the
project()-based integration tests.

* tests: Move webidl tests into the webidl crate's test suite
This commit is contained in:
Nick Fitzgerald 2018-07-10 14:17:33 -07:00 committed by Alex Crichton
parent 42938792c7
commit 92dd8e859f
12 changed files with 6 additions and 855 deletions

View File

@ -83,7 +83,8 @@ matrix:
# WebIDL tests pass on nightly # WebIDL tests pass on nightly
- rust: nightly - rust: nightly
env: JOB=test-webidl env: JOB=test-webidl
before_install: rustup component add rustfmt-preview --toolchain nightly before_install: *INSTALL_NODE_VIA_NVM
install: npm install
script: cargo test --manifest-path crates/webidl/Cargo.toml script: cargo test --manifest-path crates/webidl/Cargo.toml
# Dist linux binary # Dist linux binary

View File

@ -4,10 +4,7 @@ version = "0.2.11"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"] authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
[dev-dependencies] [dev-dependencies]
diff = "0.1.11" wasm-bindgen-test-project-builder = { path = "../test-project-builder", version = '=0.2.11' }
env_logger = "0.5.10"
wasm-bindgen = { path = "../..", default-features = false }
wasm-bindgen-backend = { version = "=0.2.11", path = "../backend", features = ["extra-traits"] }
[dependencies] [dependencies]
failure = "0.1" failure = "0.1"

View File

@ -1,12 +1,4 @@
extern crate diff; extern crate wasm_bindgen_test_project_builder as project_builder;
extern crate env_logger; use project_builder::project;
extern crate proc_macro2;
extern crate syn;
extern crate wasm_bindgen_backend as backend;
extern crate wasm_bindgen_webidl as wb_webidl;
#[macro_use] mod simple;
mod util;
use util::*;
assert_compile!(Event);

View File

@ -1,172 +0,0 @@
use std::env;
use std::fs::File;
use std::io::{self, Write};
use std::process;
use std::sync::{Once, ONCE_INIT};
use diff;
use env_logger;
use wb_webidl;
fn rustfmt<S: Into<String>>(source: S) -> (String, String) {
let source = source.into();
static CHECK_RUSTFMT: Once = ONCE_INIT;
CHECK_RUSTFMT.call_once(|| {
let have_working_rustfmt = process::Command::new("rustup")
.args(&["run", "nightly", "rustfmt", "--version"])
.stdout(process::Stdio::null())
.stderr(process::Stdio::null())
.status()
.ok()
.map_or(false, |status| status.success());
if !have_working_rustfmt {
panic!(
"
The latest `rustfmt` is required to run the `wasm-bindgen` test suite. Install
`rustfmt` with:
$ rustup component add rustfmt-preview --toolchain nightly
"
);
}
});
let mut child = process::Command::new("rustup")
.args(&[
"run",
"nightly",
"rustfmt",
"--config-path",
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/rustfmt.toml"),
])
.stdin(process::Stdio::piped())
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
.spawn()
.expect("should spawn `rustup run nightly rustfmt`");
let mut stdin = child.stdin.take().unwrap();
let mut stdout = child.stdout.take().unwrap();
let mut stderr = child.stderr.take().unwrap();
// Write to stdin in a new thread, so that we can read from stdout on this
// thread. This keeps the child from blocking on writing to its stdout which
// might block us from writing to its stdin.
let stdin_handle = ::std::thread::spawn(move || stdin.write_all(source.as_bytes()));
// Read stderr on a new thread for similar reasons.
let stderr_handle = ::std::thread::spawn(move || {
let mut output = vec![];
io::copy(&mut stderr, &mut output).map(|_| String::from_utf8_lossy(&output).to_string())
});
let mut output = vec![];
io::copy(&mut stdout, &mut output).expect("Should copy stdout into vec OK");
// Ignore actual rustfmt status because it is often non-zero for trivial
// things.
let _ = child.wait().expect("should wait on rustfmt child OK");
stdin_handle
.join()
.expect("writer thread should not have panicked")
.expect("should have written to child rustfmt's stdin OK");
let formatted = String::from_utf8(output).expect("rustfmt should only emit valid utf-8");
let stderr = stderr_handle
.join()
.expect("stderr reader thread should not have panicked")
.expect("should have read child rustfmt's stderr OK");
(formatted, stderr)
}
fn strip_wasm_bindgen_generated(source: &str) -> String {
let lines: Vec<_> = source
.lines()
.filter(|l| !l.contains("__WASM_BINDGEN_GENERATED"))
.collect();
lines.join("\n")
}
pub fn assert_compile(webidl: &str, expected: &str, expected_file: &str) {
static INIT_ENV_LOGGER: Once = ONCE_INIT;
INIT_ENV_LOGGER.call_once(|| {
env_logger::init();
});
let actual = wb_webidl::compile(webidl).expect("should compile the webidl source OK");
let (actual_orig, actual_stderr) = rustfmt(actual);
let (expected, expected_stderr) = rustfmt(expected);
let actual = strip_wasm_bindgen_generated(&actual_orig);
let expected = strip_wasm_bindgen_generated(&expected);
if expected == actual {
return;
}
if env::var("UPDATE_EXPECTED").is_ok() {
File::create(expected_file)
.unwrap()
.write_all(actual_orig.as_bytes())
.unwrap();
return
}
eprintln!("rustfmt(expected) stderr:");
eprintln!("{}", expected_stderr);
eprintln!();
eprintln!("rustfmt(actual) stderr:");
eprintln!("{}", actual_stderr);
eprintln!();
eprintln!(
"assert_compile failed: actual compiled output and expected compiled output do not match:"
);
eprintln!("--- expected");
eprintln!("+++ actual");
for d in diff::lines(&expected, &actual) {
match d {
diff::Result::Left(l) => eprintln!("-{}", l),
diff::Result::Right(r) => eprintln!("+{}", r),
diff::Result::Both(b, _) => eprintln!(" {}", b),
}
}
panic!()
}
macro_rules! assert_compile {
($test_name:ident) => {
#[test]
#[allow(non_snake_case)]
fn $test_name() {
let webidl_source = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/",
stringify!($test_name),
".webidl"
));
let expected_output = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/expected/",
stringify!($test_name),
".rs"
));
let expected_file = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/expected/",
stringify!($test_name),
".rs"
);
$crate::assert_compile(webidl_source, expected_output, expected_file);
}
};
}

View File

@ -1,586 +0,0 @@
#[allow(bad_style)]
pub struct Event {
obj: ::wasm_bindgen::JsValue,
}
impl ::wasm_bindgen::describe::WasmDescribe for Event {
fn describe() {
::wasm_bindgen::JsValue::describe();
}
}
impl ::wasm_bindgen::convert::IntoWasmAbi for Event {
type Abi = <::wasm_bindgen::JsValue as ::wasm_bindgen::convert::IntoWasmAbi>::Abi;
fn into_abi(self, extra: &mut ::wasm_bindgen::convert::Stack) -> Self::Abi {
self.obj.into_abi(extra)
}
}
impl ::wasm_bindgen::convert::FromWasmAbi for Event {
type Abi = <::wasm_bindgen::JsValue as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi, extra: &mut ::wasm_bindgen::convert::Stack) -> Self {
Event {
obj: ::wasm_bindgen::JsValue::from_abi(js, extra),
}
}
}
impl<'a> ::wasm_bindgen::convert::IntoWasmAbi for &'a Event {
type Abi = <&'a ::wasm_bindgen::JsValue as ::wasm_bindgen::convert::IntoWasmAbi>::Abi;
fn into_abi(self, extra: &mut ::wasm_bindgen::convert::Stack) -> Self::Abi {
(&self.obj).into_abi(extra)
}
}
impl ::wasm_bindgen::convert::RefFromWasmAbi for Event {
type Abi = <::wasm_bindgen::JsValue as ::wasm_bindgen::convert::RefFromWasmAbi>::Abi;
type Anchor = ::wasm_bindgen::__rt::core::mem::ManuallyDrop<Event>;
unsafe fn ref_from_abi(
js: Self::Abi,
extra: &mut ::wasm_bindgen::convert::Stack,
) -> Self::Anchor {
let tmp =
<::wasm_bindgen::JsValue as ::wasm_bindgen::convert::RefFromWasmAbi>::ref_from_abi(
js, extra,
);
::wasm_bindgen::__rt::core::mem::ManuallyDrop::new(Event {
obj: ::wasm_bindgen::__rt::core::mem::ManuallyDrop::into_inner(tmp),
})
}
}
impl From<::wasm_bindgen::JsValue> for Event {
fn from(obj: ::wasm_bindgen::JsValue) -> Event {
Event { obj }
}
}
impl From<Event> for ::wasm_bindgen::JsValue {
fn from(obj: Event) -> ::wasm_bindgen::JsValue {
obj.obj
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_event_phase_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<u16 as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn event_phase(&self) -> u16 {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_event_phase_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <u16 as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_event_phase_Event(self_)
};
<u16 as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn event_phase(&self) -> u16 {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_stop_propagation_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(0);
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn stop_propagation(&self) {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_stop_propagation_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> ();
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_stop_propagation_Event(self_)
};
()
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn stop_propagation(&self) {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_stop_immediate_propagation_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(0);
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn stop_immediate_propagation(&self) {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_stop_immediate_propagation_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> ();
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_stop_immediate_propagation_Event(self_)
};
()
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn stop_immediate_propagation(&self) {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_bubbles_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn bubbles(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_bubbles_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_bubbles_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn bubbles(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_cancelable_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn cancelable(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_cancelable_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_cancelable_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn cancelable(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_prevent_default_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(0);
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn prevent_default(&self) {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_prevent_default_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> ();
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_prevent_default_Event(self_)
};
()
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn prevent_default(&self) {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_default_prevented_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn default_prevented(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_default_prevented_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_default_prevented_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn default_prevented(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_composed_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn composed(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_composed_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_composed_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn composed(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_is_trusted_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn is_trusted(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_is_trusted_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_is_trusted_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn is_trusted(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_init_event_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(4u32);
<&Event as WasmDescribe>::describe();
<&str as WasmDescribe>::describe();
<bool as WasmDescribe>::describe();
<bool as WasmDescribe>::describe();
inform(0);
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn init_event(&self, type_: &str, bubbles: bool, cancelable: bool) {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_init_event_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
type_: <&str as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
bubbles: <bool as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
cancelable: <bool as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> ();
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
let type_ =
<&str as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(type_, &mut __stack);
let bubbles =
<bool as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(bubbles, &mut __stack);
let cancelable = <bool as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(
cancelable,
&mut __stack,
);
__widl_f_init_event_Event(self_, type_, bubbles, cancelable)
};
()
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn init_event(&self, type_: &str, bubbles: bool, cancelable: bool) {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_cancel_bubble_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(1u32);
<&Event as WasmDescribe>::describe();
inform(1);
<bool as WasmDescribe>::describe();
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn cancel_bubble(&self) -> bool {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_cancel_bubble_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> <bool as ::wasm_bindgen::convert::FromWasmAbi>::Abi;
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
__widl_f_cancel_bubble_Event(self_)
};
<bool as ::wasm_bindgen::convert::FromWasmAbi>::from_abi(
_ret,
&mut ::wasm_bindgen::convert::GlobalStack::new(),
)
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn cancel_bubble(&self) -> bool {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[no_mangle]
#[allow(non_snake_case)]
#[doc(hidden)]
pub extern "C" fn __wbindgen_describe___widl_f_set_cancel_bubble_Event() {
use wasm_bindgen::describe::*;
inform(FUNCTION);
inform(2u32);
<&Event as WasmDescribe>::describe();
<bool as WasmDescribe>::describe();
inform(0);
}
impl Event {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub fn set_cancel_bubble(&self, cancel_bubble: bool) {
::wasm_bindgen::__rt::link_this_library();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern "C" {
fn __widl_f_set_cancel_bubble_Event(
self_: <&Event as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
cancel_bubble: <bool as ::wasm_bindgen::convert::IntoWasmAbi>::Abi,
) -> ();
}
unsafe {
let _ret = {
let mut __stack = ::wasm_bindgen::convert::GlobalStack::new();
let self_ =
<&Event as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(self, &mut __stack);
let cancel_bubble = <bool as ::wasm_bindgen::convert::IntoWasmAbi>::into_abi(
cancel_bubble,
&mut __stack,
);
__widl_f_set_cancel_bubble_Event(self_, cancel_bubble)
};
()
}
}
#[allow(bad_style, unused_variables)]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
pub fn set_cancel_bubble(&self, cancel_bubble: bool) {
panic!(
"cannot call wasm-bindgen imported functions on \
non-wasm targets"
);
}
}
#[allow(non_upper_case_globals)]
#[wasm_custom_section = "__wasm_bindgen_unstable"]
const __WASM_BINDGEN_GENERATED_wasm_bindgen_webidl_0_2_11_0 : [ u8 ; 3534usize ] = * b"\xCA\r\0\0{\"exports\":[],\"enums\":[],\"imports\":[{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"type\"}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_event_phase_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"eventPhase\"}}}},\"structural\":false,\"function\":{\"name\":\"eventPhase\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_stop_propagation_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":\"Regular\"}}},\"structural\":false,\"function\":{\"name\":\"stopPropagation\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_stop_immediate_propagation_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":\"Regular\"}}},\"structural\":false,\"function\":{\"name\":\"stopImmediatePropagation\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_bubbles_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"bubbles\"}}}},\"structural\":false,\"function\":{\"name\":\"bubbles\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_cancelable_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"cancelable\"}}}},\"structural\":false,\"function\":{\"name\":\"cancelable\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_prevent_default_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":\"Regular\"}}},\"structural\":false,\"function\":{\"name\":\"preventDefault\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_default_prevented_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"defaultPrevented\"}}}},\"structural\":false,\"function\":{\"name\":\"defaultPrevented\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_composed_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"composed\"}}}},\"structural\":false,\"function\":{\"name\":\"composed\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_is_trusted_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"isTrusted\"}}}},\"structural\":false,\"function\":{\"name\":\"isTrusted\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_init_event_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":\"Regular\"}}},\"structural\":false,\"function\":{\"name\":\"initEvent\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_cancel_bubble_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Getter\":\"cancelBubble\"}}}},\"structural\":false,\"function\":{\"name\":\"cancelBubble\"}}},{\"module\":null,\"version\":null,\"js_namespace\":null,\"kind\":{\"kind\":\"function\",\"shim\":\"__widl_f_set_cancel_bubble_Event\",\"catch\":false,\"method\":{\"class\":\"Event\",\"kind\":{\"Operation\":{\"is_static\":false,\"kind\":{\"Setter\":\"cancelBubble\"}}}},\"structural\":false,\"function\":{\"name\":\"set_cancelBubble\"}}}],\"structs\":[],\"version\":\"0.2.11 (fab125d6e)\",\"schema_version\":\"6\"}" ;

View File

@ -1,6 +0,0 @@
#![feature(wasm_custom_section)]
#![allow(bad_style)]
extern crate wasm_bindgen;
pub mod Event;

View File

@ -1,71 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/2012/WD-dom-20120105/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// TODO: don't include this here, use Performance.webidl instead
typedef double DOMHighResTimeStamp;
// TODO: remove this when dicts are resolved
typedef boolean EventInit;
[Constructor(DOMString type, optional EventInit eventInitDict),
Exposed=(Window,Worker,System), ProbablyShortLivingWrapper]
interface Event {
[Pure]
readonly attribute DOMString type;
[Pure]
readonly attribute EventTarget? target;
[Pure]
readonly attribute EventTarget? currentTarget;
sequence<EventTarget> composedPath();
const unsigned short NONE = 0;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
[Pure]
readonly attribute unsigned short eventPhase;
void stopPropagation();
void stopImmediatePropagation();
[Pure]
readonly attribute boolean bubbles;
[Pure]
readonly attribute boolean cancelable;
[NeedsCallerType]
void preventDefault();
[Pure, NeedsCallerType]
readonly attribute boolean defaultPrevented;
[ChromeOnly, Pure]
readonly attribute boolean defaultPreventedByChrome;
[ChromeOnly, Pure]
readonly attribute boolean defaultPreventedByContent;
[Pure]
readonly attribute boolean composed;
[Unforgeable, Pure]
readonly attribute boolean isTrusted;
[Pure]
readonly attribute DOMHighResTimeStamp timeStamp;
void initEvent(DOMString type,
optional boolean bubbles = false,
optional boolean cancelable = false);
attribute boolean cancelBubble;
};
dictionary EventInit {
boolean bubbles = false;
boolean cancelable = false;
boolean composed = false;
};

View File

@ -24,4 +24,3 @@ mod structural;
mod typescript; mod typescript;
mod u64; mod u64;
mod validate_prt; mod validate_prt;
mod webidl;

View File

@ -1,3 +0,0 @@
use super::project;
mod simple;