Debugging the unload event

1,804 views
Skip to first unread message

stefanw

unread,
Jul 20, 2009, 7:50:19 PM7/20/09
to Firebug
Is there a way to use Firebug to debug the window's unload event? Some
libraries have a lot of cleanup scheduled for unload, and I'm finding
it hard to see what's going on. There are two things that could help,
but I don't know if Firebug supports either of them or how to activate
them:

- an option not to clear the console log when a new page is loaded
- an option to send log messages to a file

Any suggestions would be appreciated.
Thanks in advance,

Stefan

johnjbarton

unread,
Jul 20, 2009, 8:51:11 PM7/20/09
to Firebug


On Jul 20, 4:50 pm, stefanw <we...@foo.at> wrote:
> Is there a way to use Firebug to debug the window's unload event? Some
> libraries have a lot of cleanup scheduled for unload, and I'm finding
> it hard to see what's going on. There are two things that could help,
> but I don't know if Firebug supports either of them or how to activate
> them:
>

Have you tried setting a breakpoint in the unload handler?

> - an option not to clear the console log when a new page is loaded

This is often requested, I guess we ask Firefox team about this. I
know it sounds easy, but the sequence of event is like this:

User request reload (Firebug does not know this).
Web page is deleted. Firebug cleans up.
Web page is loaded. Firebug starts up.

So we don't know that the load is a reload. If we don't clear the
console when the page is deleted, then when do we?

Stefan Weiss

unread,
Jul 20, 2009, 11:26:54 PM7/20/09
to fir...@googlegroups.com
Thanks for the reply.

On 21/07/09 02:51, johnjbarton wrote:
> On Jul 20, 4:50 pm, stefanw <we...@foo.at> wrote:
>> Is there a way to use Firebug to debug the window's unload event? Some
>> libraries have a lot of cleanup scheduled for unload, and I'm finding
>> it hard to see what's going on. There are two things that could help,
>> but I don't know if Firebug supports either of them or how to activate
>> them:
>
> Have you tried setting a breakpoint in the unload handler?

Yes, and it works well if you know where to look, but I think it would
also be handy to have kind of log file over the last few requests.

>> - an option not to clear the console log when a new page is loaded
>
> This is often requested, I guess we ask Firefox team about this. I
> know it sounds easy, but the sequence of event is like this:
>
> User request reload (Firebug does not know this).
> Web page is deleted. Firebug cleans up.
> Web page is loaded. Firebug starts up.

Ah. I thought that Firebug persisted between requests (at least the
extension's window does, when it's detached). I wouldn't presume to
suggest that this was an easy change - I hardly know anything about the
Firebug internals.

> So we don't know that the load is a reload.

It wouldn't have to be a reload, a persistent log would also be helpful
during normal navigation. Coming from the server side, I'm used to
having log files running in a terminal all the time, and I often miss
them when I'm doing client-side JS development.
I haven't played around with Firebug's source code yet, so I don't know
how much work such a feature would be... It seems to me (from an
outsider's point of view) that a minimal solution could be to make
Firebug observable - meaning that it would fire events when the
console's contents change. This way, a script in a separate window could
attach itself to Firebug and listen to these events, and then choose to
ignore any 'clear' events. Just a thought.

> If we don't clear the console when the page is deleted, then when do we?

Ideally, when the Firebug user deactivates the hypothetical "persist
messages" option again :-) Don't know if that's feasible, though.


regards,
stefan

--
LOAD"Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!",8,1
RUN!

johnjbarton

unread,
Jul 20, 2009, 11:50:07 PM7/20/09
to Firebug
Well, if you run the tracing version, 1.4X or 1.5X, with option
CONSOLE you should get some crude trace.

See http://groups.google.com/group/firebug/web/faq-about-firebug

Plus you can always use window.dump().

The Console is a DIV element in an HTML page. Each web page has a
separate Console. So we could merge the output from all pages and not
clear it.

jjb

sir_brizz

unread,
Jul 21, 2009, 1:17:11 AM7/21/09
to Firebug


On Jul 20, 6:51 pm, johnjbarton <johnjbar...@johnjbarton.com> wrote:
> On Jul 20, 4:50 pm, stefanw <we...@foo.at> wrote:
>
> > - an option not to clear the console log when a new page is loaded
>
> This is often requested, I guess we ask Firefox team about this. I
> know it sounds easy, but the sequence of event is like this:
>
> User request reload (Firebug does not know this).
> Web page is deleted. Firebug cleans up.
> Web page is loaded. Firebug starts up.
>
> So we don't know that the load is a reload.  If we don't clear the
> console when the page is deleted, then when do we?
>

Yuck! Any way this can be closer to the Safari/WebKit Activity window
would be good, IMO (at least for the net tab, but possibly for the
console as well). It could just be an option to "Keep x number of page
activity" and have firebug with some internal counter for that or
something. Make clearing the console/net tab manual or something else.
I know a lot of people ask to be able to see information across page
loads and WebKit does that better than just about anyone else, it's
one area where WebKit's internal system far surpasses Firebug.

johnjbarton

unread,
Jul 21, 2009, 1:57:21 AM7/21/09
to Firebug


On Jul 20, 10:17 pm, sir_brizz <bj.car...@gmail.com> wrote:
...
> something. Make clearing the console/net tab manual or something else.
> I know a lot of people ask to be able to see information across page
> loads and

As I keep trying to say in different ways: The console tab you see is
an illusion, there is a separate data structure for every page. So
there is no such thing as "clearing the console tab". There is only
"clearing the web page's console tab". So to create the illusion of a
console tab that is not cleared we need to match up a page with its
reloaded page.

>WebKit does that better than just about anyone else, it's
> one area where WebKit's internal system far surpasses Firebug.

So how does webkit seem to "know" about reloads? or is console output
from all of the pages merged?

jjb
Reply all
Reply to author
Forward
0 new messages