* 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.
<rdar://problem/26052830>
Created attachment 277945 [details] [PATCH] Proposed Fix
Created attachment 277946 [details] [PATCH] Proposed Fix Better ChangeLog.
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.
Comment on attachment 277946 [details] [PATCH] Proposed Fix Clearing flags on attachment: 277946 Committed r200350: <http://trac.webkit.org/changeset/200350>
All reviewed patches have been landed. Closing bug.
*** Bug 20141 has been marked as a duplicate of this bug. ***
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
Re-opened since this is blocked by bug 157304
(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.
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.
(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.
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).
(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.