DOMWindow should be owned by the Document, not the Frame
Created attachment 157576 [details] work in progress
In this patch, I'm going to keep the same lifetime for all the objects and just move the owning reference from Frame to Document.
Created attachment 157600 [details] still crashes a lot :)
Created attachment 157702 [details] crashes less
Created attachment 157831 [details] maybe, possibly, works
Created attachment 158142 [details] another approach
Ok, it looks like it's much easier to fix Bug 27640 at the same time as this bug. *** This bug has been marked as a duplicate of bug 27640 ***