Commit 85b03d5d authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

ES6 Modules: Make module scripts fetched at High priority

Before this patch, module scripts were fetched at Low priority, like
as classic async / deferred scripts. But this may not be a good default,
since module scripts tend to have many sub module scripts and fetching
them all at low priority may be too slow. (See the listed bug for more
on the discussion.)

This patch changes the fetch priority of module scripts to High (same
as classic scripts without async / defer). This applies to all module
fetches, includes dynamic import.

Bug: 769151
Change-Id: I24aa22a886e8394969447785eaf1fe0ab2eea818
Reviewed-on: https://chromium-review.googlesource.com/701937Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506685}
parent 305e93de
......@@ -126,8 +126,11 @@ void ModuleScriptLoader::Fetch(const ModuleScriptFetchRequest& module_request,
fetch_params.SetCrossOriginAccessControl(modulator_->GetSecurityOrigin(),
module_request.CredentialsMode());
// Module scripts are always async.
// Module scripts are always defer.
fetch_params.SetDefer(FetchParameters::kLazyLoad);
// [nospec] Unlike defer/async classic scripts, module scripts are fetched at
// High priority.
fetch_params.MutableResourceRequest().SetPriority(kResourceLoadPriorityHigh);
// Use UTF-8, according to Step 8:
// "Let source text be the result of UTF-8 decoding response's body."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment