> Subsequent navigations, return the previous context (the one about to
> be destroyed.)  The framework calls initContext() after the initial
> request.
Yes, this very confusing piece in Firebug. Unfortunately I don't
knowhow to improve that. I have tried that the other day, but gave up,
we need more support from Firefox here:
I think following bugs are directly related:
https://bugzilla.mozilla.org/show_bug.cgi?id=391177
https://bugzilla.mozilla.org/show_bug.cgi?id=342715

The biggest problem here is the tabWatcher.js that is creating the
context (using tabContext.js) too late.

So, at the time when http-on-modify-request event is fired, the
current window is still associated with a context (which is, as you
saying the previous one).

See my logs (shortened) showing order of important events (copied from
tracing-console, generated by my helper monitor extension). These logs
have been generated when I went from 
http://www.softwareishard.com/blog/index.php/blog/index.php
to http://www.google.cz/ page.

httpObserver.observe http-on-modify-request, http://www.google.cz/
httpObserver.observe http-on-examine-response, http://www.google.cz/
MonitorModel.unwatchWindow: 
http://www.softwareishard.com/blog/index.php/blog/index.php
MonitorModel.destroyContext for: http://www.softwareishard.com/blog/index.php
MonitorModel.initContext for: http://www.google.cz/
MonitorModel.watchWindow: http://www.google.cz/
httpObserver.observe http-on-modify-request,
http://www.google.cz/intl/en_com/images/logo_plain.png
httpObserver.observe http-on-modify-request,
http://www.google.cz/extern_js/f/CgJjcxICY3orMAo4CywrMBg4Ayw/7xn1JbUoKiE.js
MonitorModel.loadedContext for: http://www.google.cz/
MonitorModel.showPanel: net
etc...

You can clearly see that the previous context (softwareishard.com) is
destroyed *after* the new page (google.cz) started to load. Also the
new context is initialized (initContext) after the http-on-* events.
All the other page requests (logo_plain.png, etc.) are done properly
when the new context (google.cz) is ready to be used. But the first
document request is done to early.

This explains why:
var win = getWindowForRequest(subject);
var context = TabWatcher.getContextByWindow(win);
returns the about:blank (I believe it was the previous page, perhaps
when you started FF) if it's used within onModifyRequest. Yes there is
still the previous context.

Of course, you can do the same as Firebug. In order to monitor (and
store) all requests made by a page, the net panel is creating
temporary context within onModifyRequest (http-on-modify-request
handler) method. This temp context is created for the first document
request and all info stored into it is merged with real context in
initContext.

See net.js for more info how it's done.
http://code.google.com/p/fbug/source/browse/branches/firebug1.4/content/firebug/net.js

I have used the same for Firecookie (this code could be perhaps easier
to explore)
http://code.google.com/p/firecookie/source/browse/trunk/chrome/content/firecookie/fireCookie.js

I welcome any suggestions and improvements!

Honza

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to