Closed Bug 1041128 Opened 9 years ago Closed 9 years ago

Duplicate property name in object literal is allowed in ES6 strict mode


(Core :: JavaScript Engine, defect)

33 Branch
Not set



blocking-b2g 2.1S?
tracking-b2g backlog


(Reporter: 446240525, Assigned: gupta.rajagopal)


(Blocks 1 open bug)


(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])


(1 file, 3 obsolete files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2094.0 Safari/537.36

Steps to reproduce:

js> (function(){"use strict";({1:1,1:1})}())

Actual results:

SyntaxError: property name 1 appears more than once in object literal

Expected results:

This code shouldn't throw any more
This patch does not actually remove the failing test cases. I'll add a follow-up patch once Waldo's patch goes in.
Assignee: nobody → gupta.rajagopal
Ever confirmed: true
Attachment #8470234 - Flags: review?(jorendorff)
Waldo, the diff is a bit wonky in (shows your changes as mine) - I will make sure that once your patch lands, mine applies on top of it.
Attachment #8472521 - Flags: review?(jwalden+bmo)
Comment on attachment 8470234 [details] [diff] [review]
Patch to allow duplicate properties in object literals v1

Review of attachment 8470234 [details] [diff] [review]:

This also gets rid of the "extra warnings"-mode warning about duplicate properties. I'm a little ambivalent because it means you'll be able to (for example) declare a large class, accidentally declare a method twice, and get no warning whatsoever.

But on consideration I think we should let it go.
Attachment #8470234 - Flags: review?(jorendorff) → review+
Addressed review comments in bug 924672.
Attachment #8470234 - Attachment is obsolete: true
Attachment #8473974 - Flags: review+
Comment on attachment 8472521 [details] [diff] [review]
Patch to allow duplicate properties in object literals part 2 v1

Review of attachment 8472521 [details] [diff] [review]:

Flat-out test removals makes for a nice, simple patch.

::: js/src/tests/
@@ +133,5 @@
> +# Apply a very narrow set of post-fixes to tests that haven't yet been updated
> +# for spec changes, or where we're experimenting with semantics that disagree
> +# with those in test262.  See below: this isn't every test we don't pass!
> +patch -d "${js_src_tests_dir}" -p4 < ./poison-pill-changes.diff

Remove this line, I'll merge it into these changes if you land first.  (Or you can do likewise if I land first.)
Attachment #8472521 - Flags: review?(jwalden+bmo) → review+
Merged Waldo's changes in. Unified the two parts to create a single diff.
Attachment #8472521 - Attachment is obsolete: true
Attachment #8473974 - Attachment is obsolete: true
Attachment #8477897 - Flags: review+
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Keywords: checkin-needed
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
[Tracking Requested - why for this release]:
blocking-b2g: --- → 2.1S?
You need to log in before you can comment on or make changes to this bug.