Bug 17547 - JavaScriptCore print() differs from Spidermonkey Behavior
: JavaScriptCore print() differs from Spidermonkey Behavior
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore
: 528+ (Nightly build)
: Macintosh Mac OS X 10.5
: P2 Normal
Assigned To: Sam Weinig
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-25 22:46 PST by Brent Fulgham
Modified: 2008-06-07 12:35 PDT (History)
0 users

See Also:


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

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 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 Cameron Zwarich (cpst) 2008-06-07 11:34:23 PDT
Created attachment 21562 [details]
Proposed patch
Comment 2 Sam Weinig 2008-06-07 12:27:22 PDT
Comment on attachment 21562 [details]
Proposed patch

+    if (args.size())

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

r=me
Comment 3 Cameron Zwarich (cpst) 2008-06-07 12:35:34 PDT
Landed in r34428.