top-level arguments is not defined

RESOLVED INVALID

Status

()

Core
JavaScript Engine
--
major
RESOLVED INVALID
4 years ago
4 years ago

People

(Reporter: Eric Promislow, Unassigned)

Tracking

24 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release)
Build ID: 20130618035212

Steps to reproduce:

Given file args.js containing this one line:

print(uneval(arguments));

I ran this command:
<path to js> args.js abc 1234


Actual results:

Version JavaScript-C 1.8.5+ 2011-04-16 (linux): reports '["abc", "1234"]'

Version JavaScript-C24.0a2 (linux) reports: 'ReferenceError: arguments is not defined'

Version JavaScript-C24.0 (windows) reports: 'ReferenceError: arguments is not defined'

Version JavaScript-C24.0a1 (windows) reports: '["abc", "1234"]'




Expected results:

All versions should report '["abc", "1234"]'

Section 10.6 of ecma-262 neither forbids nor specifies the meaning of an arguments object at the top-level (unless it elsewhere defines the top-level either to be or not to be an execution context for function code), but https://developer.mozilla.org/en-US/docs/SpiderMonkey/Shell_global_objects clearly specifies arguments to contain the command-line arguments passed to the js shell.

From the version #s above I gather there's a closed bug for this, but I couldn't find it.
(Reporter)

Updated

4 years ago
Severity: normal → major
Component: General → JavaScript Engine
OS: Windows 7 → All
Hardware: x86_64 → All
Version: 18 Branch → 24 Branch
(Reporter)

Comment 1

4 years ago
Ref Komodo bug http://bugs.activestate.com/show_bug.cgi?id=100530
(Reporter)

Updated

4 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 884516
Use scriptArgs in versions where arguments doesn't exist.

arguments was removed because every single person we spoke to remembers being confused the first time they saw it.
(Reporter)

Comment 4

4 years ago
I wasn't confused when I needed to find out how to do command-line processing in the js shell.
It seemed like an elegant solution, avoiding introducing another global.

+ backward compatibility...   Why not maintain `scriptArgs' as an alias to `arguments'?
At least this bug ("arguments is missing") can't be a dupe of the "remove arguments" bug.

(In reply to Eric Promislow from comment #4)
> + backward compatibility...   Why not maintain `scriptArgs' as an alias to
> `arguments'?

It does not make sense because "scriptArgs" was introduced as a replacement of "arguments" in the same patch. It would not have been introduced from the start if "arguments" had been kept.
Blocks: 884516
Resolution: DUPLICATE → INVALID
(Reporter)

Comment 6

4 years ago
We have a simple workaround in the JS code, so there's no further issue here.

Marking the bug as 'resolved:invalid' is fine.
You need to log in before you can comment on or make changes to this bug.