Skip to content

Commit

Permalink
Support any number of arguments to console methods (fixes #5495).
Browse files Browse the repository at this point in the history
  • Loading branch information
bgdncz authored and Ms2ger committed Apr 4, 2015
1 parent 4ffeb81 commit c8c7962
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
34 changes: 22 additions & 12 deletions components/script/dom/console.rs
Expand Up @@ -31,26 +31,36 @@ impl Console {
}

impl<'a> ConsoleMethods for JSRef<'a, Console> {
fn Log(self, message: DOMString) {
println!("{}", message);
//TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later
propagate_console_msg(&self, ConsoleMessage::LogMessage(message, String::from_str("test"), 1, 1));
fn Log(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
//TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later
propagate_console_msg(&self, ConsoleMessage::LogMessage(message, String::from_str("test"), 1, 1));
}
}

fn Debug(self, message: DOMString) {
println!("{}", message);
fn Debug(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}

fn Info(self, message: DOMString) {
println!("{}", message);
fn Info(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}

fn Warn(self, message: DOMString) {
println!("{}", message);
fn Warn(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}

fn Error(self, message: DOMString) {
println!("{}", message);
fn Error(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}

fn Assert(self, condition: bool, message: Option<DOMString>) {
Expand Down
10 changes: 5 additions & 5 deletions components/script/dom/webidls/Console.webidl
Expand Up @@ -12,10 +12,10 @@

interface Console {
// These should be DOMString message, DOMString message2, ...
void log(DOMString message);
void debug(DOMString message);
void info(DOMString message);
void warn(DOMString message);
void error(DOMString message);
void log(DOMString... messages);
void debug(DOMString... messages);
void info(DOMString... messages);
void warn(DOMString... messages);
void error(DOMString... messages);
void assert(boolean condition, optional DOMString message);
};

6 comments on commit c8c7962

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented on c8c7962 Apr 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=Manishearth

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from Manishearth
at c8c7962

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging servo/servo/console-variadic = c8c7962 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

servo/servo/console-variadic = c8c7962 merged ok, testing candidate = 8758d7d

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 8758d7d

Please sign in to comment.