Bug 17547 - JavaScriptCore print() differs from Spidermonkey Behavior
: JavaScriptCore print() differs from Spidermonkey Behavior
Status: RESOLVED FIXED
: WebKit
JavaScriptCore
: 528+ (Nightly build)
: Macintosh Mac OS X 10.5
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-02-25 22:46 PST by
Modified: 2008-06-07 12:35 PST (History)


Attachments
Proposed patch (1.06 KB, patch)
2008-06-07 11:34 PST, Cameron Zwarich (cpst)
sam: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-02-25 22:46:43 PST
Spidermonkey has the useful behavior of printing a newline when no argument is passed:

print("abc")
print()
print("def")

yields:

abc

def

In JavaScriptCore, the same code yields:

abc
undefined
def

This can be easily worked around by passing an empty string, but it prevents reuse of code between the two implementations.
------- Comment #1 From 2008-06-07 11:34:23 PST -------
Created an attachment (id=21562) [details]
Proposed patch
------- Comment #2 From 2008-06-07 12:27:22 PST -------
(From update of attachment 21562 [details])
+    if (args.size())

I would rather you use !args.isEmpty() here.

r=me
------- Comment #3 From 2008-06-07 12:35:34 PST -------
Landed in r34428.