Only flush tokenized chunks to the HTML parser for valid script types.
Having a large amount of <script> tags on a page with an invalid type for execution (e.g. text/html) triggers the same path for event loop yielding as JavaScript tags, causing slowness due to parser yields and unnecessarily aggressive chunking. Avoid performing this logic if the ScriptLoader can't recognize the script type. This reduces the amount of time it takes for DOMContentLoaded in the script attachment for issue 873648 from 367ms to 208ms, similar to the div attachment's 209ms. R=kouhei@chromium.org Bug: 873648 Change-Id: I4c7ea76feb2034f5ff97fe08b481c790b9a35122 Reviewed-on: https://chromium-review.googlesource.com/1247230Reviewed-by:Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#595719}
Showing
Please register or sign in to comment