[Import Maps] Always consider "importmap" valid in IsValidScriptTypeAndLanguage
Previously, ScriptLoader::IsValidScriptTypeAndLanguage() returns false for "importmap" type if import maps are not enabled. However, when import maps can be enabled via origin trials, checking whether import maps are enabled requires ExecutionContext, which is not trivial in IsValidScriptTypeAndLanguage(), especially because it is called from HTMLTreeBuilderSimulator used by background parsers. Therefore, this CL removes the check and makes "importmap" always valid in IsValidScriptTypeAndLanguage(). Instead, import maps are ignored subsequently in PrepareScript() (in ParseAndRegisterImportMap()). There are slight behavior changes that are probably acceptable as these affects only pages with <script type="importmap"> on browsers where import maps are not enabled. - UseCounter in HTMLScriptElement::InsertedInto() - HTMLTreeBuilderSimulator considers <script type="importmap"> always as kValidScriptStart. - In PrepareScript(), <script type="importmap"> is rejected slightly later. Bug: 829084 Change-Id: Iebdfe158ecebee4c310ffca88fd77f3133856035 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1502000 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by:Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#637913}
Showing
Please register or sign in to comment