diff options
author | Josh Matthews <josh@joshmatthews.net> | 2016-06-20 13:22:53 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2016-06-22 09:35:19 -0400 |
commit | fbf6c7fc2bcabc69c16e0006c0c37e27e505d64d (patch) | |
tree | 6c3a00b7a4b1a4650da4843a30809a25760df08b | |
parent | a0a62ed3fdc023015fd59cf9358e0a0cc3b2bc9b (diff) | |
download | servo-fbf6c7fc2bcabc69c16e0006c0c37e27e505d64d.tar.gz servo-fbf6c7fc2bcabc69c16e0006c0c37e27e505d64d.zip |
Add a manual test for panicking while JS stack frames exist.
-rw-r--r-- | components/script/dom/testbinding.rs | 2 | ||||
-rw-r--r-- | components/script/dom/webidls/TestBinding.webidl | 2 | ||||
-rw-r--r-- | tests/html/panic.html | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index bbbbc8aa5d6..8cd53ee57fb 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -580,6 +580,8 @@ impl TestBindingMethods for TestBinding { ptr::write_volatile(p, 0xbaadc0de); } } + + fn Panic(&self) { panic!("explicit panic from script") } } impl TestBinding { diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index eb6e5a9ae7b..29b5d9e1d71 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -455,6 +455,8 @@ interface TestBinding { static void funcControlledStaticMethodEnabled(); [Func="TestBinding::condition_satisfied"] const unsigned short funcControlledConstEnabled = 0; + + void panic(); }; partial interface TestBinding { diff --git a/tests/html/panic.html b/tests/html/panic.html new file mode 100644 index 00000000000..d9464846d75 --- /dev/null +++ b/tests/html/panic.html @@ -0,0 +1,16 @@ +<!-- To exercise these tests, set the `dom.testbinding.enabled` to true. + It is expected that the browser will not abort due to failed JS engine assertions. --> + +<!-- Straightforward test - invoking a panic from a toplevel script execution --> +<script> +(new TestBinding()).panic(); +</script> + +<!-- invoking a panic from an event handler which is invoked by native code --> +<!--<iframe src="data:,hi there" onload="(new TestBinding()).panic()"></iframe>--> + +<!-- invoking a panic from an event handler which is invoked by script --> +<!--<div onclick="(new TestBinding()).panic()"></div> +<script> +document.querySelector('div').click(); +</script>--> |