Bug 17547 - JavaScriptCore print() differs from Spidermonkey Behavior
Summary: JavaScriptCore print() differs from Spidermonkey Behavior
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
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.