diff options
author | Abelardo E. Mendoza <abelardo22.9@gmail.com> | 2016-05-26 11:38:53 -0600 |
---|---|---|
committer | Abelardo E. Mendoza <abelardo22.9@gmail.com> | 2016-05-26 11:38:53 -0600 |
commit | d72dbb619893df2ec8059558e47e32f0847cc3c8 (patch) | |
tree | 3f91e7bad289b137f3662064fa1132fbcadc1d08 | |
parent | 116faa7617aa2cb648d57307505b23504900bc9f (diff) | |
download | servo-d72dbb619893df2ec8059558e47e32f0847cc3c8.tar.gz servo-d72dbb619893df2ec8059558e47e32f0847cc3c8.zip |
implement window alert with no params
4 files changed, 24 insertions, 1 deletions
diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl index 8f3cbedcc8e..608f066ff11 100644 --- a/components/script/dom/webidls/Window.webidl +++ b/components/script/dom/webidls/Window.webidl @@ -48,8 +48,8 @@ //readonly attribute ApplicationCache applicationCache; // user prompts - //void alert(); void alert(DOMString message); + void alert(); //boolean confirm(optional DOMString message = ""); //DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); //void print(); diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 63a0ca2a36e..540266b6491 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -431,6 +431,11 @@ pub fn base64_atob(input: DOMString) -> Fallible<DOMString> { impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-alert + fn Alert_(&self) { + self.Alert(DOMString::new()); + } + + // https://html.spec.whatwg.org/multipage/#dom-alert fn Alert(&self, s: DOMString) { // Right now, just print to the console // Ensure that stderr doesn't trample through the alert() we use to diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html index 20c7faad07a..ca63dad80cc 100644 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html +++ b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html @@ -28,4 +28,16 @@ })); document.body.appendChild(iframe); }, "mozbrowsershowmodalprompt event from nested iframes triggering an alert"); + + async_test(function(t) { + var iframe = document.createElement("iframe"); + iframe.mozbrowser = "true"; + iframe.src = "mozbrowsershowmodalprompt_event_no_params_alert.html"; + iframe.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { + assert_equals(e.detail.promptType, "alert"); + assert_equals(e.detail.message, ""); + t.done(); + })); + document.body.appendChild(iframe); + }, "Dispatch mozbrowsershowmodalprompt event for alert with no parameters"); </script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html new file mode 100644 index 00000000000..f0a8adbd15e --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html @@ -0,0 +1,6 @@ +<html> + <body></body> + <script> + window.alert(); + </script> +</html> |