Changes

Jump to: navigation, search

Browser History:Redirects

990 bytes added, 21:42, 14 December 2005
Added review
The state change firing notifies all WebProgressListeners that have been attached to the DocLoader. The DocShell, which is derived from the DocLoader, is registered as an event listener itself. Then we get the OnStateChange event with the <i>source</i> channel (no information is available about the new destination channel or URI), which checks the STATE_IS_DOCUMENT and STATE_REDIRECTING flags. When these flags are set, it calls AddToGlobalHistory with a redirect flag of true.
=== Proposal 1 ===
Add a virtual function to nsDocLoader "OnRedirectStateChange". This function would be called manually from OnChannelRedirect will full information on the source and destionation channels. DocShell will provide an implementation of this function, and we can move the redirect handling code from OnStateChange to there.
This redirect function would attempt to QueryInterface the global history to a new interface we define (let's call it nsIGlobalHistory3 for now). If unsuccessful, it would revert to calling the old nsIGlobalHistory2.AddURI. Otherwise, it would call nsIGlobalHistory3.AddURIFrom and give it information about the redirect and a pointer to the docshell.
 
The "regular" calls to AddURI would also be changed to use the new AddURIFrom function.
 
 
The history system would treat these docshell pointers as opaque identifiers in a hashtable for associating some state with. This state would include the typed and bookmarked information as discussed above, as well as the visit ID of the previous page from the docshell. This way, we can tell when we get new notificaions exactly which visit was the source.
 
In Docshell::Destroy, the global observer notification NS_WEBNAVIGATION_DESTROY is sent with a pointer to the docshell. The history service can observer these events and know to delete the corresponding state.
 
Review of changes in old code:
 
* New nsIGlobalHistory3 interface defined in toolkit.
 
* New virtual function in docloader.
 
* Move redirect code from OnStateChange to new function in docshell.
 
* Change docshell AddToGlobalHistory to use the new AddURIFrom if it is available.
 
* Implement nsIWritablePropertyBag in the docshell
202
edits

Navigation menu