console.count() label toString conversion exhibits odd behavior |
|||||
Issue description
Chrome Version : 56.0.2924.87
URLs (if applicable) :
Other browsers tested:
Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
Safari: FAIL
Firefox: FAIL
Edge: FAIL
IE: N/A
What steps will reproduce the problem?
(1) [OPTIONAL] Read up on the issue here: https://github.com/whatwg/console/issues/88
(2) Open DevTools on any page
(3) Run the code from the following jsbin in the console: https://jsbin.com/kibefuj/edit?js,console.
What is the expected result?
It is expected that a timer's label will computed using `label.toString()` if the label is an object, therefore code inside `label.toString()` will be invoked. An exception should be thrown, propagated to the user, and no counter will be incremented.
What happens instead?
The label's toString() never gets called, therefore never invoking a custom toString function, and never propagating an error to the user when toString fails. So in the jsbin, two assertions are recorded. One for not calling toString, and one for not re-throwing a toString exception.
Please provide any additional information below. Attach a screenshot if
possible.
**NOTE:** This is inextricably connected to https://bugs.chromium.org/p/chromium/issues/detail?id=696805
,
Mar 14 2017
Hi! Unfortunately no browser passes that test with flying colors so I don't really have a screenshot for you. In other words in every browser that runs the test, at least one failed assertion is seen when an ideal implementation would show 0 failed assertions. At a more granular level, this means:
1.) When an object is passed in as a label to `console.count(someObjHere)`, an implementation *should* call `someObjHere.toString()` to try and get a string value out of that object. Chrome does not do this.
2.) Assume (1) passes. If `someObjHere.toString()` (called if (1) passes) throws an error instead of returning an actual string, the error should be re-thrown to the caller. That is what the try{} catch(){} is doing in the test. A correct implementation would always enter the catch block as `someObjHere.toString()` throws an error, however Chrome does not do this. In fact, it never gets a chance to even throw an error, since `toString()` is never called!
Please let me know if this is enough information as to the expected results. In short, no assertions should be seen.
,
Mar 14 2017
Thank you for providing more feedback. Adding requester "krajshree@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 15 2017
Able to reproduce this issue on Mac 10.12.3, Win-10 and Ubuntu 14.04 using chrome reported version #56.0.2924.87 and latest canary #59.0.3041.0. This is a non-regression issue as it is observed from M50 old builds. From M45 and older builds on loading the url: https://jsbin.com/kibefuj/edit?js,console, throws an " Uncaught SyntaxError: Unexpected identifier" error. Hence, marking it as untriaged to get more inputs from dev team. Thanks...!!
,
Mar 17 2017
,
Nov 28 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by krajshree@chromium.org
, Mar 14 2017Components: Platform>DevTools
Labels: Needs-Feedback
1.2 MB
1.2 MB View Download