Document::prepareForDestruction Frame Caching Vulnerability
Document::prepareForDestruction is called on the assumption that the document will not be used again with its frame. However, if a frame caching is made in Document::prepareForDestruction, the document's frame will be stored in a CachedFrame object that will reattach the frame at some point, and thereafter, the document's frame will be never detached due to |m_hasPreparedForDestruction|. The PoC code creates a new window and an iframe in it. The iframe is then navigated to about:blank and a click event is triggered on an anchor element. This triggers the onunload event of the iframe, which is used to set the location of the window to a javascript URI. This causes the window to execute the javascript code, which sets the location of the window to a malicious website. This exploit can be used to bypass the same-origin policy and execute arbitrary code on the victim's machine.