Skip to content
Permalink
Browse files

Support any number of arguments to console methods (fixes #5495).

  • Loading branch information...
boghison authored and Ms2ger committed Apr 3, 2015
1 parent 4ffeb81 commit c8c79624bd31e2cd767c8014c1b5a151beaa5566
Showing with 27 additions and 17 deletions.
  1. +22 −12 components/script/dom/console.rs
  2. +5 −5 components/script/dom/webidls/Console.webidl
@@ -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>) {
@@ -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

This comment has been minimized.

Copy link
Contributor

Ms2ger replied Apr 4, 2015

r=Manishearth

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Apr 4, 2015

saw approval from Manishearth
at c8c7962

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Apr 4, 2015

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

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Apr 4, 2015

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

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Apr 4, 2015

fast-forwarding master to auto = 8758d7d

Please sign in to comment.
You can’t perform that action at this time.