Skip to content
Permalink
Browse files
[Cocoa] Add SPI to disallow user-installed fonts
https://bugs.webkit.org/show_bug.cgi?id=180062
<rdar://problem/35042408>

Reviewed by Simon Fraser.

Source/WebCore:

This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
code. This preference works by specifying an attribute to our font selection code which
will prohibit user-installed fonts from ever being selected. This works both to disallow
newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
have the same name as) existing fonts, so that the existing font is selected instead.

The goal of this setting is to decrease the fingerprinting surface area which trackers
can use to identify users on the open Web.

Tests: fast/text/user-installed-font.html
       fast/text/user-installed-fonts/disable.html
       fast/text/user-installed-fonts/shadow-disable.html
       fast/text/user-installed-fonts/shadow-family-disable.html
       fast/text/user-installed-fonts/shadow-family.html
       fast/text/user-installed-fonts/shadow-postscript-disable.html
       fast/text/user-installed-fonts/shadow-postscript-family-disable.html
       fast/text/user-installed-fonts/shadow-postscript-family.html
       fast/text/user-installed-fonts/shadow-postscript.html
       fast/text/user-installed-fonts/shadow.html

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.yaml:
* platform/graphics/FontCache.h:
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::mayRepresentUserInstalledFont const):
(WebCore::FontDescription::setMayRepresentUserInstalledFont):
(WebCore::FontDescription::operator== const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::singleton):
(WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
(WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
(WebCore::FontDatabase::collectionForFamily):
(WebCore::FontDatabase::fontForPostScriptName):
(WebCore::FontDatabase::FontDatabase):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(WebCore::platformFontLookupWithFamily):
(WebCore::invalidateFontCache):
(WebCore::fontWithFamily):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldDisallowUserInstalledFonts):
(WKPreferencesGetShouldDisallowUserInstalledFonts):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _shouldDisallowUserInstalledFonts]):
(-[WKPreferences _setShouldDisallowUserInstalledFonts:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

* WebKitTestRunner/InjectedBundle/ActivateFonts.h:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::resetAfterTest):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
(WTR::resourcesDirectoryURL):
(WTR::activateFonts):
(WTR::installFakeHelvetica):
(WTR::uninstallFakeHelvetica):
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::installFakeHelvetica):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf: Added.

LayoutTests:

* fast/text/user-installed-font-expected.html: Added.
* fast/text/user-installed-font.html: Added.
* fast/text/user-installed-fonts/disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/disable.html: Added.
* fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-disable.html: Added.
* fast/text/user-installed-fonts/shadow-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript.html: Added.
* fast/text/user-installed-fonts/shadow.html: Added.
* platform/gtk/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* platform/wpe/TestExpectations:


Canonical link: https://commits.webkit.org/196461@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
litherum committed Dec 7, 2017
1 parent fcd4086 commit 366ded3da787ffc26dbaac857017e40324b51bca
Showing with 573 additions and 23 deletions.
  1. +36 −0 LayoutTests/ChangeLog
  2. +9 −0 LayoutTests/fast/text/user-installed-font-expected.html
  3. +9 −0 LayoutTests/fast/text/user-installed-font.html
  4. +8 −0 LayoutTests/fast/text/user-installed-fonts/disable-expected-mismatch.html
  5. +12 −0 LayoutTests/fast/text/user-installed-fonts/disable.html
  6. +8 −0 LayoutTests/fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html
  7. +14 −0 LayoutTests/fast/text/user-installed-fonts/shadow-disable.html
  8. +9 −0 LayoutTests/fast/text/user-installed-fonts/shadow-expected.html
  9. +8 −0 LayoutTests/fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html
  10. +14 −0 LayoutTests/fast/text/user-installed-fonts/shadow-family-disable.html
  11. +9 −0 LayoutTests/fast/text/user-installed-fonts/shadow-family-expected.html
  12. +13 −0 LayoutTests/fast/text/user-installed-fonts/shadow-family.html
  13. +8 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html
  14. +14 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable.html
  15. +9 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-expected.html
  16. +8 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html
  17. +14 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable.html
  18. +9 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-expected.html
  19. +13 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family.html
  20. +13 −0 LayoutTests/fast/text/user-installed-fonts/shadow-postscript.html
  21. +13 −0 LayoutTests/fast/text/user-installed-fonts/shadow.html
  22. +2 −0 LayoutTests/platform/gtk/TestExpectations
  23. +3 −0 LayoutTests/platform/ios-wk1/TestExpectations
  24. +6 −0 LayoutTests/platform/ios/TestExpectations
  25. +3 −0 LayoutTests/platform/mac-wk1/TestExpectations
  26. +4 −0 LayoutTests/platform/mac/TestExpectations
  27. +3 −0 LayoutTests/platform/win/TestExpectations
  28. +3 −0 LayoutTests/platform/wpe/TestExpectations
  29. +58 −0 Source/WebCore/ChangeLog
  30. +10 −0 Source/WebCore/PAL/ChangeLog
  31. +1 −0 Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
  32. +5 −1 Source/WebCore/css/CSSFontFaceSet.cpp
  33. +1 −0 Source/WebCore/css/StyleResolver.cpp
  34. +4 −0 Source/WebCore/page/Settings.yaml
  35. +5 −1 Source/WebCore/platform/graphics/FontCache.h
  36. +1 −0 Source/WebCore/platform/graphics/FontDescription.cpp
  37. +5 −1 Source/WebCore/platform/graphics/FontDescription.h
  38. +67 −16 Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
  39. +1 −1 Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
  40. +1 −1 Source/WebCore/platform/graphics/win/FontCacheWin.cpp
  41. +1 −0 Source/WebCore/style/StyleResolveForDocument.cpp
  42. +18 −0 Source/WebKit/ChangeLog
  43. +4 −0 Source/WebKit/Shared/WebPreferences.yaml
  44. +10 −0 Source/WebKit/UIProcess/API/C/WKPreferences.cpp
  45. +4 −0 Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
  46. +10 −0 Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
  47. +2 −0 Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
  48. +26 −0 Tools/ChangeLog
  49. +2 −0 Tools/WebKitTestRunner/InjectedBundle/ActivateFonts.h
  50. +2 −0 Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
  51. +3 −0 Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
  52. +2 −0 Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
  53. +34 −2 Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm
  54. +6 −0 Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm
  55. +16 −0 Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
  56. BIN Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf
  57. BIN Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf
  58. BIN Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf
  59. BIN Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf
@@ -1,3 +1,39 @@
2017-12-07 Myles C. Maxfield <mmaxfield@apple.com>

[Cocoa] Add SPI to disallow user-installed fonts
https://bugs.webkit.org/show_bug.cgi?id=180062
<rdar://problem/35042408>

Reviewed by Simon Fraser.

* fast/text/user-installed-font-expected.html: Added.
* fast/text/user-installed-font.html: Added.
* fast/text/user-installed-fonts/disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/disable.html: Added.
* fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-disable.html: Added.
* fast/text/user-installed-fonts/shadow-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript.html: Added.
* fast/text/user-installed-fonts/shadow.html: Added.
* platform/gtk/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* platform/wpe/TestExpectations:

2017-12-07 John Wilander <wilander@apple.com>

Move all tests under http/tests/loading/resourceLoadStatistics/ to http/tests/resourceLoadStatistics/ and remove expected failures
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts work in the general case. The test passes if you see a black square below.
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts work in the general case. The test passes if you see a black square below.
<div style="font: 100px 'Ahem'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.internals)
internals.settings.setShouldDisallowUserInstalledFonts(true);
</script>
</head>
<body>
<div style="font: 100px 'Ahem'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica-400");
if (window.internals)
internals.settings.setShouldDisallowUserInstalledFonts(true);
</script>
</head>
<body>
<div style="font: 400 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="width: 96px; height: 50px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica-500");
if (window.internals)
internals.settings.setShouldDisallowUserInstalledFonts(true);
</script>
</head>
<body>
<div style="font: 500 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="width: 96px; height: 50px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica-500");
</script>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="font: 500 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica2-400");
if (window.internals)
internals.settings.setShouldDisallowUserInstalledFonts(true);
</script>
</head>
<body>
<div style="font: 400 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="width: 96px; height: 50px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="width: 96px; height: 96px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica2-500");
if (window.internals)
internals.settings.setShouldDisallowUserInstalledFonts(true);
</script>
</head>
<body>
<div style="font: 500 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="width: 96px; height: 50px; background: black;"></div>
</body>
</html>
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica2-500");
</script>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="font: 500 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica2-400");
</script>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="font: 400 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
</body>
</html>
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.installFakeHelvetica("Helvetica-400");
</script>
</head>
<body>
This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
<div style="font: 400 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
</body>
</html>
@@ -3357,6 +3357,8 @@ webkit.org/b/179052 compositing/contents-format/subpixel-antialiased-nested-laye

webkit.org/b/180371 fast/attachment/attachment-without-appearance.html [ ImageOnlyFailure ]

webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]

#////////////////////////////////////////////////////////////////////////////////////////
# End of non-crashing, non-flaky tests failing
#////////////////////////////////////////////////////////////////////////////////////////
@@ -1903,3 +1903,6 @@ webkit.org/b/172092 [ Release ] fast/parser/adoption-agency-unload-iframe-4.html

# FIXME: For some reason EventSender.keyDown() does not work.
webkit.org/b/178490 fast/text/scroll-text-overflow-ellipsis.html [ Skip ]

# User-installed fonts test infrastructure is not present in WK1
webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
@@ -3308,3 +3308,9 @@ media/modern-media-controls/time-labels-support/elapsed-time.html [ Skip ]

# Requries AVFoundation support <rdar://problem/34502208>
http/tests/images/image-supports-video.html

# User-installed font infrastructure is ony present on certain OSes.
webkit.org/b/180062 fast/text/user-installed-fonts/disable.html [ ImageOnlyFailure ]
webkit.org/b/180062 fast/text/user-installed-fonts/shadow-family.html [ ImageOnlyFailure ]
webkit.org/b/180062 fast/text/user-installed-fonts/shadow-postscript.html [ ImageOnlyFailure ]
webkit.org/b/180062 fast/text/user-installed-fonts/shadow.html [ ImageOnlyFailure ]
@@ -474,3 +474,6 @@ webkit.org/b/179775 imported/w3c/web-platform-tests/XMLHttpRequest/firing-events
webkit.org/b/172044 [ Debug ] imported/w3c/web-platform-tests/IndexedDB/open-request-queue.html [ Pass Timeout ]

webkit.org/b/179500 accessibility/mac/AOM-relation-property.html [ Skip ]

# User-installed fonts test infrastructure is not present in WK1
webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
@@ -1757,3 +1757,7 @@ webkit.org/b/165311 [ Sierra+ ] media/modern-media-controls/pip-support/pip-supp

webkit.org/b/176693 storage/indexeddb/modern/idbtransaction-objectstore-failures-private.html [ Pass Failure ]

# User-installed font infrastructure is ony present on certain OSes.
webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/disable.html [ ImageOnlyFailure ]
webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/shadow-postscript.html [ ImageOnlyFailure ]
webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/shadow.html [ ImageOnlyFailure ]
@@ -3832,3 +3832,6 @@ webkit.org/b/179613 editing/execCommand/underline-selection-containing-image.htm
webkit.org/b/179766 accessibility/accessibility-object-model.html [ Failure ]

webkit.org/b/179767 http/wpt/offscreen-canvas/getContext-webgl.html [ Failure ]

# User-installed font infrastructure is ony present on certain OSes.
webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
@@ -1108,3 +1108,6 @@ webkit.org/b/179898 svg/animations/svglengthlist-animation-3.html [ Pass Failure
webkit.org/b/180134 webanimations/left-and-opacity-animation-yields-no-compositing.html [ Failure ]
webkit.org/b/180134 webanimations/opacity-animation-no-longer-composited-upon-completion.html [ Failure ]
webkit.org/b/180134 webanimations/width-and-opacity-separate-animation-yields-no-compositing.html [ Failure ]

# User-installed font infrastructure is ony present on certain OSes.
webkit.org/b/180062 fast/text/user-installed-fonts/ [ ImageOnlyFailure ]
@@ -1,3 +1,61 @@
2017-12-07 Myles C. Maxfield <mmaxfield@apple.com>

[Cocoa] Add SPI to disallow user-installed fonts
https://bugs.webkit.org/show_bug.cgi?id=180062
<rdar://problem/35042408>

Reviewed by Simon Fraser.

This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
code. This preference works by specifying an attribute to our font selection code which
will prohibit user-installed fonts from ever being selected. This works both to disallow
newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
have the same name as) existing fonts, so that the existing font is selected instead.

The goal of this setting is to decrease the fingerprinting surface area which trackers
can use to identify users on the open Web.

Tests: fast/text/user-installed-font.html
fast/text/user-installed-fonts/disable.html
fast/text/user-installed-fonts/shadow-disable.html
fast/text/user-installed-fonts/shadow-family-disable.html
fast/text/user-installed-fonts/shadow-family.html
fast/text/user-installed-fonts/shadow-postscript-disable.html
fast/text/user-installed-fonts/shadow-postscript-family-disable.html
fast/text/user-installed-fonts/shadow-postscript-family.html
fast/text/user-installed-fonts/shadow-postscript.html
fast/text/user-installed-fonts/shadow.html

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.yaml:
* platform/graphics/FontCache.h:
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::mayRepresentUserInstalledFont const):
(WebCore::FontDescription::setMayRepresentUserInstalledFont):
(WebCore::FontDescription::operator== const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::singleton):
(WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
(WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
(WebCore::FontDatabase::collectionForFamily):
(WebCore::FontDatabase::fontForPostScriptName):
(WebCore::FontDatabase::FontDatabase):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(WebCore::platformFontLookupWithFamily):
(WebCore::invalidateFontCache):
(WebCore::fontWithFamily):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

2017-12-07 David Quesada <david_quesada@apple.com>

[Web App Manifest] Support display-mode media feature

0 comments on commit 366ded3

Please sign in to comment.