Loading gfx/ipc/GPUProcessImpl.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ # include "mozilla/sandboxTarget.h" #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX) # include "mozilla/SandboxSettings.h" #elif defined(XP_MACOSX) && defined(MOZ_BUNDLED_FONTS) # include "gfxPlatformMac.h" #endif namespace mozilla { Loading @@ -34,6 +36,35 @@ bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) { return false; } #if defined(XP_MACOSX) && defined(MOZ_BUNDLED_FONTS) // On macOS, bundled fonts shipped with the application need to be activated // in the GPU process, otherwise they will fail to render (and fall back to // garbage glyphs from another font). // The bundled fonts directory is a sibling of the appDir, so we use the // sAppDir arg as a starting-point to locate it. nsCOMPtr<nsIFile> appDirArg; Maybe<const char*> appDir = geckoargs::sAppDir.Get(aArgc, aArgv); if (appDir.isSome()) { bool flag; if (NS_FAILED(XRE_GetFileFromPath(*appDir, getter_AddRefs(appDirArg))) || NS_FAILED(appDirArg->Exists(&flag)) || !flag) { NS_WARNING("Invalid application directory passed to GPU process."); appDirArg = nullptr; } } if (appDirArg) { // appDirArg is the <app package>/Contents/Resources/browser directory. // Get its parent (/Resources), and then append /fonts. nsCOMPtr<nsIFile> fontsDir; bool flag; if (NS_SUCCEEDED(appDirArg->GetParent(getter_AddRefs(fontsDir))) && NS_SUCCEEDED(fontsDir->AppendRelativeNativePath("fonts"_ns)) && NS_SUCCEEDED(fontsDir->Exists(&flag)) && flag) { gfxPlatformMac::ActivateFontsFromDir(fontsDir->NativePath()); } } #endif if (!ProcessChild::InitPrefs(aArgc, aArgv)) { return false; } Loading gfx/thebes/CoreTextFontList.h +4 −4 Original line number Diff line number Diff line Loading @@ -193,6 +193,10 @@ class CoreTextFontList : public gfxPlatformFontList { }; void ReadSystemFontList(mozilla::dom::SystemFontList*); static void ActivateFontsFromDir( const nsACString& aDir, nsTHashSet<nsCStringHashKey>* aLoadedFamilies = nullptr); protected: CoreTextFontList(); virtual ~CoreTextFontList(); Loading Loading @@ -251,10 +255,6 @@ class CoreTextFontList : public gfxPlatformFontList { void AddFamily(const nsACString& aFamilyName, FontVisibility aVisibility) MOZ_REQUIRES(mLock); static void ActivateFontsFromDir( const nsACString& aDir, nsTHashSet<nsCStringHashKey>* aLoadedFamilies = nullptr); gfxFontEntry* CreateFontEntry( mozilla::fontlist::Face* aFace, const mozilla::fontlist::Family* aFamily) override; Loading gfx/thebes/gfxPlatformMac.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1073,3 +1073,9 @@ nsTArray<uint8_t> gfxPlatformMac::GetPlatformCMSOutputProfileData() { } bool gfxPlatformMac::CheckVariationFontSupport() { return true; } #ifdef MOZ_BUNDLED_FONTS void gfxPlatformMac::ActivateFontsFromDir(const nsACString& aPath) { CoreTextFontList::ActivateFontsFromDir(aPath); } #endif gfx/thebes/gfxPlatformMac.h +4 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,10 @@ class gfxPlatformMac : public gfxPlatform { static bool CheckVariationFontSupport(); #ifdef MOZ_BUNDLED_FONTS static void ActivateFontsFromDir(const nsACString& aPath); #endif protected: bool AccelerateLayersByDefault() override; Loading security/sandbox/mac/SandboxPolicyGPU.h +1 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ static const char SandboxPolicyGPU[] = R"SANDBOX_LITERAL( (allow file-read* (subpath "/Library/Fonts") (subpath "/Library/Application Support/Apple/Fonts") (subpath (string-append appPath "/Contents/Resources/fonts")) (home-subpath "/Library/Fonts") ; Allow read access to paths allowed via sandbox extensions. ; This is needed for fonts in non-standard locations normally Loading Loading
gfx/ipc/GPUProcessImpl.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ # include "mozilla/sandboxTarget.h" #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX) # include "mozilla/SandboxSettings.h" #elif defined(XP_MACOSX) && defined(MOZ_BUNDLED_FONTS) # include "gfxPlatformMac.h" #endif namespace mozilla { Loading @@ -34,6 +36,35 @@ bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) { return false; } #if defined(XP_MACOSX) && defined(MOZ_BUNDLED_FONTS) // On macOS, bundled fonts shipped with the application need to be activated // in the GPU process, otherwise they will fail to render (and fall back to // garbage glyphs from another font). // The bundled fonts directory is a sibling of the appDir, so we use the // sAppDir arg as a starting-point to locate it. nsCOMPtr<nsIFile> appDirArg; Maybe<const char*> appDir = geckoargs::sAppDir.Get(aArgc, aArgv); if (appDir.isSome()) { bool flag; if (NS_FAILED(XRE_GetFileFromPath(*appDir, getter_AddRefs(appDirArg))) || NS_FAILED(appDirArg->Exists(&flag)) || !flag) { NS_WARNING("Invalid application directory passed to GPU process."); appDirArg = nullptr; } } if (appDirArg) { // appDirArg is the <app package>/Contents/Resources/browser directory. // Get its parent (/Resources), and then append /fonts. nsCOMPtr<nsIFile> fontsDir; bool flag; if (NS_SUCCEEDED(appDirArg->GetParent(getter_AddRefs(fontsDir))) && NS_SUCCEEDED(fontsDir->AppendRelativeNativePath("fonts"_ns)) && NS_SUCCEEDED(fontsDir->Exists(&flag)) && flag) { gfxPlatformMac::ActivateFontsFromDir(fontsDir->NativePath()); } } #endif if (!ProcessChild::InitPrefs(aArgc, aArgv)) { return false; } Loading
gfx/thebes/CoreTextFontList.h +4 −4 Original line number Diff line number Diff line Loading @@ -193,6 +193,10 @@ class CoreTextFontList : public gfxPlatformFontList { }; void ReadSystemFontList(mozilla::dom::SystemFontList*); static void ActivateFontsFromDir( const nsACString& aDir, nsTHashSet<nsCStringHashKey>* aLoadedFamilies = nullptr); protected: CoreTextFontList(); virtual ~CoreTextFontList(); Loading Loading @@ -251,10 +255,6 @@ class CoreTextFontList : public gfxPlatformFontList { void AddFamily(const nsACString& aFamilyName, FontVisibility aVisibility) MOZ_REQUIRES(mLock); static void ActivateFontsFromDir( const nsACString& aDir, nsTHashSet<nsCStringHashKey>* aLoadedFamilies = nullptr); gfxFontEntry* CreateFontEntry( mozilla::fontlist::Face* aFace, const mozilla::fontlist::Family* aFamily) override; Loading
gfx/thebes/gfxPlatformMac.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1073,3 +1073,9 @@ nsTArray<uint8_t> gfxPlatformMac::GetPlatformCMSOutputProfileData() { } bool gfxPlatformMac::CheckVariationFontSupport() { return true; } #ifdef MOZ_BUNDLED_FONTS void gfxPlatformMac::ActivateFontsFromDir(const nsACString& aPath) { CoreTextFontList::ActivateFontsFromDir(aPath); } #endif
gfx/thebes/gfxPlatformMac.h +4 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,10 @@ class gfxPlatformMac : public gfxPlatform { static bool CheckVariationFontSupport(); #ifdef MOZ_BUNDLED_FONTS static void ActivateFontsFromDir(const nsACString& aPath); #endif protected: bool AccelerateLayersByDefault() override; Loading
security/sandbox/mac/SandboxPolicyGPU.h +1 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ static const char SandboxPolicyGPU[] = R"SANDBOX_LITERAL( (allow file-read* (subpath "/Library/Fonts") (subpath "/Library/Application Support/Apple/Fonts") (subpath (string-append appPath "/Contents/Resources/fonts")) (home-subpath "/Library/Fonts") ; Allow read access to paths allowed via sandbox extensions. ; This is needed for fonts in non-standard locations normally Loading