Bug 215750

Summary: Console object's @@toStringTag should be "console" instead of "Console"
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: ashvayka, clopez, ews-watchlist, hi, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ross.kirsling: review+
Patch
none
Patch none

Description Yusuke Suzuki 2020-08-21 22:37:20 PDT
Console object's @@toStringTag should be "console" instead of "Console"
Comment 1 Yusuke Suzuki 2020-08-21 22:38:01 PDT
Created attachment 407042 [details]
Patch
Comment 2 Ross Kirsling 2020-08-21 22:57:27 PDT
Comment on attachment 407042 [details]
Patch

r=me, given that CSS[@@toStringTag] will be addressed in a later patch.

We should probably link https://github.com/web-platform-tests/wpt/pull/24717 in the ChangeLog though.
Comment 3 Yusuke Suzuki 2020-08-21 23:27:29 PDT
(In reply to Ross Kirsling from comment #2)
> Comment on attachment 407042 [details]
> Patch
> 
> r=me, given that CSS[@@toStringTag] will be addressed in a later patch.
> 
> We should probably link https://github.com/web-platform-tests/wpt/pull/24717
> in the ChangeLog though.

Sounds good!
Comment 4 Yusuke Suzuki 2020-08-21 23:33:01 PDT
Created attachment 407044 [details]
Patch

Patch for landing
Comment 5 Yusuke Suzuki 2020-08-21 23:33:34 PDT
Created attachment 407045 [details]
Patch

Patch for landing
Comment 6 Alexey Shvayka 2020-08-22 07:37:01 PDT
(In reply to Ross Kirsling from comment #2)
> Comment on attachment 407042 [details]
> Patch
> 
> r=me, given that CSS[@@toStringTag] will be addressed in a later patch.

For `CSS`, it might get tricky since `CodeGeneratorJS.pm` has no notion of namespace objects.
Currently, `CSS.prototype[Symbol.toStringTag] === "CSS"`, but it's wrong since `CSS` shouldn't be a function.
Making `CSS` an ordinary object will take some tweaking to code generator (an extra attribute) + might break some sites depending on `typeof CSS === "function"` check.
So instead, we may consider adding Symbol.toStringTag in [CustomToJSObject] or something, until Chromium will ship `CSS` as ordinary object change.

Tests for namespace objects: https://github.com/web-platform-tests/wpt/pull/24724.
Comment 7 Alexey Shvayka 2020-08-22 07:45:26 PDT
(In reply to Alexey Shvayka from comment #6)
> So instead, we may consider adding Symbol.toStringTag in [CustomToJSObject]
> or something, until Chromium will ship `CSS` as ordinary object change.

Or we can just hardcode `$interfaceName eq "CSS"` at CodeGeneratorJS.pm:4445 and add it there, but it won't look nice.
Comment 8 Yusuke Suzuki 2020-08-22 10:51:28 PDT
I'll land it with testapi rebaseline.
Comment 9 Yusuke Suzuki 2020-08-22 11:02:19 PDT
(In reply to Alexey Shvayka from comment #7)
> (In reply to Alexey Shvayka from comment #6)
> > So instead, we may consider adding Symbol.toStringTag in [CustomToJSObject]
> > or something, until Chromium will ship `CSS` as ordinary object change.
> 
> Or we can just hardcode `$interfaceName eq "CSS"` at CodeGeneratorJS.pm:4445
> and add it there, but it won't look nice.

Yeah, I think, supporting `namespace` in IDL would be the best way :)
Comment 10 Yusuke Suzuki 2020-08-22 11:08:57 PDT
Committed r266030: <https://trac.webkit.org/changeset/266030>
Comment 11 Radar WebKit Bug Importer 2020-08-22 11:09:15 PDT
<rdar://problem/67620195>