Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rhino error: Changing attributes not supported for Function prototype property #1200

Open
ai opened this issue Jul 23, 2014 · 9 comments
Open

Comments

@ai
Copy link

ai commented Jul 23, 2014

When I try to run compiled JS and Rhino (to run Autoprefixer into Java) it fall with:

Rhino::JSError:
       InternalError: Changing attributes not supported for Function prototype property
     # at <eval>:13904 (createClass)
     # at <eval>:14295
     # at <eval>:14279
     # at <eval>:13557

Line 13904 from this backtrace contains:

$defineProperty(ctor, 'prototype', {
  configurable: false,
  writable: false
});
@ai
Copy link
Author

ai commented Jul 23, 2014

@johnjbarton @arv this error is in Traceur Runtime. Maybe we should wrap this code in try {} catch {}, because JS will works without with defineProperty.

@ai
Copy link
Author

ai commented Jul 23, 2014

@johnjbarton @arv if you agree with try catch I can send PR.

@johnjbarton
Copy link
Contributor

To me, this error is in Rhino, where the exception originates.

@arv
Copy link
Collaborator

arv commented Jul 23, 2014

Yeah, this is a Rhino bug.

Try/catch seems bad. What does the prototype descriptor look like in Rhino? Maybe it is sane and says that configurable is already false, then we can use that to determine if this is safe.

@ai
Copy link
Author

ai commented Jul 23, 2014

If Rhino throw this error, it already had configurable: false and writable: false :).

@arv
Copy link
Collaborator

arv commented Jul 23, 2014

The spec says that no error should be thrown when defineProperty has SameVaue for all fields.

@ai
Copy link
Author

ai commented Jul 24, 2014

@arv what did you mean?

@arv
Copy link
Collaborator

arv commented Jul 24, 2014

The following should not be an error:

var o = {};
Object.defineProperty(o, 'x', {
  configurable: false,
  writable: false,
  value: 1,
});
Object.defineProperty(o, 'x', {
  configurable: false,
  writable: false,
});

since it all the keys in the descriptor are the same.

@techhounds2015
Copy link

techhounds2015 commented Dec 20, 2017

Hi All

we are upgrading to jQuery version 3.2.1
We have Rihno version 1_7R2 and we are getting error Object.defineProperty is not a function.
I tried other new version of Rihno but nothing worked.

The reason may be Object.defineProperty is defined in JS 1.8 and rihno is in JS 1.7

can anyone of you help me to solve this ?

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

No branches or pull requests

4 participants