[whatwg] Session history and discarding of Documents

Ian Hickson ian at hixie.ch
Mon Jul 29 17:48:51 PDT 2013


On Mon, 29 Jul 2013, Andrew Oakley wrote:
>
> As far as I can tell when the user agent discards a Document in the 
> session history may change the contents of the history.  This seems 
> wrong to me because it makes non-deterministic visible to scripting.
> 
> The scenario that I'm thinking of is:
> "index" has a frame that is navigated to:
> 	"container" which has a frame that is navigated to:
> 		"page1" (default using src=page1)
> 		"page2"
> 
> The "joint session history" now contains (elements in parenthesis are
> removed because they are "current entries in their respective session
> histories"):
> (index) (container) page1 page2
> 
> If "container" is now navigated to "empty" we get this:
> (index) container empty
> 
> Now if we go back() and the Document for "container" has not been
> discarded and therefore the nested browsing context exists we get page2
> visible in the frame and this joint session history:
> (index) (container) page1 page2 empty
> 
> If the Document for "container" had been discarded then the nested
> browsing context and it's session history is discarded.  This means that
> page1 is visible in the frame and we get this joint session history:
> (index) (container) page1 empty
> 
> Apologies if the above description is confusing, it's rather difficult 
> to describe.
> 
> I have not managed to find a way to get desktop browsers to actually 
> discard the Document for "container", I'm guessing there is some sort of 
> heuristic based on memory available.  In a memory-constrained 
> environment a browser may wish to destroy the Document's fairly quickly 
> and I expect to see the second behaviour.
> 
> Have I missed something or misunderstood the spec here?  As far as I can 
> tell there is actually no requirement to maintain session history for 
> any nested browsing context that belongs to a document which is not 
> active but the major browser do.

I believe your description is correct.

There's not much we can do about it. We can't require that UAs remember 
everything, since on some devices (e.g. mobile phones) even the browser 
itself might get discarded if the user even so much as glances away. We 
can't require that the UAs forget everything as soon as possible, because 
remembering things is viewed as a massive performance benefit by some 
browser vendors, and they won't stop doing it, since they believe it 
brings them a competitive advantage. (I'm not making judgements on whether 
they're right or wrong; vendors disagree on this, which is why I'm 
couching my response in these terms.)

Thus the current unfortunate situation.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list