Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

onLocationChange for tabs that are not selected.

61 views
Skip to first unread message

John J. Barton

unread,
Nov 25, 2009, 11:13:14 AM11/25/09
to
In investigating a Firebug user's test case it looks like Firefox does
not deliver "onLocationChange" events to a tab if it is not selected.
This is Firebug's only why to know about reloaded pages. By design or a bug?

Test case is
https://fbug.googlecode.com/svn/tests/issues/ConsoleNotDefined.html
or

<html>
<body onload="javascript:onLoad();">
<script>
function onTimeout() {
location.reload(true);
}

function onLoad() {
if (console && typeof console.log == "function")
console.log("Hello world");
// switch to a different tab then allow the timer to expire.
// it will die with javascript error here.
// Next statement will never execute and
// the page will stop reloading! -- BUG
setTimeout(onTimeout, 3000);
}

</script>
</html>

jjb

Mike Beltzner

unread,
Nov 25, 2009, 1:15:03 PM11/25/09
to John J. Barton, dev-pl...@lists.mozilla.org
Either way, it would help immeasurably if you were to put that testcase in a bug and file it under Firefox::Tabbed Browser

cheers,
mike

> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

johnjbarton

unread,
Nov 25, 2009, 1:36:57 PM11/25/09
to
On Nov 25, 10:15 am, Mike Beltzner <beltz...@mozilla.com> wrote:
> Either way, it would help immeasurably if you were to put that testcase in a bug and file it under Firefox::Tabbed Browser
>
> cheers,
> mike
>
> On 2009-11-25, at 11:13 AM, John J. Barton wrote:
>
> > In investigating a Firebug user's test case it looks like Firefox does not deliver "onLocationChange" events to a tab if it is not selected. This is Firebug's only why to know about reloaded pages. By design or a bug?

If it is by design, then the bug is
Bug 342715 - Need an API to allow extensions to hook "document load
started" events

Firebug's current scheme for discovering nsIDOMWindows is very lame,
relying on lots of tracing of events and guess work. We know that our
event handlers break somethings and fail to get some cases.

We need to know when an nsIDOMWindow that can have JS/HTML/CSS is
created and when it is destroyed. We need the creation event so we can
create our per window 'context' object to hold data about the page and
so we can add hooks to fill the page's context. We need the destroy
event so we can save a bit of data about the state of firebug for that
page in case of reload or revisit and then clean up.

This bug is one of three that we want to push for Firefox 3.7 (Firebug
1.6 or 1.7). In addition to solving Firebug bugs, it would also make
Chromebug much simpler.

If on the other hand, onLocationChange is supposed to be sent, then I
will file a new bug.

jjb

Boris Zbarsky

unread,
Nov 25, 2009, 1:56:44 PM11/25/09
to
On 11/25/09 11:13 AM, John J. Barton wrote:
> In investigating a Firebug user's test case it looks like Firefox does
> not deliver "onLocationChange" events to a tab if it is not selected.
> This is Firebug's only why to know about reloaded pages. By design or a
> bug?

Core code certainly delivers onLocationChange on reload; if it somehow
doesn't that's a bug.

I can't speak for the tabbrowser.

Since John told me to hijack this thread, I will. Why exactly does
Firebug need an unload listener? Could it make do with a pagehide
listener plus notifications when things are evicted from bfcache? Does
it even handle bfcache navigation correctly right now, or is it simply
not an issue because it effectively disables bfcache at the moment?

-Boris

johnjbarton

unread,
Nov 25, 2009, 3:13:23 PM11/25/09
to
On Nov 25, 10:56 am, Boris Zbarsky <bzbar...@mit.edu> wrote:
> On 11/25/09 11:13 AM, John J. Barton wrote:
>
> > In investigating a Firebug user's test case it looks like Firefox does
> > not deliver "onLocationChange" events to a tab if it is not selected.
> > This is Firebug's only why to know about reloaded pages. By design or a
> > bug?
>
> Core code certainly delivers onLocationChange on reload; if it somehow
> doesn't that's a bug.
>
> I can't speak for the tabbrowser.

I suppose I should file a bug then, but it would be so much better for
us to invest in Bug 342715.

>
> Since John told me to hijack this thread, I will.  

(BTW I think the newsgroup server is napping today).

> Why exactly does
> Firebug need an unload listener?  

So Firebug knows when the page is no longer needed. It unhooks
listeners, saves some state on the side, and deletes it's primary
state for the page.

>Could it make do with a pagehide
> listener plus notifications when things are evicted from bfcache?  

We use pagehide but if the page sets a unload handler then pagehide
never fires.
See also Bug 484710 - add pageIgnore event for pages that are ejected
from the bfcache

>Does
> it even handle bfcache navigation correctly right now, or is it simply
> not an issue because it effectively disables bfcache at the moment?

We don't have any bugs related to this as far as I know. We have more
problems before the page gets to the bfcache, because we have to do
funky things to know when a page is created.

jjb

Neil

unread,
Nov 25, 2009, 6:33:00 PM11/25/09
to
John J. Barton wrote:

> In investigating a Firebug user's test case it looks like Firefox does
> not deliver "onLocationChange" events to a tab if it is not selected.

This is true if you attach your progress listener to the tabbrowser
itself, as the onLocationChange notification is the one that is used to
update the url bar and it would not make sense to send it for background
tabs.

On the other hand you can listen to the various tab creation and
destruction events and attach progress listeners to each tab's
individual browser.

--
Warning: May contain traces of nuts.

Dao

unread,
Nov 25, 2009, 6:50:42 PM11/25/09
to
On 26.11.2009 00:33, Neil wrote:
> On the other hand you can listen to the various tab creation and
> destruction events and attach progress listeners to each tab's
> individual browser.

Or use addTabsProgressListener.

0 new messages