When I run this code in phantomjs:
var Test = (function()
{
function Test()
{
this.instanceProp = "hello!";
}
Object.defineProperty(Test, "name", {
get: function () {
return "TextHelper";
},
enumerable: true,
configurable: true
});
return Test;
})();
I am getting the error TypeError: Attempting to configurable attribute of unconfigurable property.
Running this code in Firefox, Chrome and IE does not seem to produce an issue.
Thanks in advance for your help.
I've run into the same issue. I'm running phonegap tests inside the ripple emulator inside phantomjs. During part of it's initialization it runs something like the following:
Object.defineProperty(window, 'name', {
value: {}, configurable: true, enumerable: true
});
which throws this error:
TypeError: Attempting to configurable attribute of unconfigurable property.
This doesn't happen in Chrome. Interestingly enough I'm seeing the crash trying to define a property with the same name (name) as the OP. That might be a clue to the underlying issue.
Good observation. I have changed all uses of the property "name" in my code and everything seems to run fine now.
I wish I had that option. I'm using a third party tool (apache ripple emulator), and so I can't change the properties they use.
Just checking in on this issue. Has it been fixed?
I can confirm that this is still failing in phantomjs 2.1.1
I had the same problem when testing my SPA which uses CasperJS+PhantomJS and InfernoJS.
I have the same issue when using AWS SDK - aws-sdk-2.2.19.min.js
Any updates on this?
Thanks,
Sridhar
See Function.name, before ES6, Function.name is not configurable. I think for fixing this bug, PhantomJS needs to upgrade QtWebkit to latest version. Current QtWebkit 2.2 is released 2011, there will be more and more bugs like this one.
There is already a tracing issue, see #14506. @ariya , this bug is related to ES6 too.
On my end I'm using:
Object.defineProperty(domElement, attributeToWatch, {
set: val => {
console.log('value has changed', val);
},
});
where attributeToWatch can be 'value', 'textContent' or 'nodeValue' with PhantomJS 2.1.1, and I get that TypeError: Attempting to change access mechanism for an unconfigurable property. error message too.
Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
Do you guys have any work around about this issue? I'm updating mt project with angular 1.7.9 and got the TypeError: Attempting to configurable attribute of unconfigurable property while running unit test, but it was working for with angular 1.7.5
@limingli0707 , Have you got any fix for This issue. I am also trying to update to Angular 1.7.9 and stuck. Can you help with the solution.