[whatwg] Session history and discarding of Documents

Andrew Oakley andrew at ado.is-a-geek.net
Mon Jul 29 07:49:37 PDT 2013

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)

The "joint session history" now contains (elements in parenthesis are
removed because they are "current entries in their respective session
(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.


Andrew Oakley

Andrew Oakley

More information about the whatwg mailing list