-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate console.count IDL against implementations #88
Comments
What Safari is doing here is not the same as if the user used the string "Global". We are using an internal name and choosing to display "Global" because we feel it is more user friendly than an empty string. That said, based off of Edge's implementation and the lessons learned with |
@JosephPecoraro Ah sorry I didn't see that issue. So it seems that issue thread ended with the opinion of going with
...as well as the addition of the Let me know if I missed something. With all that said I'm concerned about the failures above. Right now only one implementation (chrome) follows default param of On the other hand, given the failures/inconsistencies, I wonder if it would instead make sense to loosen the IDL to
How do you feel about this? I'm not sure if the way I perform an undefined check in (1) is ideal or not |
Edge seems to output I agree this situation seems a lot worse than time(). However we can be optimistic and say that just gives us lots of leeway to spec what's best :). As part of that I do think settling everyone on a single label is better than leaving it up to the implementation to vary between "", "Global" (kind of), and "default". Since @JosephPecoraro (WebKit) seems on board I would suggest going for
Yes, we can add tests for the error-throwing case, but no automatic tests for the actual visual case. Manual tests are still valuable though. They are usually suffixed with |
Sounds good, I can PR Regarding the default parameter case, I assume it's probably best to wait until #90 is resolved and the spec is crystal clear on how |
I think that's a reasonable way to do things, although I also think filing browser bugs to say "please use the label default, not a unique label per call" or similar is OK. |
Filed bugs:
I may add these to NOTES.md too. |
Question: is the counting per script or is it global? In firefox, the counting is per script. This means that, if we have 2 scripts foo.js and bar.js running 'in parallel' and doing: console.count('a'); something(); console.count('a') the result will be 2 - 2 and not 4. I would like to have this feature covered in the spec. Is it already like this? Do we care? |
Sorry, I'm wrong. In case the label is not passed as argument, we force it to be <scriptName>:<fileName>. I'm OK to have the behavior as described in this issue. |
Wait, I'm confused; are you wrong about it being per-script in Firefox, or are you wrong about something involving the label? Per spec right now it's per-global in a vague way, although we should probably formalize it more by adding e.g. a console count map to each |
Seems wrong at least about per-script in Firefox, as the following code yields a single global counter incremented 6 times:
..where
Regarding
Which seems a little odd? |
I think we knew that odd behavior would happen, and that's why you filed all the bugs :) |
Yeah, hopefully when default labels get fixed for these implementations, anomalies like this will mostly disappear. Anyways, I like the idea of a |
Currently Firefox Nightly supports the default labels for console.count(), console.time() and console.timeEnd(). |
This is an extension of #26 where @domenic and I discussed implementation differences regarding
console.time/timeEnd
.count (IDL)
With count there are two things to test (similarly to time):
label = ""
console.count()
andconsole.count(undefined)
not only work, but also produce identical resultsToString()
conversion is being delegated tolabel.toString()
gets called if the countlabel
is an object.Tests
Results:
count()
behaves differently thancount(undefined)
.count()
uses label "no label" instead of"default"
count(undefined)
uses label"undefined"
instead of"default"
label.toString()
when label is object.count()
behaviorcount()
behaves differently thancount(undefined)
.count()
uses label""
instead of"default"
count(undefined)
uses label"undefined"
instead of"default"
label.toString()
ever (just liketime
)time
may incidentally fixcount
!count()
uses label""
instead of"default"
label.toString()
when label is object.count()
behaviorcount()
behaves differently thancount(undefined)
count()
uses label "Global" instead of"default"
count(undefined)
uses label"undefined"
instead of"default"
label.toString()
when label is object.count()
behaviorI think this is quite a bit worse than
time
, however a lot of the non-compliant behavior revolves around differing default labels oncount()
and the fact thatcount(undefined)
convertedundefined
=>"undefined"
as a string. Does it make sense to do something similar to what the recent changes toassert
are doing, in that we can make thelabel
optional with no default value, and in the algorithm suggest a default value but allow implementations to choose what they see fit. This may help compliancy out a bit, but we'll still need to open bugs forundefined
=>"undefined"
.Regarding web platform tests for this, are we limited to visual tests since we cannot (to my knowledge) programmatically check to see what value a console did/didn't log after some call?
The text was updated successfully, but these errors were encountered: