mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Lock and flush stdout in Window#alert.
We use alert() to communicate test results to wptrunner. Unfortunately, sometimes the alert output is interleaved with other output on stdout, causing wptrunner to classify the test result as a timeout. I hope this will avoid that scenario.
This commit is contained in:
parent
1809748dc1
commit
2a7f262b7d
1 changed files with 5 additions and 1 deletions
|
@ -72,6 +72,7 @@ use std::cell::{Cell, Ref, RefMut, RefCell};
|
|||
use std::collections::HashSet;
|
||||
use std::default::Default;
|
||||
use std::ffi::CString;
|
||||
use std::io::{stdout, Write};
|
||||
use std::mem as std_mem;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
@ -342,7 +343,10 @@ impl<'a> WindowMethods for &'a Window {
|
|||
// https://html.spec.whatwg.org/#dom-alert
|
||||
fn Alert(self, s: DOMString) {
|
||||
// Right now, just print to the console
|
||||
println!("ALERT: {}", s);
|
||||
let stdout = stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
writeln!(&mut stdout, "ALERT: {}", s).unwrap();
|
||||
stdout.flush().unwrap();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue