erroneous calls to onStateChange ProgressListener

UNCONFIRMED
Unassigned

Status

()

Core
Document Navigation
UNCONFIRMED
6 years ago
6 years ago

People

(Reporter: Ronen Zilberman, Unassigned)

Tracking

6 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Build ID: 20110902133214

Steps to reproduce:

There seems to be erroneous calls to the onStateChange ProgressListener, atleast with regards to the documentation here: https://developer.mozilla.org/en/nsIWebProgressListener

I installed a progress listener like this:
gBrowser.addTabsProgressListener(progressListener);      

and the onstate function code is:
  onStateChange: function(aBrowser, aWebProgress, aRequest, aFlag, aStatus) {
	var url = null;
	if (aRequest && aRequest.URI) url = aRequest.URI.spec;
        var flags = ... string representation of aFlag...;
        dump("state change: (" + aFlag.toString(16) + "="  + flags +") url = " + url);	
   }


I encounter a URL that behaves strangely but (not intense) debugging didn't pinpoint the exact culprit, as other websites behave normally.

------

Another issue is that for some reason the calling log changes when I use the Fiddler web proxy. (http://www.fiddler2.com/). As you can imagine, this was quite tricky as I use it as a debug tool. I can't imagine how or why it would cause a change in firefox internal behavior. 

----------
All the bevaiours are consistant and repeatable.
UA string: User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2



Actual results:

URL: http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
(no fiddler)

----- START LOG
1 state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
2 state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
3 state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
4 state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.facebook.com/plugins/like.php?api_key=89186614300&channel_url=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D3%23cb%3Df7d2ff873ddf4c%26origin%3Dhttp%253A%252F%252Fwww.etsy.com%252Ff32c571a0947f82%26relation%3Dparent.parent%26transport%3Dpostmessage&extended_social_context=false&href=http%253A%252F%252Fwww.etsy.com%252Fshop%252Fjessjamesjake&layout=button_count&locale=en_US&node_type=link&sdk=joey&show_faces=false&width=90
5 state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
6 state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.facebook.com/plugins/like.php?api_key=89186614300&channel_url=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D3%23cb%3Df7d2ff873ddf4c%26origin%3Dhttp%253A%252F%252Fwww.etsy.com%252Ff32c571a0947f82%26relation%3Dparent.parent%26transport%3Dpostmessage&extended_social_context=false&href=http%253A%252F%252Fwww.etsy.com%252Fshop%252Fjessjamesjake&layout=button_count&locale=en_US&node_type=link&sdk=joey&show_faces=false&width=90
7 state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
8 state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
9 state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://static.ak.fbcdn.net/connect/xd_proxy.php?version=3#cb=f7d2ff873ddf4c&origin=http%3A%2F%2Fwww.etsy.com%2Ff32c571a0947f82&relation=parent.parent&transport=postmessage&type=resize&height=20&ackData[id]=1&width=90
10 state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://static.ak.fbcdn.net/connect/xd_proxy.php?version=3#cb=f7d2ff873ddf4c&origin=http%3A%2F%2Fwww.etsy.com%2Ff32c571a0947f82&relation=parent.parent&transport=postmessage&type=resize&height=20&ackData[id]=1&width=90
11 state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = null
12 state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = null

END LOG

There are many things wrong here:
- calls to about:blank
- some internal (iframe/ajax) calls seen as document calls
-----------------------------------------------------------

----- START LOG
URL: http://www.x.com
(WITH fiddler)

state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = https://www.x.com/
state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = https://www.x.com/

---- END LOG

This is just any random website.
Here you can see that the last call (STATE_IS_REQUEST) is missing.
-----------------------------------------------

URL: http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
(WITH fiddler)

----- START LOG
state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.etsy.com/shop/jessjamesjake?ref=fp_treasury_12
state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = http://static.ak.fbcdn.net/rsrc.php/v1/yN/r/l2tJ1_sR57H.css
state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = about:blank
state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://static.ak.fbcdn.net/connect/xd_proxy.php?version=3#cb=f8535fc2346b68&origin=http%3A%2F%2Fwww.etsy.com%2Ff1679af3b32ac66&relation=parent.parent&transport=postmessage&type=resize&height=20&ackData[id]=1&width=90
state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://static.ak.fbcdn.net/connect/xd_proxy.php?version=3#cb=f8535fc2346b68&origin=http%3A%2F%2Fwww.etsy.com%2Ff1679af3b32ac66&relation=parent.parent&transport=postmessage&type=resize&height=20&ackData[id]=1&width=90
state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = null
state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = null

--- END LOG

The behavior changes. Can't make sense of how.
------------------------------------------------------------------------







Expected results:

Here is a call log for x.com with no fiddler (i.e normal behaviour)

---- START LOG
state change: (f0001=STATE_START STATE_IS_REQUEST STATE_IS_DOCUMENT STATE_IS_NETWORK STATE_IS_WINDOW ) url = http://www.x.com/
state change: (c0010=STATE_STOP STATE_IS_NETWORK STATE_IS_WINDOW ) url = https://www.x.com/
state change: (10010=STATE_STOP STATE_IS_REQUEST ) url = null
---- END LOG


Even here there are some errors with regards to the documentation:
1. The order of the STATE_STOP calls are reversed.
2. the call that has STATE_IS_REQUEST does not have STATE_IS_DOCUMENT.



part of from said documention:
"when a document request completes, two onStateChange() calls with STATE_STOP are generated. The document request is passed as aRequest to both calls. The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag set as well -- see above for a description of when the STATE_IS_NETWORK flag may be set). This second STATE_STOP event may be useful as a way to partition the work that occurs when a document request completes.
"

Updated

6 years ago
Component: Location Bar → Document Navigation
Product: Firefox → Core
QA Contact: location.bar → docshell
(Reporter)

Comment 1

6 years ago
The additional calls are for iframe start and stop. However other pages with iframes do not show this behaviour.
Also the STATE_STOP + STATE_IS_REQUEST is called twice, with a NULL aRequest.URI.
Would you test your progress listener with <browser/> instead of <tabbrowser/>? We are filtering out some onStateChange calls for <tabbrowser/>, if the total number of requests are more than 1.
You need to log in before you can comment on or make changes to this bug.