| Index: Source/core/fetch/ResourceFetcher.cpp
|
| diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
|
| index 14b6167d7ac605ee120b0e6ec91fb4df30c8e04b..7353742b76fae1369c72b9d24af2c9352fd291cf 100644
|
| --- a/Source/core/fetch/ResourceFetcher.cpp
|
| +++ b/Source/core/fetch/ResourceFetcher.cpp
|
| @@ -119,11 +119,22 @@ static ResourceLoadPriority loadPriority(Resource::Type type, const FetchRequest
|
| switch (type) {
|
| case Resource::MainResource:
|
| return ResourceLoadPriorityVeryHigh;
|
| - case Resource::CSSStyleSheet:
|
| - return ResourceLoadPriorityHigh;
|
| case Resource::Raw:
|
| return request.options().synchronousPolicy == RequestSynchronously ? ResourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium;
|
| + case Resource::CSSStyleSheet:
|
| case Resource::Script:
|
| + // CSS and Script get the same treatment and priority levels so we load them in order
|
| + // and they can block each other's parsing/execution (with the exception of async scripts).
|
| + // Async scripts do not block the parser so they get the lowest priority and can be
|
| + // loaded in parser order with images.
|
| + if (type == Resource::Script && request.execAsync())
|
| + return ResourceLoadPriorityVeryLow;
|
| + // Scripts or CSS discovered by the preload scanner that are not in the head get a low priority
|
| + // so they do not load while we are loading the layout-blocking resources but still load
|
| + // at a higher priority than images since they block the main parser.
|
| + if (request.forPreload() && !request.isBeforeBody())
|
| + return ResourceLoadPriorityLow;
|
| + return ResourceLoadPriorityMedium;
|
| case Resource::Font:
|
| case Resource::ImportResource:
|
| return ResourceLoadPriorityMedium;
|
|
|