Thanks, that's it. By the way this makes grouping (via console group (), groupEnd()) unusable for async callbacks because even if groupCollapsed and groupEnd are in the same function, results from two async callbacks can be "nested", which is definitely not the desired behavior, because you don't know whether something didn't happend or whether it's just hidden in some other group. I even had a situation where 7 consecutive collapsed groups were nested. I think you can imagine how much messed up was this log.
On 11 pro, 17:22, John J Barton <[email protected]> wrote: > On Dec 11, 12:37 am, Franta Řezáč <[email protected]> > wrote: > > > > > Ok, I should make this more precise. > > > function callbackFoo() { > > console.debug("message A"); > > someStuff... > > console.debug("message B");} > > > function callbackBar() { > > console.debug("message C"); > > someStuff... > > console.debug("message D"); > > > } > > > Now in my console sometimes appears: > > message A > > message C > > message B > > message D > > > This should never ever happen in javascript, even when using XHR and > > I'm trying to find out why it's happening. I just wanted to exclude > > the possibility ofparallelexecution. Now it's clear that problem is > > in my code, but I can't imagine anything that could cause those > > results. Maybe some exceptions in someStuff followed by new function > > call and something... > > Firebug queues console output via setTimeout(). So the above results > can be explained by > push A, yield > push B, yield > push C, yield > push D, yield > if in fact A and C are running on async callbacks. > > > > > On Dec 10, 6:42 pm, John J Barton <[email protected]> wrote: > > > > On Dec 10, 6:41 am, Franta Řezáč <[email protected]> > > > wrote: > > > > > Hi, > > > > I have a very strange problem when using console.log() and related > > > > functions. Shortly, logging messages from my two different functions > > > > gets mixed up in console. I don't know, whether those functions are > > > > executed as deferred, since it's executed by some library and I > > > > haven't invested time to inspect it deeper, but when I turn off > > > > firebug and implement console object myself, writing the logging > > > > output into some tag, messages are displayed in correct order. Also > > > > when I put break points at the beginning of that functions, it's ok > > > > although I just pass it on when program hits that breakpoint. > > > > > Is it possible that call to console.*() gets executed in another > > > > thread, allowing execution of deferred function in the original > > > > thread? It's crazy, but I don't have other explanation. > > > > No, console.log displays on the main thread. Based on what you > > > describe here I think the most likely explanation is that your library > > > is using XHR asynchronous handler. The order of execution of the async > > > handlers will depend on I/O load. When you use Firebug console you get > > > a different load than when you do something different. > > > > If this is the case, then both your results and the results from > > > firebug are equally correct. There is no correct order in an > > > asynchronous system. > > > > If you had a test case we could verify this, but that is my guess. > > > > jjb -- You received this message because you are subscribed to the Google Groups "Firebug" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/firebug?hl=en.
