Threaded HTML parser ASSERTs on Android

The parser is supposed to stop processing data when there's a pending location
change, but before this CL we would actually process the first token from every
chunk when there was a pending location change.

If the first token in a chunk was a "script" start tag, that would put the tree
builder into TextMode, which can only process character tokens. If the next
chunk starts with another start tag token, the tree builder would be sad and
hit an ASSERT.

This CL reorders a couple lines in HTMLDocumentParser so that we check for
pending location changes before processing any tokens. This change stops us
from processing the first token from each chunk while there is a pending
location change.

This issue can reproduce on any platform, but it reproduced often on Android
because mobile markup often elides spaces between consecutive script tags. If
there are space characters between the script tags, then those space characters
will be the first ones processes in the chunk, which doesn't trigger the ASSERT.

BUG=230542
R=eseidel@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@150065 bbb929c8-8fbe-4397-9dbb-9b2b20218538
4 files changed