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

RESOLVED FIXED in mozilla34

Status

()

Core
JavaScript Engine
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: ziyunfei, Assigned: guptha)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

33 Branch
mozilla34
x86
Mac OS X
dev-doc-complete
Points:
---

Firefox Tracking Flags

(blocking-b2g:2.1S?, tracking-b2g:backlog)

Details

(Whiteboard: [DocArea=JS])

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

3 years ago
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
Blocks: 694100
(Assignee)

Comment 1

3 years ago
Created attachment 8470234 [details] [diff] [review]
Patch to allow duplicate properties in object literals v1

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
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8470234 - Flags: review?(jorendorff)
(Assignee)

Comment 2

3 years ago
Created attachment 8472521 [details] [diff] [review]
Patch to allow duplicate properties in object literals part 2 v1

Waldo, the diff is a bit wonky in update-test262.sh (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+
(Assignee)

Comment 4

3 years ago
Created attachment 8473974 [details] [diff] [review]
Patch to allow duplicate properties in object literals v2

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/update-test262.sh
@@ +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+
(Assignee)

Comment 6

3 years ago
Created attachment 8477897 [details] [diff] [review]
Patch to allow duplicate properties in object literals v1

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+
(Assignee)

Comment 7

3 years ago
https://tbpl.mozilla.org/?tree=Try&rev=d8816fa5f641
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
(Assignee)

Updated

3 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/38b0ac8e7280
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/38b0ac8e7280
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Mentioned on these pages:

* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Duplicate_property_names

* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode#Syntax_errors

* https://developer.mozilla.org/en-US/Firefox/Releases/34#JavaScript

Any reviews to the wiki pages are very much appreciated.
Keywords: dev-doc-needed → dev-doc-complete
Updated following document, which was pointed out by bug 1170752:
  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Comment 12

2 years ago
[Tracking Requested - why for this release]:
blocking-b2g: --- → 2.1S?
tracking-b2g: --- → backlog
You need to log in before you can comment on or make changes to this bug.