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

In Firefox, traceur runtime causes performance-related warning #1367

Closed
louisremi opened this issue Sep 22, 2014 · 5 comments
Closed

In Firefox, traceur runtime causes performance-related warning #1367

louisremi opened this issue Sep 22, 2014 · 5 comments
Labels

Comments

@louisremi
Copy link

Just loading the traceur-runtime in a page in Firefox (Nightly 35) causes the following warning to be logged in the console:

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

I've found some explanation about this message in this bug comment. The workaround seem to be to replace the use of proto with Object.create( otherClass.protototype ), see Object.create inheritance.

@arv
Copy link
Collaborator

arv commented Sep 22, 2014

Don't worry about it. We need to assign __proto__ to get the correct prototype chain for static inheritance.

Object.create does not work in our case because the instance needs to be a function instance.

@arv arv closed this as completed Sep 22, 2014
@arv arv added the wontfix label Sep 22, 2014
@johnjbarton
Copy link
Contributor

Or complain to Firefox about annoying messages.

On Mon, Sep 22, 2014 at 11:30 AM, Erik Arvidsson notifications@github.com
wrote:

Don't worry about it. We need to assign proto to get the correct
prototype chain for static inheritance.

Object.create does not work in our case because the instance needs to be
a function instance.


Reply to this email directly or view it on GitHub
#1367 (comment)
.

@UltCombo
Copy link
Contributor

Or complain to Firefox about annoying messages.

+1 to that. ;)

@louisremi
Copy link
Author

I reopened a bug on bugzilla.mozilla.org and linked to this discussion, don't hesitate to chime in: https://bugzilla.mozilla.org/show_bug.cgi?id=1049041

@pflannery
Copy link
Contributor

would this be avoided if we just used theObject.setPrototypeOf on latest browsers and for older browsers use this:

if (Object.setPrototypeOf === undefined) {
    Object.setPrototypeOf = function(oInstance, oProto) {
      oInstance.__proto__ = oProto;
      return oInstance;
    };
}

The example I grabbed from this page

I dont see many ref's to proto in the src and they all seem replaceable with setPrototypeOf

bearing in mind though I might be out of my league on this one :\

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

No branches or pull requests

5 participants