WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
26904
Suppress 'undefined' in JSC program display
https://bugs.webkit.org/show_bug.cgi?id=26904
Summary
Suppress 'undefined' in JSC program display
Brent Fulgham
Reported
2009-07-01 14:21:17 PDT
If you play with the JSC program, you can perform various calculations and see results:
> 1 + 2
3
> "hello"
hello The problem is if you attempt to create a variable binding, which does not return a value. In this case, the JSC program reports 'undefined', which is a surprising result and might confuse a user into thinking an error has occurred. For example:
> var add2 = function(arg) { return arg + 2; }
undefined
> add2(15)
17 It seems like it would be better if the transcript looked like the following:
> 1 + 2
3
> var add3 = function(arg) { return arg + 3; } > add3(15)
18
Attachments
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2009-07-01 14:28:52 PDT
The result printed is the result of the expression. While it may seem odd that "var x = 5" displays undefined that is specified behaviour. Not doing so would create even more confusion as eval("var x=5") will correctly display undefined. There's also a reasonable concern that changing this behaviour would break the mozilla js test suite you hit with run-javascriptcore-tests
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug