WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
157286
Make console a namespace object (like Math/JSON), allowing functions to be called unbound
https://bugs.webkit.org/show_bug.cgi?id=157286
Summary
Make console a namespace object (like Math/JSON), allowing functions to be ca...
Joseph Pecoraro
Reported
2016-05-02 16:44:06 PDT
* SUMMARY Make console a namespace object (like Math/JSON), allowing it to be called unbound The evolving Console standard is pushing this direction: <
https://github.com/whatwg/console/issues/3
> This would improve a lot of scenarios where it currently throws a type error unless bound with a Console instance. This has been a long time feature request (
bug 20141
). Example scenarios where it would throw: [1, 2, 3].forEach(console.log); var log = console.log; log("value"); Current workaround is to bind `console.log.bind(console)`. This will make that workaround unnecessary. * STEPS TO REPRODUCE 1. js> var log = console.log; log("test") => TypeError, expected it to work * NOTES • At the same time we can make `console` more interoperable with other browsers: - `console` is enumerable in `window` in Firefox and Chrome, but not Safari. Lets make it enumerable. - `console.toString()` is "[object Console]" in Safari and Firefox, but not Chrome Canary... I'm going to Keeping "[object Console]" for now, since it has been around for quite a while. Spec discussion seems to suggest future "namespace" objects don't need this special treatment and should be "[object Object]" like normal objects (<
https://github.com/tc39/ecma262/issues/495
>). Console has been around long enough that it could qualify as legacy, so I'm going to keep it for now. This may change after discussion.
Attachments
[PATCH] Proposed Fix
(46.41 KB, patch)
2016-05-02 16:54 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
[PATCH] Proposed Fix
(47.25 KB, patch)
2016-05-02 16:58 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-05-02 16:47:22 PDT
<
rdar://problem/26052830
>
Joseph Pecoraro
Comment 2
2016-05-02 16:54:11 PDT
Created
attachment 277945
[details]
[PATCH] Proposed Fix
Joseph Pecoraro
Comment 3
2016-05-02 16:58:55 PDT
Created
attachment 277946
[details]
[PATCH] Proposed Fix Better ChangeLog.
Joseph Pecoraro
Comment 4
2016-05-02 17:09:17 PDT
Comment on
attachment 277946
[details]
[PATCH] Proposed Fix Wait on commit-queue for bots to run all tests. I ran them but I want to be sure they pass on the bots.
WebKit Commit Bot
Comment 5
2016-05-02 17:50:50 PDT
Comment on
attachment 277946
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 277946 Committed
r200350
: <
http://trac.webkit.org/changeset/200350
>
WebKit Commit Bot
Comment 6
2016-05-02 17:50:54 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 7
2016-05-02 18:07:48 PDT
***
Bug 20141
has been marked as a duplicate of this bug. ***
Alex Christensen
Comment 8
2016-05-03 00:37:07 PDT
I see this new error in JSC tests after this patch: undefined:1:37: JS ERROR Error: cyclic __proto__ value
https://build.webkit.org/builders/Apple%20Yosemite%20LLINT%20CLoop%20%28BuildAndTest%29/builds/15606/steps/webkit-jsc-cloop-test/logs/stdio
WebKit Commit Bot
Comment 9
2016-05-03 00:40:26 PDT
Re-opened since this is blocked by
bug 157304
Joseph Pecoraro
Comment 10
2016-05-03 01:28:13 PDT
(In reply to
comment #8
)
> I see this new error in JSC tests after this patch: > undefined:1:37: JS ERROR Error: cyclic __proto__ value >
https://build.webkit.org/builders/
> Apple%20Yosemite%20LLINT%20CLoop%20%28BuildAndTest%29/builds/15606/steps/ > webkit-jsc-cloop-test/logs/stdio
The actual failure was:
> assertTrue failed: 'Property count == 1' > assertTrue failed: 'First property name is doSomething'
This was because we made `console` Enumerable at the top level. Changing back to `DontEnum` will match our previous behavior, and we can revisit this later if needed. If we are to be like other builtin's `Math`, `JSON`, `Reflect`, they are not enumerable at the top level, so maybe we should just go that route. As for the cyclic thing, I am not certain if that is a failure or not.
Joseph Pecoraro
Comment 11
2016-05-03 01:47:12 PDT
I'm having trouble running the jsc tests in general. Just attempting to run them hangs my machine. I can confirm the testapi tests pass, but I can't run the broad range of jsc tests at the moment.
Joseph Pecoraro
Comment 12
2016-05-03 01:56:49 PDT
(In reply to
comment #11
)
> I'm having trouble running the jsc tests in general. Just attempting to run > them hangs my machine. I can confirm the testapi tests pass, but I can't run > the broad range of jsc tests at the moment.
I found my problem, the test runner was spawning 24 threads. Forcing --child-processes=8 made things run much much smoother.
Joseph Pecoraro
Comment 13
2016-05-03 02:19:41 PDT
Attempted a fix in: <
http://trac.webkit.org/changeset/200367
> I accidentally referenced the wrong r### in the ChangeLog though =(. All run-javascriptcore-tests passed locally for me after this change (I saw the same testate failure before the fix).
Joseph Pecoraro
Comment 14
2016-05-03 03:00:02 PDT
(In reply to
comment #13
)
> Attempted a fix in: > <
http://trac.webkit.org/changeset/200367
>
The bots look greener. I'm going to re-close this.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug