Commit 1117bd9f authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

Revert "FontAccess: Sort fonts in lexicographical order"

This reverts commit 404b7cc4.

Reason for revert: Breaks tests on Win 7 Builder: https://ci.chromium.org/p/chromium/builders/ci/Win7%20Tests%20%281%29/108048

Original change's description:
> FontAccess: Sort fonts in lexicographical order
>
> This change ensures fonts are sorted before being cached. This change is
> due to a concern about fingerprinting:
> https://github.com/w3ctag/design-reviews/issues/399#issuecomment-530679815
>
> This change ensures that fonts are sorted in lexicographical order.
>
> Bug: 1043306
> Change-Id: Ia3acf2a45cb473124df4e489683bdc7bac15dde4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427040
> Commit-Queue: Olivier Yiptong <oyiptong@chromium.org>
> Reviewed-by: Joshua Bell <jsbell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#810519}

TBR=jsbell@chromium.org,oyiptong@chromium.org

Change-Id: I75926b99ebb7e663875e0eae3d89d877f623a6ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1043306
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431025Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810547}
parent 0e843fe2
......@@ -187,19 +187,11 @@ void ValidateFontEnumerationBasic(FontEnumerationStatus status,
base::ReadOnlySharedMemoryMapping mapping = region.Map();
table.ParseFromArray(mapping.memory(), mapping.size());
blink::FontEnumerationTable_FontMetadata previous_font;
for (const auto& font : table.fonts()) {
EXPECT_GT(font.postscript_name().size(), 0ULL)
<< "postscript_name size is not zero.";
EXPECT_GT(font.full_name().size(), 0ULL) << "full_name size is not zero.";
EXPECT_GT(font.family().size(), 0ULL) << "family size is not zero.";
if (previous_font.IsInitialized()) {
EXPECT_LT(previous_font.postscript_name(), font.postscript_name())
<< "font list is sorted";
}
previous_font = font;
}
}
......
......@@ -97,12 +97,6 @@ void FontEnumerationCache::BuildEnumerationCache(
std::unique_ptr<blink::FontEnumerationTable> table) {
DCHECK(!enumeration_cache_built_.IsSet());
std::sort(table->mutable_fonts()->begin(), table->mutable_fonts()->end(),
[](const blink::FontEnumerationTable_FontMetadata& a,
const blink::FontEnumerationTable_FontMetadata& b) {
return a.postscript_name() < b.postscript_name();
});
enumeration_cache_memory_ =
base::ReadOnlySharedMemoryRegion::Create(table->ByteSizeLong());
......
......@@ -31,31 +31,3 @@ font_access_test(async t => {
assert_fonts_exist(availableFonts, getEnumerationTestSet());
}, 'query(): standard fonts returned');
font_access_test(async t => {
const iterator = navigator.fonts.query();
if (!isPlatformSupported()) {
await promise_rejects_dom(t, 'NotSupportedError', (async () => {
for await (const f of iterator) {
}
})());
return;
}
// The following tests that fonts are sorted. Postscript names are expected to
// be encoded in a subset of the ASCII character set.
// See: https://docs.microsoft.com/en-us/typography/opentype/spec/name
// Should the Postscript name contain characters that are multi-byte, this
// test may erroneously fail.
let previousFont = null;
for await (const font of iterator) {
if (previousFont) {
assert_true(
previousFont.postscriptName < font.postscriptName,
'fonts are sorted');
}
previousFont = font;
}
}, 'query(): fonts are sorted');
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