FrameLoader does many things. One of its core responsibilities is to switch around m_documentLoader, m_provisionalDocumentLoader, and m_policyDocumentLoader. Unlike my previous patches (which moved "front-end" code out of FrameLoader), this patch will move "back-end" code out of FrameLoader.
DocumentSwitcher is intended to encapsulate write access to the document loaders as well as m_state, as distinct from the various load* methods of FrameLoader (which are closer to the front of the loading pipeline).
Created attachment 52266 [details]
Work in progress (does not compile)
I love it! But can you move it to a new file.
Created attachment 52588 [details]
More work in progress
I realized that m_loadType should move back to FrameLoader. Turns out FrameLoader is very complicated.