[Webkit-unassigned] [Bug 35801] console.log object maps are read when you open the treeview on the console, not when they're output in the console

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 27 04:09:30 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=35801


Rohit Banga <iamrohitbanga at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamrohitbanga at gmail.com




--- Comment #11 from Rohit Banga <iamrohitbanga at gmail.com>  2012-07-27 04:09:33 PST ---
I saw a problem today which I suspect is related to this bug.

   eventHandler1: function(arr) {
      this.mainArr.push(arr);
      console.log(this.mainArr);    // prints correct array
   }

   eventHandler2: function() {
      console.log(this.mainArr);    // prints [undefined x 1]    ... WAT!!!
      var arr = this.mainArr.pop();
      // use and get rid of arr
   }


eventHandler2 is invoked a few seconds after eventHandler1.
Because of the pop() call the value of mainArr is printed as [undefined x 1] in eventHandler2. If I just comment the call to pop() then the value is printed correctly. It seems console.log() is resolving the reference after it has been GC'ed.

I also tried to invoke eventHandler2 immediately after eventHandler1 and managed to generate [undefined x 1] for both console.log() statements. So I would vaguely describe it as a race condition between GC and console renderer.

PS: Its 4 in the morning and I am too lazy to write a jsfiddle.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list