Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Object.defineProperty behaves incorrectly in PhantomJS #11856

Closed
Rich-Harris opened this issue Dec 28, 2013 · 6 comments
Closed

Object.defineProperty behaves incorrectly in PhantomJS #11856

Rich-Harris opened this issue Dec 28, 2013 · 6 comments

Comments

@Rich-Harris
Copy link

The following behaves correctly in browsers and node.js, but incorrectly in PhantomJS:

var obj = {};

Object.defineProperty( obj, 'foo', { value: 'bar', configurable: true });
console.log( obj.foo );

Object.defineProperty( obj, 'foo', { value: 'baz', configurable: true });
console.log( obj.foo );

Correct result:

bar
baz

PhantomJS result:

bar
bar
@brettfattori
Copy link

+1 Having this same issue

@cwilbur
Copy link

cwilbur commented Jul 1, 2014

Same issue here.

@JamesMGreene
Copy link
Collaborator

Does it work correctly if you add writable: true to the property descriptor?

@Rich-Harris
Copy link
Author

@JamesMGreene Yes, if writable is true, you get the same result in both browser and PhantomJS:

bar
baz

spalger pushed a commit to spalger/kibana that referenced this issue Apr 30, 2015
spalger pushed a commit to spalger/kibana that referenced this issue May 1, 2015
san650 added a commit to san650/ember-cli-page-object that referenced this issue Jan 24, 2016
This commit workarounds an issue in phantomjs where we cannot use
Object.defineProperty to redefine a property.

See ariya/phantomjs#11856
@parasyte
Copy link

parasyte commented Feb 1, 2016

FWIW, this bug is fixed in PhantomJS 2.1.1

@vitallium
Copy link
Collaborator

Thanks! Closing this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants