Closed
Bug 551763
Opened 14 years ago
Closed 14 years ago
sputnik S13_A11_T1 - 'delete arguments' in a function deletes global.arguments
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jorendorff, Assigned: cdleary)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 2 obsolete files)
3.29 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
Sputnik test S13_A11_T1 fails in SpiderMonkey. Here's a slightly different test I wrote that shows exactly what's going wrong: var arguments = 7; function f() { assertEq(delete arguments, false); // fails } f(); assertEq(arguments, 7); // fails; we deleted the global print(" PASSED!"); The easiest thing might be to compile `delete arguments` to `false` in the front end.
Reporter | ||
Comment 1•14 years ago
|
||
Related to bug 530650?
Comment 2•14 years ago
|
||
(In reply to comment #1) > Related to bug 530650? Yes, I was about to point that one out. Luke knows about it too, since the patch in that bug classifies functions that use arguments (or could use arguments), and flags them. /be
Updated•14 years ago
|
Assignee: general → cdleary
Assignee | ||
Comment 3•14 years ago
|
||
We're only broken on lightweight functions; i.e. js> function f() { print(delete arguments) } js> function g() { print(delete arguments); with(this) {} } js> f(), g() true false The heavyweight lookup resolves 'arguments appropriately via JSOP_DELNAME through js_FindProperty. We could just flip it to heavyweight if we see somebody is trying to delete 'arguments. Alternatively, we could return false when we see a deletion of 'arguments in a lightweight function invocation in the JSOP_DELNAME implementation. We actually mark as heavyweight on assignment to arguments in the parser's NoteLValue function, so doing the same on deletion seems reasonable. Patch including test cases is attached.
Attachment #432252 -
Flags: review?(jorendorff)
Reporter | ||
Updated•14 years ago
|
Attachment #432252 -
Flags: review?(jorendorff) → review+
Reporter | ||
Comment 4•14 years ago
|
||
Comment on attachment 432252 [details] [diff] [review] Arguments deletion fix. Nice fix. The only nit is that trace-tests are for testing the tracing JIT. So please put the test someplace like js/src/tests/js1_8_5/regressions/regress_551763.js, add a line to the jstests.list file in that directory, and to make the test pass in the test-runner, add print(" PASSED!"); at the end. (You could instead call reportCompare -- but then your test depends on a function provided by the test-runner, and ideally tests should also run standalone in the shell, if possible.)
Comment 5•14 years ago
|
||
(In reply to comment #4) > > test-runner, add > > print(" PASSED!"); > > at the end. > > (You could instead call reportCompare -- but then your test depends on a > function provided by the test-runner, and ideally tests should also run > standalone in the shell, if possible.) Will that work when the test is run in the browser? print() does something altogether different there. I think reportCompare is needed anyway for that situation.
Reporter | ||
Comment 6•14 years ago
|
||
browser.js defines print() to do a document.write. I don't know how the jsreftest runner works, but browser.js doesn't overload the reportCompare function.
Assignee | ||
Comment 7•14 years ago
|
||
Puts test in the right place.
Attachment #432252 -
Attachment is obsolete: true
Attachment #432649 -
Flags: review?(jorendorff)
Updated•14 years ago
|
Attachment #432649 -
Flags: review?(jorendorff) → review?(jim)
Assignee | ||
Comment 8•14 years ago
|
||
Update -- this has been sitting for a while.
Attachment #432649 -
Attachment is obsolete: true
Attachment #442849 -
Flags: review?(jwalden+bmo)
Attachment #432649 -
Flags: review?(jim)
Updated•14 years ago
|
Attachment #442849 -
Flags: review?(jwalden+bmo) → review+
Comment 9•14 years ago
|
||
Comment on attachment 442849 [details] [diff] [review] Arguments deletion fix and tests. Separate each test into its own file -- in particular, at the very least the two global tests both test the same thing, because the scope of a |var| in global scope is the entire script -- *not* just after it in source order.
Assignee | ||
Comment 10•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/24a3be30208e
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Updated•14 years ago
|
Status: NEW → ASSIGNED
Comment 11•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/24a3be30208e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•