Detecting ‘Complete Navigation’ properly

18 views
Skip to first unread message

David Regev

unread,
Jul 26, 2009, 3:00:17 AM7/26/09
to Noise (Firefox Extension)
I’m trying to detect when the focused tab completes loading, but I
can’t get it detected just right. I’ve tried both noise-WebProgress-
stop and DOMContentLoaded. The differences from my desired behaviour
are such:

1. I want the sound to play only when the current tab completes
loading, not background tabs. (Otherwise, it’s just confusing.)
2. I want the sound to play only when a page actually completes
loading, not when I have manually stopped it in the middle of loading.
3. The sound should never play when I open a new blank tab. I have
tried DOMContentLoaded&event.target.baseURI!='about:blank', but that
doesn’t work.

Incidentally, Navigational Sounds seems to have fewer problems with
the ‘Complete Navigation’ event.

What event should I use to avoid these problems?

Thank you.

bootleq

unread,
Jul 26, 2009, 6:34:42 AM7/26/09
to noise-firef...@googlegroups.com
Hi, I don't know if there's a simple way to do this. but you can try:
noise-WebProgress-stop&data==0&subject.originalURI.spec!='about:config'&&subject.originalURI.spec==gBrowser.currentURI.spec


2009/7/26 David Regev <david...@gmail.com>

David Regev

unread,
Jul 26, 2009, 4:38:58 PM7/26/09
to Noise (Firefox Extension)
Thanks for the quick response. However, I came across a bug with this
filter: not only does this prevent the sound from being played by an
unfocused tab, but it also prevents that tab from playing the sound if
I focus it before it finishes loading. Thus:

1. Middle-click a link to open it in a background tab (which means
that browser.tabs.loadInBackground must be set to 'true').
2. Switch to that tab before it finishes loading.
3. Let it finish loading.
Expected result: I hear the ‘complete navigation’ sound.
Actual result: I hear nothing.

Thank you.

bootleq

unread,
Jul 26, 2009, 11:46:14 PM7/26/09
to noise-firef...@googlegroups.com
After some test, I found that using "URI" instead of "originalURI" would be better:
noise-WebProgress-stop&data==0&subject.URI.spec!='about:config'&&subject.URI.spec==gBrowser.currentURI.spec

Hope it helps.

2009/7/27 David Regev <david...@gmail.com>

David Regev

unread,
Jul 27, 2009, 12:22:42 AM7/27/09
to Noise (Firefox Extension), bootleq
It may be more reliable now. I’m not sure. But my previous bug is
still there. Thank you for taking the time to figure this out. I
appreciate it.
Reply all
Reply to author
Forward
0 new messages