DOMWindow should obtain the Frame via its Document Requested by abarth on #webkit.
This is worth doing, but I'm removing it from Bug 75793 because this is going to be a bit delicate because some of the DOMWindow functions need to "forward to the outer window" (which is Mozilla parlance for "continue to work in detached DOMWindows).
Ideally, when a Frame navigates to a new Document, we'd like to sever all pointers back from the Document to the Frame so that we don't accidentally give the old Document access to objects that belong to the new Document. We've been largely successful at zeroing out all the pointers, but one pointer remains: DOMWindow::m_frame. The goal of this bug is to zero out that pointer when the Document detaches from the Frame. More specifically, we'd like to remove that pointer and have DOMWindow find the frame via DOMWinndow->document()->frame(), which is already zeroed out appropriately. The complication here is that some functions of DOMWindow might still need to work (i.e., access resources associated with the Frame) after the Document becomes detached from the Frame. In Mozilla, some of the DOMWindow functions are marked as "forwarding to outer Window", and they actually do this indirecting in their bindings layer. To fix this bug, we need to figure out how to deal with these functions.
*** Bug 77537 has been marked as a duplicate of this bug. ***