Auto merge of #11432 - ab22:11402-implement-window-alert, r=KiChjang

11402 implement window alert

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11402

Either:
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11432)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-26 15:42:26 -05:00
commit 6d0c420d59
4 changed files with 24 additions and 1 deletions

View file

@ -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();

View file

@ -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