Skip to content

Mozilla TypeError: mutating the [[Prototype]] of an object will cause your code to run very slowly #1805

Closed

Description

@blankdots

I'm working on Mozilla Aurora v 30.0a2 and I noticed this Warning today appearing in both Firefox Dev tools and Firebug.

"TypeError: 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 switched to Chrome and there was no such warning in the console.

To be sure that it is not something inside my web application I've tested several examples provided in https://github.com/mbostock/d3/wiki/Gallery and they all seem to give out the same warning.

I know it is just a warning but still, I thought I should bring it up.

Activity

  1. mbostock commented on Mar 23, 2014

    @mbostock
    Member

    I don’t see this error in 30.0a2 (2014-03-23) when visiting http://d3js.org.

    At any rate, this is a fairly aggressive warning given that changing the prototype is effectively the only good way to create an array subclass in ES5. When ES6 is available and Array.create is supported, I will happily switch to that rather than reassigning the prototype, but in the meantime there’s no better solution and the above warning is not helpful (and in fact misleading because Object.create is not applicable for arrays).

  2. Solidary commented on Jun 6, 2014

    @Solidary

    Same problem. I just installed Firefox 30.0
    TypeError: 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

  3. boldt commented on Jun 12, 2014

    @boldt

    I just got my Firefox 30.0 update; I can't debug my code any more, because the debugger hangs at this warning. Any suggestions?

  4. jasondavies commented on Jun 12, 2014

    @jasondavies
    Contributor

    It’s just a warning that appears in the console as far as I can tell. Are you sure it prevents you from debugging your code?

  5. boldt commented on Jun 12, 2014

    @boldt

    I am loading d3 with require.js, which throws the following error:

    Error: Load timeout for modules: d3 http://requirejs.org/docs/errors.html#timeout
    object.__proto__ = prototype;
    

    Even if I click on continue immediately; I am not reaching my code at all.

    [EDIT] The debugger stopps at this warning.

  6. jasondavies commented on Jun 12, 2014

    @jasondavies
    Contributor

    Works for me. Do you have a reproducible example?

  7. boldt commented on Jun 12, 2014

    @boldt

    I just restarted my firefox. It seems, that I also got a Firebug update. At least Firebug looks a bit different now. And: it works.

    [EDIT] I have Firebug 2.0 now. Probably the bug occured with Firebug 1.12.

  8. Paul-Brady commented on Jun 13, 2014

    @Paul-Brady

    I am using D3 with ThreeJS to produce two simultaneous 3D representations similar to what Steven Hall did here: http://projects.delimited.io/experiments/d3-threejs/slow-device.html. On a particular machine using Ubuntu 13.04 and FireFox 30, the TypeError that @blankdots got is occurring and preventing the elements in the scenes from being transformed to their 3D positions. It works with Chrome. Cannot get to the bottom of it. Any thoughts?

  9. jasondavies commented on Jun 13, 2014

    @jasondavies
    Contributor

    Without a reproducible example, I can’t really help, sorry. Are you running an older version of Firebug?

  10. Paul-Brady commented on Jun 13, 2014

    @Paul-Brady

    @jasondavies Thanks for the prompt response. Firebug is up to date. I will try to recreate it in an example.

  11. jasondavies commented on Jun 13, 2014

    @jasondavies
    Contributor

    It works fine for me with Firefox 30.0/Ubuntu 13.04 (clean install; no addons). Perhaps you should try disabling addons.

  12. jasondavies commented on Jun 13, 2014

    @jasondavies
    Contributor

    I installed Firebug 2.0 and everything still works.

  13. Paul-Brady commented on Jun 13, 2014

    @Paul-Brady

    A full reinstall worked. Very strange. Many thanks for looking into it.

  14. PaulBrinkley commented on Jun 25, 2014

    @PaulBrinkley

    I've been hitting this error as of just this morning now. FF 30.0, no Firebug, even when every plugin is disabled on a clean install. I'm only using Mozilla's built-in debugger, and it seems to be working, but needless to say, I'd love to have it go away. Is it hopeless?

  15. jasondavies commented on Jun 25, 2014

    @jasondavies
    Contributor

    It’s important to notice that this is a warning, not an error (it goes away if you hide warnings in the console). I think part of the panic is caused by the word “TypeError”. There is sufficient explanation in this issue for why it’s not a problem, and we have no good alternative until Array.create is supported.

    (Others have run into problems, but this seems related to an older version of Firebug—perhaps some incompatibility causes warnings to be treated as errors, I’m not sure.)

  16. Paul-Brady commented on Jun 25, 2014

    @Paul-Brady

    @PaulBrinkley - it occurred on two machines - it appears to be an issue with the FF 30 update - when we did a full reinstall, the error did not reoccur - the existence of the TypeError warning could simply be a coincidence and not the cause.

  17. dzdrazil commented on Jul 16, 2014

    @dzdrazil

    I realize this is closed, but this post on Bugzilla adds some new context to the error, and it also explains where it's coming from:
    https://bugzilla.mozilla.org/show_bug.cgi?id=984146

    The culprit appears to be d3_subclass from core/subclass.js; since that code is itself a patch / hack, I'm not really sure what sort of resolution to expect- again, just trying to add some context.

  18. PaulBrinkley commented on Jul 16, 2014

    @PaulBrinkley

    Appreciate the update.

    In the interest of following up, I concur with JasonDavies - I'm still getting this "error" 3 weeks later, and it indeed does NOT appear to impede my development - things are going well enough despite it. (It's certainly not good to get it when you're new to d3 and trying to diagnose another mysterious problem, but at least it's a known warning and this thread is around to explain it.)

  19. fmarier commented on Oct 22, 2014

    @fmarier

    Out of curiosity, what change would you make if you could make use of ES6?

    I'm asking because I'm using D3 within the Lightbeam add-on and I could carry a small ES6-only patch in that environment.

  20. mbostock commented on Jan 12, 2015

    @mbostock
    Member

    ES6 supports extending arrays using the class syntax (class d3_Selection extends Array), so we’ll be able to use that instead of reassigning proto.

  21. crxgames commented on Jan 29, 2015

    @crxgames

    Can confirm this on Firefox 35.0 fresh install without plugins and with firebug/web developer toolbar.

  22. kornelski commented on Feb 21, 2015

    @kornelski

    Firefox 38.0a1 complains about:

    var d3_subclass = {}.__proto__ ? function(object, prototype) {
        object.__proto__ = prototype;
      }
  23. leninmehedy commented on Jan 8, 2016

    @leninmehedy

    Firefox38.5.2 complains about:

    var d3_subclass = {}.__proto__ ? function(object, prototype) {
        object.__proto__ = prototype;
      }
  24. mbostock commented on Jan 8, 2016

    @mbostock
    Member

    In D3 4.0, d3-selection no longer uses array subclassing, so there’s no Prototype modification warning.

  25. r0b- commented on Feb 13, 2016

    @r0b-

    Is there a chance to get a fix for version 3.x?

  26. mbostock commented on Feb 13, 2016

    @mbostock
    Member

    No, sorry.

  27. gabrielrtakeda commented on Apr 11, 2016

    @gabrielrtakeda

    Same with Firefox 45.0.2
    screen shot 2016-04-11 at 19 25 57

  28. shapovalovts commented on Apr 17, 2016

    @shapovalovts

    The same in FF 45.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions