mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-13 11:30:02 +00:00
#414: new wildcard based blacklist, updated strings
This commit is contained in:
parent
be4d0ed865
commit
6ccb443e7c
@ -547,6 +547,7 @@ static bool FindTagInTableDir(FallibleTArray<uint8_t>& table,
|
|||||||
// 96 bit header (three 32-bit words). One day we could even write
|
// 96 bit header (three 32-bit words). One day we could even write
|
||||||
// an AltiVec version ...
|
// an AltiVec version ...
|
||||||
#ifdef DEBUG_X
|
#ifdef DEBUG_X
|
||||||
|
fprintf(stderr, "Tables: ");
|
||||||
uint32_t j = 12;
|
uint32_t j = 12;
|
||||||
#endif
|
#endif
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -628,7 +629,7 @@ MacOSFontEntry::HasFontTable(uint32_t aTableTag)
|
|||||||
mFontTableDir.SetLength(mFontTableDirSize, fallible);
|
mFontTableDir.SetLength(mFontTableDirSize, fallible);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Size of %s font table directory: %i\nTables: ",
|
fprintf(stderr, "Size of %s font table directory: %i\n",
|
||||||
NS_ConvertUTF16toUTF8(mName).get(), mFontTableDir.Length());
|
NS_ConvertUTF16toUTF8(mName).get(), mFontTableDir.Length());
|
||||||
#endif
|
#endif
|
||||||
if (MOZ_LIKELY(::ATSFontGetTableDirectory(fontRef, mFontTableDirSize,
|
if (MOZ_LIKELY(::ATSFontGetTableDirectory(fontRef, mFontTableDirSize,
|
||||||
|
@ -220,6 +220,24 @@ gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
|
|||||||
aLength);
|
aLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Automates a whole buncha boilerplate.
|
||||||
|
// Since HTTPS is becoming more common, check that first.
|
||||||
|
#define HTTP_OR_HTTPS_SUBDIR(x) \
|
||||||
|
{ \
|
||||||
|
if (!failed) { \
|
||||||
|
NS_NAMED_LITERAL_CSTRING(https_, "https://" x); \
|
||||||
|
spec.Left(loc, https_.Length()); \
|
||||||
|
if (loc.Equals(https_)) { \
|
||||||
|
failed = true; \
|
||||||
|
} else { \
|
||||||
|
NS_NAMED_LITERAL_CSTRING(http_, "http://" x); \
|
||||||
|
spec.Left(loc, http_.Length()); \
|
||||||
|
if (loc.Equals(http_)) \
|
||||||
|
failed = true; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
||||||
{
|
{
|
||||||
@ -228,13 +246,19 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
|||||||
"strange font format hint set");
|
"strange font format hint set");
|
||||||
|
|
||||||
// TenFourFox issue 261. Prevent loading certain known bad font URIs.
|
// TenFourFox issue 261. Prevent loading certain known bad font URIs.
|
||||||
nsCString spec;
|
nsAutoCString spec, loc;
|
||||||
nsresult rv = aFontURI->GetAsciiSpec(spec);
|
nsresult rv = aFontURI->GetAsciiSpec(spec);
|
||||||
|
bool failed = false;
|
||||||
|
|
||||||
|
if (MOZ_LIKELY(NS_SUCCEEDED(rv))) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
fprintf(stderr, "Font blacklist checking: %s\n", spec.get());
|
fprintf(stderr, "Font blacklist checking: %s\n", spec.get());
|
||||||
#endif
|
#endif
|
||||||
if (NS_FAILED(rv) ||
|
HTTP_OR_HTTPS_SUBDIR("www.apple.com/wss/fonts/SF-Pro-Text/v1/");
|
||||||
|
HTTP_OR_HTTPS_SUBDIR("www.apple.com/wss/fonts/SF-Pro-Display/v1/");
|
||||||
|
} else
|
||||||
|
failed = true;
|
||||||
|
if (failed ||
|
||||||
spec.Equals("https://cdn-static-1.medium.com/_/fp/fonts/charter-nonlatin.b-nw7PXlIqmGHGmHvkDiTw.woff") ||
|
spec.Equals("https://cdn-static-1.medium.com/_/fp/fonts/charter-nonlatin.b-nw7PXlIqmGHGmHvkDiTw.woff") ||
|
||||||
spec.Equals("http://typeface.nytimes.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
spec.Equals("http://typeface.nytimes.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
||||||
spec.Equals("https://typeface.nyt.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
spec.Equals("https://typeface.nyt.com/fonts/nyt-cheltenham-200-normal.woff") ||
|
||||||
@ -246,46 +270,9 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
|||||||
spec.Equals("http://fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Bold.otf") ||
|
spec.Equals("http://fonts.gstatic.com/ea/notosansjapanese/v6/NotoSansJP-Bold.otf") ||
|
||||||
spec.Equals("https://www.icloud.com/fonts/SFNSText-Light.woff") ||
|
spec.Equals("https://www.icloud.com/fonts/SFNSText-Light.woff") ||
|
||||||
spec.Equals("https://www.icloud.com/fonts/SFNSText-Medium.woff") ||
|
spec.Equals("https://www.icloud.com/fonts/SFNSText-Medium.woff") ||
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_bold.woff") ||
|
0) {
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_bold.ttf") ||
|
if (MOZ_LIKELY(NS_SUCCEEDED(rv))) // Don't print if we couldn't get the URL.
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_medium.woff") ||
|
fprintf(stderr, "Warning: TenFourFox blocking ATSUI-incompatible webfont %s.\n", spec.get());
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_medium.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_semibold.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_semibold.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_regular.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_regular.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_light.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_light.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_medium.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_medium.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_regular.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_regular.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_light.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_light.ttf") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_semibold.woff") ||
|
|
||||||
spec.Equals("https://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_semibold.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_bold.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_bold.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_medium.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_medium.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_semibold.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_semibold.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_regular.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_regular.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_light.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Text/v1/sf-pro-text_light.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_medium.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_medium.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_regular.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_regular.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_light.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_light.ttf") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_semibold.woff") ||
|
|
||||||
spec.Equals("http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_semibold.ttf") ||
|
|
||||||
0) {
|
|
||||||
if (NS_SUCCEEDED(rv)) // Don't print if we couldn't get the URL.
|
|
||||||
fprintf(stderr,
|
|
||||||
"Warning: TenFourFox blocking ATSUI-incompatible webfont %s.\n", spec.get());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +293,8 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef HTTP_OR_HTTPS_SUBDIR
|
||||||
|
|
||||||
// these will also move to gfxPlatform once all platforms support the fontlist
|
// these will also move to gfxPlatform once all platforms support the fontlist
|
||||||
nsresult
|
nsresult
|
||||||
gfxPlatformMac::GetFontList(nsIAtom *aLangGroup,
|
gfxPlatformMac::GetFontList(nsIAtom *aLangGroup,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user