mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
implement window alert with no params
This commit is contained in:
parent
116faa7617
commit
d72dbb6198
4 changed files with 24 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -430,6 +430,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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<html>
|
||||
<body></body>
|
||||
<script>
|
||||
window.alert();
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue