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 of parallel execution. 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...
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.