Bug 54337
Summary: | JS: console.log.apply() broken, throws TypeError | ||
---|---|---|---|
Product: | WebKit | Reporter: | Richard Connamacher <richardconnamacher> |
Component: | WebCore JavaScript | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | ap, ggaren, sam |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.6 |
Richard Connamacher
I created a wrapper function "log()" to check if console.log exists before sending messages to it; this allows my code to run without errors on IE and Firefox (when Firebug is disabled). The function passes its arguments on to console.log() by converting the 'arguments' object to an array and calling:
console.log.apply(this, argsArray);
On Firefox with Firebug installed this works as intended. In WebKit, however, it raises a TypeError with the unhelpful text description "type error".
Reproducing this bug is easy. Just open a JavaScript console and enter:
console.log.apply(this, ["Hello World"]);
This bug effects console.log.call as well. Replacing 'this' with any other value yields the same result.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
This is probably a duplicate of bug 20141, although it doesn't look exactly the same.
Richard Connamacher
(In reply to comment #1)
> This is probably a duplicate of bug 20141, although it doesn't look exactly the same.
It does look like a duplicate, though on further testing I learned that the bug itself is invalid. The code does work in Firefox, but the code itself had a problem.
I marked it "RESOLVED INVALID".