Circular console.log() output

Posted on
  • Hi All,

    When printing "this" with the console.log(function), the WebIDE freezes and the espruino has to be restarted. This is due to circular output. Example showing this:

    function foo() {
      this.bar = new Bar(this);
      console.log(this);
    }
    
    function Bar( fooThis ) {
       this.fooThis = fooThis; 
    }
    
    var f = new foo();
    
    

    Could this be detected in order to easily read out the this and stop WebIDE from freezing?

    Thanks!

    Alex

  • You're not having a good day for finding issues with Espruino!

    It's implemented in the trace command and I was sure it was in the JSON output - I know JSON got re-done some time ago, so maybe support got removed at that point. It'll be fixed in 1v64

  • One could argue I'm having a very good day when it comes to bug hunting :). Main reason probably is that I develop for pcs, and then port to espruino, which is what I did today (hence the silence ;)).

    Thanks again for the quick reply :) and keep up the great work!

  • If you wait an hour and then go to http://www.espruino.com/binaries/git/com­mits/c9bef247f458aff15aa8c20f98d2fccda4b­63620 the automatic build should have made an Espruino image. It'll have this fixed, String.indexOf fixed, and String.slice added.

  • Hi Gordon,

    Thank you very much! I'm out of the office at the moment (done for the day:)) so I'll check the link tomorrow!

    It's great to see espruino getting better and better with every forum post!

  • No problem! Thanks for reporting the bugs with an easy way to reproduce them - it makes my life so much easier!

  • Hi Gordon,

    I tried the build above but the red and blue led were glowing weakly afterwards, and I could not connect to the board anymore.

    I'll stick with 1.63 until 1.64 is released.

    Regards,

    Alex

  • Strange. Not sure what happened, but I just tried that link and it works fine. You need to click on it, then right click on espruino_1v64_espruino_1r3.bin on that page, copy the link and paste it into the 'Advanced Firmware Flash' box.

  • Hi Gordon,

    Ah I see, I just copied the entire link, my bad.

    Regards,

    Alex

  • So... you put the link he posted into advanced firmware update...
    But it was pointed at a directory instead of the firmware image.
    Yet it flashed something... Did it flash the directory listing as if it were a firmware?

  • It might, it said it succeeded the flashing... I downloaded the bin file to browse to it but then it said URL so I figured, must look for the right one automatically from a default layout or whatever.

  • Interesting - there should probably be a check in for that. There's no CRC in the binary so it's hard to tell. It could just do a sanity check on the file size I guess.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Circular console.log() output

Posted by Avatar for Alex @Alex

Actions