Skip to content
Browse files

Be more precise about nested and discarded browsing contexts

This commit tries to clear up some of the confusion in the current spec
around nested and discarded browsing contexts, and how they impact the
processing model.

First, many of the definitions in the "nested browsing context" section
are rephrased for clarity. Per #1180, the term "nested browsing context"
itself becomes a field of a "browsing context container". The field has
values of either a browsing context, or null. Then, all algorithms which
refer to a browsing context container's nested browsing context are
explicitly updated to account for the null case. In particular, this
makes it clearer that when a browsing context is discarded, the
associated browsing context container has its nested browsing context
set to null.

Then, we make a normative change to make window.{top, parent,
frameElement} all return null when their associated browsing context has
been discarded. As discussed in #1279, browser behavior here varies
extensively, but nobody seems to follow the current spec at all, so we
went with the 2/4 majority of returning null. A test case is at We
add an example to the spec to make the intended behavior clear.

We also make the normative change that documents in discarded browsing
contexts (i.e. documents belonging to iframe windows when the iframe has
been removed from the document) have no browsing context. This may have
been the intention of the spec previously, but a strict reading did not
support it. Regardless, all user agents seem to agree on this point, as
seen by how defaultView no longer returns the WindowProxy in, and
how fetches do not happen and script is not executed in (They
differ in the particulars due to bugs, e.g. some return undefined when
they should return null, and Edge seems to keep the Location object
around and to give strange errors when accessing defaultView.)

Along the way, this clarifies some of the garbage collection behavior
and includes a number of editorial tweaks, notably including the
movement of the definition of "associated Document" to the Window
object's section, and uniformizing all references to it. (They were
previously a hodgepodge of "associated Document", "newest Document",
and "window's Document object".)

Fixes #1180. Fixes #1279.
  • Loading branch information...
domenic committed Jul 20, 2016
1 parent 8259a69 commit 39118df640ad4a3f03f164fb5ffe0a56316297be
Showing with 319 additions and 205 deletions.
  1. +319 −205 source
Oops, something went wrong.

0 comments on commit 39118df

Please sign in to comment.
You can’t perform that action at this time.