Auto merge of #27443 - mustafapc19:master, r=jdm

console.clear implemented

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #27294  (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because it deals with Firefox's devtools.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-07-29 16:19:33 -04:00 committed by GitHub
commit a9a406e9e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

View file

@ -272,6 +272,7 @@ impl ConsoleActor {
LogLevel::Info => "info",
LogLevel::Warn => "warn",
LogLevel::Error => "error",
LogLevel::Clear => "clear",
_ => "log",
}
.to_owned();

View file

@ -246,6 +246,7 @@ pub enum LogLevel {
Info,
Warn,
Error,
Clear,
}
#[derive(Clone, Debug, Deserialize, Serialize)]

View file

@ -72,6 +72,12 @@ impl Console {
console_messages(global, &messages, LogLevel::Log)
}
// https://developer.mozilla.org/en-US/docs/Web/API/Console/clear
pub fn Clear(global: &GlobalScope) {
let message: Vec<DOMString> = Vec::new();
console_messages(global, &message, LogLevel::Clear)
}
// https://developer.mozilla.org/en-US/docs/Web/API/Console
pub fn Debug(global: &GlobalScope, messages: Vec<DOMString>) {
console_messages(global, &messages, LogLevel::Debug)

View file

@ -15,6 +15,7 @@ namespace console {
void warn(DOMString... messages);
void error(DOMString... messages);
void assert(boolean condition, optional DOMString message);
void clear();
// Grouping
void group(DOMString... data);