Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users
Status: Fixed
Last visit > 30 days ago
Closed: Mar 2012
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

  • Only users with Commit permission may comment.

Sign in to add a comment
JavaScript: Constants (defined using Object.defineProperty) are overwritten by a function declaration.
Reported by, Feb 23 2012 Back to list
Chrome Version       : 17.0.963.26 (Dev build 116225) Ubuntu 11.10
URLs (if applicable) :
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5: FAIL
  Firefox 4.x: OK
     IE 7/8/9: NA/NA/FAIL (<IE8 do not support Object.defineProperty)

What steps will reproduce the problem?
1. Create a HTML document with two `<script>` blocks.
2. In the first block, define a constant using `Object.defineProperty(window, 'foo', {value: 6 });`
3. In the second block, attempt to declare a function via `function foo(){}`
4. Verify the value of `foo` via `alert(foo);`, in block 2 or via the console.

What is the expected result?
foo should not change, because it's a constant.

What happens instead?
foo is overwritten by the function declaration.

Please provide any additional information below. Attach a screenshot if
* See attached demo.htm to test whether the bug also occurs in your browser.
* This bug is not observed in Chrome 16.0.912.77 (Official Build 118311) using the V8 JavaScript engine.
* Second part of this post:
824 bytes View Download
Comment 1 by, Feb 24 2012
Labels: -Area-Undefined Area-WebKit WebKit-JavaScript
Comment 2 by, Feb 27 2012
Status: Fixed
Fixed in V8, should roll into Chromium next week.
Fix is in Chromium, as of r127460.
Project Member Comment 6 by, Oct 13 2012
Labels: Restrict-AddIssueComment-Commit
This issue has been closed for some time. No one will pay attention to new comments.
If you are seeing this bug or have new data, please click New Issue to start a new bug.
Project Member Comment 7 by, Mar 11 2013
Labels: -Area-WebKit -WebKit-JavaScript Cr-Content-JavaScript Cr-Content
Project Member Comment 8 by, Apr 6 2013
Labels: -Cr-Content Cr-Blink
Project Member Comment 9 by, Apr 6 2013
Labels: -Cr-Content-JavaScript Cr-Blink-JavaScript
Sign in to add a comment