Reland of DocumentLoader should commit the load before creating a DocumentWriter

The current order of events in DocumentLoader causes an HTML parser to be created via DocumentWriter::create before the load commits. This causes the HTML parser to read a stale value for scriptEnabled setting in HTMLParserOptions if the setting changes between page loads. This in turn breaks the rendering of noscript tags.

This CL moves receivedFirstData call before DocumentWriter::create and FrameLoader::didBeginDocument so that the load is committed before the HTML parser is created and the correct scriptEnabled value is used by the parser. It also moves creation of Content Security Policy and setting saved form data to a new callback didInstallNewDocument.

NOTE: This also changes the order of callbacks in WebFrameClient.
The OLD order when loading a document was:
1. didStartProvisionalLoad
2. didCreateNewDocument
3. didCommitProvisionalLoad
4. didCreateDocumentElement

The NEW order is:
1. didStartProvisionalLoad
2. didCommitProvisionalLoad
3. didCreateNewDocument
4. didCreateDocumentElement

BUG=232410
TBR=jochen,dcheng

Review URL: https://codereview.chromium.org/1910153002

Cr-Commit-Position: refs/heads/master@{#388944}
5 files changed