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.

The order of callbacks in FrameLoader are now:
1. didInstallNewDocument
2. receivedFirstData
3. didBeginDocument

BUG=232410

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

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