Commit 7ff73bd5 authored by Sophie Chang's avatar Sophie Chang Committed by Commit Bot

Allow for resource hints to block fonts by default

Change-Id: I0e82e38ed2782f6998971b3ce5291193ccd36983
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954406Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Sophie Chang <sophiechang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722517}
parent ef05a240
......@@ -79,6 +79,7 @@ PreviewsResourceLoadingHints::PreviewsResourceLoadingHints(
block_resource_type_[static_cast<int>(ResourceType::kCSSStyleSheet)] = true;
block_resource_type_[static_cast<int>(ResourceType::kScript)] = true;
block_resource_type_[static_cast<int>(ResourceType::kRaw)] = true;
block_resource_type_[static_cast<int>(ResourceType::kFont)] = true;
for (int i = 0; i < static_cast<int>(ResourceType::kMaxValue) + 1; ++i) {
// Parameter names are of format: "block_resource_type_%d". The value
// should be either "true" or "false".
......
......@@ -321,8 +321,8 @@ TEST_F(PreviewsResourceLoadingHintsTestBlockImages,
};
for (const auto& test : tests) {
// By default, resource blocking hints do not apply to fonts.
EXPECT_TRUE(hints->AllowLoad(ResourceType::kFont, test.url,
// By default, resource blocking hints do not apply to SVG documents.
EXPECT_TRUE(hints->AllowLoad(ResourceType::kSVGDocument, test.url,
ResourceLoadPriority::kHighest));
// Feature override should cause resource blocking hints to apply to images.
EXPECT_EQ(test.allow_load_expected,
......@@ -378,9 +378,7 @@ TEST_F(PreviewsResourceLoadingHintsTestAllowCSS,
for (const auto& test : tests) {
// Feature override should cause resource blocking hints to apply to only
// scripts.
EXPECT_TRUE(hints->AllowLoad(ResourceType::kFont, test.url,
ResourceLoadPriority::kHighest));
// scripts and fonts.
EXPECT_TRUE(hints->AllowLoad(ResourceType::kImage, test.url,
ResourceLoadPriority::kHighest));
EXPECT_TRUE(hints->AllowLoad(ResourceType::kCSSStyleSheet, test.url,
......@@ -388,6 +386,9 @@ TEST_F(PreviewsResourceLoadingHintsTestAllowCSS,
EXPECT_EQ(test.allow_load_expected,
hints->AllowLoad(ResourceType::kScript, test.url,
ResourceLoadPriority::kHighest));
EXPECT_EQ(test.allow_load_expected,
hints->AllowLoad(ResourceType::kFont, test.url,
ResourceLoadPriority::kHighest));
}
}
......
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