diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index 77000e25a34..9589769ab88 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -2,27 +2,39 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use std::convert::TryFrom; use std::io; use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg}; -use js::rust::describe_scripted_caller; +use js::jsapi::{self, ESClass, PropertyDescriptor}; +use js::jsval::UndefinedValue; +use js::rust::wrappers::{ + GetBuiltinClass, GetPropertyKeys, JS_GetOwnPropertyDescriptorById, JS_GetPropertyById, + JS_IdToValue, JS_ValueToSource, +}; +use js::rust::{describe_scripted_caller, HandleValue, IdVector}; +use crate::dom::bindings::conversions::jsstring_to_str; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::workerglobalscope::WorkerGlobalScope; +use crate::script_runtime::JSContext; + +/// The maximum object depth logged by console methods. +const MAX_LOG_DEPTH: usize = 10; // https://developer.mozilla.org/en-US/docs/Web/API/Console pub struct Console(()); impl Console { #[allow(unsafe_code)] - fn send_to_devtools(global: &GlobalScope, level: LogLevel, message: DOMString) { + fn send_to_devtools(global: &GlobalScope, level: LogLevel, message: String) { if let Some(chan) = global.devtools_chan() { let caller = unsafe { describe_scripted_caller(*GlobalScope::get_cx()) }.unwrap_or_default(); let console_message = ConsoleMessage { - message: String::from(message), + message, logLevel: level, filename: caller.filename, lineNumber: caller.line as usize, @@ -55,14 +67,140 @@ where f() } -fn console_messages(global: &GlobalScope, messages: &[DOMString], level: LogLevel) { - console_message(global, DOMString::from(messages.join(" ")), level) +#[allow(unsafe_code)] +unsafe fn handle_value_to_string(cx: *mut jsapi::JSContext, value: HandleValue) -> DOMString { + rooted!(in(cx) let mut js_string = std::ptr::null_mut::()); + js_string.set(JS_ValueToSource(cx, value)); + return jsstring_to_str(cx, *js_string); +} + +#[allow(unsafe_code)] +fn stringify_handle_value(message: HandleValue) -> DOMString { + let cx = *GlobalScope::get_cx(); + unsafe { + if message.is_string() { + return jsstring_to_str(cx, message.to_string()); + } + unsafe fn stringify_object_from_handle_value( + cx: *mut jsapi::JSContext, + value: HandleValue, + parents: Vec, + ) -> DOMString { + rooted!(in(cx) let mut obj = value.to_object()); + let mut object_class = ESClass::Other; + if !GetBuiltinClass(cx, obj.handle().into(), &mut object_class as *mut _) { + return DOMString::from("/* invalid */"); + } + if object_class != ESClass::Array && object_class != ESClass::Object { + return handle_value_to_string(cx, value); + } + + let mut ids = IdVector::new(cx); + if !GetPropertyKeys( + cx, + obj.handle().into(), + jsapi::JSITER_OWNONLY | jsapi::JSITER_SYMBOLS, + ids.handle_mut(), + ) { + return DOMString::from("/* invalid */"); + } + let mut explicit_keys = object_class == ESClass::Object; + let mut props = Vec::with_capacity(ids.len()); + for id in &*ids { + rooted!(in(cx) let id = *id); + rooted!(in(cx) let mut desc = PropertyDescriptor::default()); + + let mut is_none = false; + if !JS_GetOwnPropertyDescriptorById( + cx, + obj.handle().into(), + id.handle().into(), + desc.handle_mut().into(), + &mut is_none, + ) { + return DOMString::from("/* invalid */"); + } + + rooted!(in(cx) let mut property = UndefinedValue()); + if !JS_GetPropertyById(cx, obj.handle(), id.handle(), property.handle_mut()) { + return DOMString::from("/* invalid */"); + } + + if !explicit_keys { + if id.is_int() { + if let Ok(id_int) = usize::try_from(id.to_int()) { + explicit_keys = props.len() != id_int; + } else { + explicit_keys = false; + } + } else { + explicit_keys = false; + } + } + let value_string = stringify_inner(cx, property.handle(), parents.clone()); + if explicit_keys { + let key = if id.is_string() || id.is_symbol() || id.is_int() { + rooted!(in(cx) let mut key_value = UndefinedValue()); + let raw_id: jsapi::HandleId = id.handle().into(); + if !JS_IdToValue(cx, *raw_id.ptr, key_value.handle_mut()) { + return DOMString::from("/* invalid */"); + } + handle_value_to_string(cx, key_value.handle()) + } else { + return DOMString::from("/* invalid */"); + }; + props.push(format!("{}: {}", key, value_string,)); + } else { + props.push(value_string.to_string()); + } + } + if object_class == ESClass::Array { + DOMString::from(format!("[{}]", itertools::join(props, ", "))) + } else { + DOMString::from(format!("{{{}}}", itertools::join(props, ", "))) + } + } + unsafe fn stringify_inner( + cx: *mut jsapi::JSContext, + value: HandleValue, + mut parents: Vec, + ) -> DOMString { + if parents.len() >= MAX_LOG_DEPTH { + return DOMString::from("..."); + } + let value_bits = value.asBits_; + if parents.contains(&value_bits) { + return DOMString::from("[circular]"); + } + if value.is_undefined() { + // This produces a better value than "(void 0)" from JS_ValueToSource. + return DOMString::from("undefined"); + } else if !value.is_object() { + return handle_value_to_string(cx, value); + } + parents.push(value_bits); + stringify_object_from_handle_value(cx, value, parents) + } + stringify_inner(cx, message.into(), Vec::new()) + } +} + +fn stringify_handle_values(messages: Vec) -> DOMString { + DOMString::from(itertools::join( + messages.into_iter().map(stringify_handle_value), + " ", + )) +} + +fn console_messages(global: &GlobalScope, messages: Vec, level: LogLevel) { + let message = stringify_handle_values(messages); + console_message(global, message, level) } fn console_message(global: &GlobalScope, message: DOMString, level: LogLevel) { with_stderr_lock(move || { let prefix = global.current_group_label().unwrap_or_default(); - let message = DOMString::from(format!("{}{}", prefix, message)); + let message = format!("{}{}", prefix, message); println!("{}", message); Console::send_to_devtools(global, level, message); }) @@ -71,40 +209,48 @@ fn console_message(global: &GlobalScope, message: DOMString, level: LogLevel) { #[allow(non_snake_case)] impl Console { // https://developer.mozilla.org/en-US/docs/Web/API/Console/log - pub fn Log(global: &GlobalScope, messages: Vec) { - console_messages(global, &messages, LogLevel::Log) + pub fn Log(_cx: JSContext, global: &GlobalScope, messages: Vec) { + 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 = Vec::new(); - console_messages(global, &message, LogLevel::Clear) + let message: Vec = 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) { - console_messages(global, &messages, LogLevel::Debug) + pub fn Debug(_cx: JSContext, global: &GlobalScope, messages: Vec) { + console_messages(global, messages, LogLevel::Debug) } // https://developer.mozilla.org/en-US/docs/Web/API/Console/info - pub fn Info(global: &GlobalScope, messages: Vec) { - console_messages(global, &messages, LogLevel::Info) + pub fn Info(_cx: JSContext, global: &GlobalScope, messages: Vec) { + console_messages(global, messages, LogLevel::Info) } // https://developer.mozilla.org/en-US/docs/Web/API/Console/warn - pub fn Warn(global: &GlobalScope, messages: Vec) { - console_messages(global, &messages, LogLevel::Warn) + pub fn Warn(_cx: JSContext, global: &GlobalScope, messages: Vec) { + console_messages(global, messages, LogLevel::Warn) + } + // Directly logs a DOMString, without processing the message + pub fn internal_warn(global: &GlobalScope, message: DOMString) { + console_message(global, message, LogLevel::Warn) } // https://developer.mozilla.org/en-US/docs/Web/API/Console/error - pub fn Error(global: &GlobalScope, messages: Vec) { - console_messages(global, &messages, LogLevel::Error) + pub fn Error(_cx: JSContext, global: &GlobalScope, messages: Vec) { + console_messages(global, messages, LogLevel::Error) } // https://developer.mozilla.org/en-US/docs/Web/API/Console/assert - pub fn Assert(global: &GlobalScope, condition: bool, message: Option) { + pub fn Assert(_cx: JSContext, global: &GlobalScope, condition: bool, message: HandleValue) { if !condition { - let message = message.unwrap_or_else(|| DOMString::from("no message")); + let message = if message.is_undefined() { + DOMString::from("no message") + } else { + stringify_handle_value(message) + }; let message = DOMString::from(format!("Assertion failed: {}", message)); console_message(global, message, LogLevel::Error) }; @@ -127,13 +273,13 @@ impl Console { } // https://console.spec.whatwg.org/#group - pub fn Group(global: &GlobalScope, messages: Vec) { - global.push_console_group(DOMString::from(messages.join(" "))); + pub fn Group(_cx: JSContext, global: &GlobalScope, messages: Vec) { + global.push_console_group(stringify_handle_values(messages)); } // https://console.spec.whatwg.org/#groupcollapsed - pub fn GroupCollapsed(global: &GlobalScope, messages: Vec) { - global.push_console_group(DOMString::from(messages.join(" "))); + pub fn GroupCollapsed(_cx: JSContext, global: &GlobalScope, messages: Vec) { + global.push_console_group(stringify_handle_values(messages)); } // https://console.spec.whatwg.org/#groupend diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index cda2248f3e8..c87fedcd843 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -191,11 +191,9 @@ impl PerformanceObserverMethods for PerformanceObserver { // Step 6.3 if entry_types.is_empty() { - Console::Warn( + Console::internal_warn( &*self.global(), - vec![DOMString::from( - "No valid entry type provided to observe().", - )], + DOMString::from("No valid entry type provided to observe()."), ); return Ok(()); } @@ -210,11 +208,9 @@ impl PerformanceObserverMethods for PerformanceObserver { } else if let Some(entry_type) = &options.type_ { // Step 7.2 if !VALID_ENTRY_TYPES.contains(&entry_type.as_ref()) { - Console::Warn( + Console::internal_warn( &*self.global(), - vec![DOMString::from( - "No valid entry type provided to observe().", - )], + DOMString::from("No valid entry type provided to observe()."), ); return Ok(()); } diff --git a/components/script/dom/webidls/Console.webidl b/components/script/dom/webidls/Console.webidl index 19cff567d6a..ac6ffa27806 100644 --- a/components/script/dom/webidls/Console.webidl +++ b/components/script/dom/webidls/Console.webidl @@ -9,17 +9,17 @@ ProtoObjectHack] namespace console { // Logging - undefined log(DOMString... messages); - undefined debug(DOMString... messages); - undefined info(DOMString... messages); - undefined warn(DOMString... messages); - undefined error(DOMString... messages); - undefined assert(boolean condition, optional DOMString message); + undefined log(any... messages); + undefined debug(any... messages); + undefined info(any... messages); + undefined warn(any... messages); + undefined error(any... messages); + undefined assert(boolean condition, optional any message); undefined clear(); // Grouping - undefined group(DOMString... data); - undefined groupCollapsed(DOMString... data); + undefined group(any... data); + undefined groupCollapsed(any... data); undefined groupEnd(); // Timing diff --git a/tests/wpt/include.ini b/tests/wpt/include.ini index 5c5da017450..9f43b14ae28 100644 --- a/tests/wpt/include.ini +++ b/tests/wpt/include.ini @@ -3,6 +3,8 @@ skip: true skip: false [_webgl] skip: false +[console] + skip: false [cookies] skip: false [samesite] diff --git a/tests/wpt/meta-legacy-layout/console/console-is-a-namespace.any.js.ini b/tests/wpt/meta-legacy-layout/console/console-is-a-namespace.any.js.ini new file mode 100644 index 00000000000..f43cdc81ee6 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/console-is-a-namespace.any.js.ini @@ -0,0 +1,11 @@ +[console-is-a-namespace.any.shadowrealm.html] + expected: ERROR + +[console-is-a-namespace.any.html] + [The prototype chain must be correct] + expected: FAIL + + +[console-is-a-namespace.any.worker.html] + [The prototype chain must be correct] + expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/console/console-label-conversion.any.js.ini b/tests/wpt/meta-legacy-layout/console/console-label-conversion.any.js.ini new file mode 100644 index 00000000000..a27c3c58e21 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/console-label-conversion.any.js.ini @@ -0,0 +1,38 @@ +[console-label-conversion.any.html] + [console.count()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.count() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.countReset()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.countReset() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.timeLog()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.timeLog() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + +[console-label-conversion.any.worker.html] + [console.count()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.count() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.countReset()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.countReset() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.timeLog()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.timeLog() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/console/console-log-symbol.any.js.ini b/tests/wpt/meta-legacy-layout/console/console-log-symbol.any.js.ini new file mode 100644 index 00000000000..5e9e6dd0a40 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/console-log-symbol.any.js.ini @@ -0,0 +1,6 @@ +[console-log-symbol.any.html] + +[console-log-symbol.any.shadowrealm.html] + expected: ERROR + +[console-log-symbol.any.worker.html] diff --git a/tests/wpt/meta-legacy-layout/console/console-namespace-object-class-string.any.js.ini b/tests/wpt/meta-legacy-layout/console/console-namespace-object-class-string.any.js.ini new file mode 100644 index 00000000000..de8fe99edd5 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/console-namespace-object-class-string.any.js.ini @@ -0,0 +1,26 @@ +[console-namespace-object-class-string.any.worker.html] + [@@toStringTag exists on the namespace object with the appropriate descriptor] + expected: FAIL + + [Object.prototype.toString applied to the namespace object] + expected: FAIL + + [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] + expected: FAIL + + [Object.prototype.toString applied after deleting @@toStringTag] + expected: FAIL + + +[console-namespace-object-class-string.any.html] + [@@toStringTag exists on the namespace object with the appropriate descriptor] + expected: FAIL + + [Object.prototype.toString applied to the namespace object] + expected: FAIL + + [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] + expected: FAIL + + [Object.prototype.toString applied after deleting @@toStringTag] + expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/console/console-tests-historical.any.js.ini b/tests/wpt/meta-legacy-layout/console/console-tests-historical.any.js.ini new file mode 100644 index 00000000000..0a78ce4ab9a --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/console-tests-historical.any.js.ini @@ -0,0 +1,6 @@ +[console-tests-historical.any.worker.html] + +[console-tests-historical.any.shadowrealm.html] + expected: ERROR + +[console-tests-historical.any.html] diff --git a/tests/wpt/meta-legacy-layout/console/idlharness-shadowrealm.window.js.ini b/tests/wpt/meta-legacy-layout/console/idlharness-shadowrealm.window.js.ini new file mode 100644 index 00000000000..27b57a31bb5 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/idlharness-shadowrealm.window.js.ini @@ -0,0 +1,2 @@ +[idlharness-shadowrealm.window.html] + expected: ERROR diff --git a/tests/wpt/meta-legacy-layout/console/idlharness.any.js.ini b/tests/wpt/meta-legacy-layout/console/idlharness.any.js.ini new file mode 100644 index 00000000000..56286ceece8 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/console/idlharness.any.js.ini @@ -0,0 +1,68 @@ +[idlharness.any.worker.html] + [console namespace: [[Prototype\]\] is Object.prototype] + expected: FAIL + + [console namespace: operation assert(optional boolean, any...)] + expected: FAIL + + [console namespace: operation table(optional any, optional sequence)] + expected: FAIL + + [console namespace: operation trace(any...)] + expected: FAIL + + [console namespace: operation dir(optional any, optional object?)] + expected: FAIL + + [console namespace: operation dirxml(any...)] + expected: FAIL + + [console namespace: operation count(optional DOMString)] + expected: FAIL + + [console namespace: operation countReset(optional DOMString)] + expected: FAIL + + [console namespace: operation time(optional DOMString)] + expected: FAIL + + [console namespace: operation timeLog(optional DOMString, any...)] + expected: FAIL + + [console namespace: operation timeEnd(optional DOMString)] + expected: FAIL + + +[idlharness.any.html] + [console namespace: [[Prototype\]\] is Object.prototype] + expected: FAIL + + [console namespace: operation assert(optional boolean, any...)] + expected: FAIL + + [console namespace: operation table(optional any, optional sequence)] + expected: FAIL + + [console namespace: operation trace(any...)] + expected: FAIL + + [console namespace: operation dir(optional any, optional object?)] + expected: FAIL + + [console namespace: operation dirxml(any...)] + expected: FAIL + + [console namespace: operation count(optional DOMString)] + expected: FAIL + + [console namespace: operation countReset(optional DOMString)] + expected: FAIL + + [console namespace: operation time(optional DOMString)] + expected: FAIL + + [console namespace: operation timeLog(optional DOMString, any...)] + expected: FAIL + + [console namespace: operation timeEnd(optional DOMString)] + expected: FAIL diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 8854a4a3679..547ea0d9709 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -517775,6 +517775,42 @@ {} ] ], + "console-log-symbol.any.js": [ + "a2facb6c64e86428383260735ed2df3e88c2c809", + [ + "console/console-log-symbol.any.html", + { + "script_metadata": [ + [ + "global", + "window,dedicatedworker,shadowrealm" + ] + ] + } + ], + [ + "console/console-log-symbol.any.shadowrealm.html", + { + "script_metadata": [ + [ + "global", + "window,dedicatedworker,shadowrealm" + ] + ] + } + ], + [ + "console/console-log-symbol.any.worker.html", + { + "script_metadata": [ + [ + "global", + "window,dedicatedworker,shadowrealm" + ] + ] + } + ] + ], "console-namespace-object-class-string.any.js": [ "d3ff7f7d07636154080f4d24106e1a6703c37dc4", [ diff --git a/tests/wpt/meta/console/console-is-a-namespace.any.js.ini b/tests/wpt/meta/console/console-is-a-namespace.any.js.ini new file mode 100644 index 00000000000..2d4bda8d093 --- /dev/null +++ b/tests/wpt/meta/console/console-is-a-namespace.any.js.ini @@ -0,0 +1,12 @@ +[console-is-a-namespace.any.worker.html] + [The prototype chain must be correct] + expected: FAIL + + +[console-is-a-namespace.any.html] + [The prototype chain must be correct] + expected: FAIL + + +[console-is-a-namespace.any.shadowrealm.html] + expected: ERROR diff --git a/tests/wpt/meta/console/console-label-conversion.any.js.ini b/tests/wpt/meta/console/console-label-conversion.any.js.ini new file mode 100644 index 00000000000..a27c3c58e21 --- /dev/null +++ b/tests/wpt/meta/console/console-label-conversion.any.js.ini @@ -0,0 +1,38 @@ +[console-label-conversion.any.html] + [console.count()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.count() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.countReset()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.countReset() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.timeLog()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.timeLog() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + +[console-label-conversion.any.worker.html] + [console.count()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.count() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.countReset()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.countReset() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL + + [console.timeLog()'s label gets converted to string via label.toString() when label is an object] + expected: FAIL + + [console.timeLog() throws exceptions generated by erroneous label.toString() conversion] + expected: FAIL diff --git a/tests/wpt/meta/console/console-log-symbol.any.js.ini b/tests/wpt/meta/console/console-log-symbol.any.js.ini new file mode 100644 index 00000000000..65f31e91ce9 --- /dev/null +++ b/tests/wpt/meta/console/console-log-symbol.any.js.ini @@ -0,0 +1,6 @@ +[console-log-symbol.any.shadowrealm.html] + expected: ERROR + +[console-log-symbol.any.html] + +[console-log-symbol.any.worker.html] diff --git a/tests/wpt/meta/console/console-namespace-object-class-string.any.js.ini b/tests/wpt/meta/console/console-namespace-object-class-string.any.js.ini new file mode 100644 index 00000000000..95598614104 --- /dev/null +++ b/tests/wpt/meta/console/console-namespace-object-class-string.any.js.ini @@ -0,0 +1,26 @@ +[console-namespace-object-class-string.any.html] + [@@toStringTag exists on the namespace object with the appropriate descriptor] + expected: FAIL + + [Object.prototype.toString applied to the namespace object] + expected: FAIL + + [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] + expected: FAIL + + [Object.prototype.toString applied after deleting @@toStringTag] + expected: FAIL + + +[console-namespace-object-class-string.any.worker.html] + [@@toStringTag exists on the namespace object with the appropriate descriptor] + expected: FAIL + + [Object.prototype.toString applied to the namespace object] + expected: FAIL + + [Object.prototype.toString applied after modifying the namespace object's @@toStringTag] + expected: FAIL + + [Object.prototype.toString applied after deleting @@toStringTag] + expected: FAIL diff --git a/tests/wpt/meta/console/console-tests-historical.any.js.ini b/tests/wpt/meta/console/console-tests-historical.any.js.ini new file mode 100644 index 00000000000..0a78ce4ab9a --- /dev/null +++ b/tests/wpt/meta/console/console-tests-historical.any.js.ini @@ -0,0 +1,6 @@ +[console-tests-historical.any.worker.html] + +[console-tests-historical.any.shadowrealm.html] + expected: ERROR + +[console-tests-historical.any.html] diff --git a/tests/wpt/meta/console/idlharness-shadowrealm.window.js.ini b/tests/wpt/meta/console/idlharness-shadowrealm.window.js.ini new file mode 100644 index 00000000000..27b57a31bb5 --- /dev/null +++ b/tests/wpt/meta/console/idlharness-shadowrealm.window.js.ini @@ -0,0 +1,2 @@ +[idlharness-shadowrealm.window.html] + expected: ERROR diff --git a/tests/wpt/meta/console/idlharness.any.js.ini b/tests/wpt/meta/console/idlharness.any.js.ini new file mode 100644 index 00000000000..8881965fd27 --- /dev/null +++ b/tests/wpt/meta/console/idlharness.any.js.ini @@ -0,0 +1,68 @@ +[idlharness.any.html] + [console namespace: [[Prototype\]\] is Object.prototype] + expected: FAIL + + [console namespace: operation assert(optional boolean, any...)] + expected: FAIL + + [console namespace: operation table(optional any, optional sequence)] + expected: FAIL + + [console namespace: operation trace(any...)] + expected: FAIL + + [console namespace: operation dir(optional any, optional object?)] + expected: FAIL + + [console namespace: operation dirxml(any...)] + expected: FAIL + + [console namespace: operation count(optional DOMString)] + expected: FAIL + + [console namespace: operation countReset(optional DOMString)] + expected: FAIL + + [console namespace: operation time(optional DOMString)] + expected: FAIL + + [console namespace: operation timeLog(optional DOMString, any...)] + expected: FAIL + + [console namespace: operation timeEnd(optional DOMString)] + expected: FAIL + + +[idlharness.any.worker.html] + [console namespace: [[Prototype\]\] is Object.prototype] + expected: FAIL + + [console namespace: operation assert(optional boolean, any...)] + expected: FAIL + + [console namespace: operation table(optional any, optional sequence)] + expected: FAIL + + [console namespace: operation trace(any...)] + expected: FAIL + + [console namespace: operation dir(optional any, optional object?)] + expected: FAIL + + [console namespace: operation dirxml(any...)] + expected: FAIL + + [console namespace: operation count(optional DOMString)] + expected: FAIL + + [console namespace: operation countReset(optional DOMString)] + expected: FAIL + + [console namespace: operation time(optional DOMString)] + expected: FAIL + + [console namespace: operation timeLog(optional DOMString, any...)] + expected: FAIL + + [console namespace: operation timeEnd(optional DOMString)] + expected: FAIL diff --git a/tests/wpt/tests/console/console-log-symbol.any.js b/tests/wpt/tests/console/console-log-symbol.any.js new file mode 100644 index 00000000000..a2facb6c64e --- /dev/null +++ b/tests/wpt/tests/console/console-log-symbol.any.js @@ -0,0 +1,10 @@ +// META: global=window,dedicatedworker,shadowrealm +"use strict"; +// https://console.spec.whatwg.org/ + +test(() => { + console.log(Symbol()); + console.log(Symbol("abc")); + console.log(Symbol.for("def")); + console.log(Symbol.isConcatSpreadable); +}, "Logging a symbol doesn't throw");