Bug 1851553 - Remove layout.css.font-loading-api.workers.enabled pref r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D188412
This commit is contained in:
Gregory Pappas 2023-09-19 07:44:05 +00:00
Родитель 70cf707792
Коммит 3037a1c1a5
9 изменённых файлов: 20 добавлений и 51 удалений

Просмотреть файл

@ -29,10 +29,7 @@ dictionary FontFaceDescriptors {
enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
// Bug 1072107 is for exposing this in workers.
// [Exposed=(Window,Worker)]
[Func="FontFaceSet::IsEnabled",
Exposed=(Window,Worker)]
[Exposed=(Window,Worker)]
interface FontFace {
[Throws]
constructor(UTF8String family,

Просмотреть файл

@ -28,8 +28,7 @@ callback FontFaceSetForEachCallback = undefined (FontFace value, FontFace key, F
enum FontFaceSetLoadStatus { "loading", "loaded" };
[Func="FontFaceSet::IsEnabled",
Exposed=(Window,Worker)]
[Exposed=(Window,Worker)]
interface FontFaceSet : EventTarget {
// Bug 1072762 is for the FontFaceSet constructor.
// constructor(sequence<FontFace> initialFaces);

Просмотреть файл

@ -14,8 +14,7 @@ dictionary FontFaceSetLoadEventInit : EventInit {
sequence<FontFace> fontfaces = [];
};
[Func="FontFaceSet::IsEnabled",
Exposed=(Window,Worker)]
[Exposed=(Window,Worker)]
interface FontFaceSetLoadEvent : Event {
constructor(DOMString type,
optional FontFaceSetLoadEventInit eventInitDict = {});

Просмотреть файл

@ -11,6 +11,6 @@
*/
interface mixin FontFaceSource {
[Func="FontFaceSet::IsEnabled", Throws]
[Throws]
readonly attribute FontFaceSet fonts;
};

Просмотреть файл

@ -300,18 +300,13 @@ void FontFace::EnsurePromise() {
return;
}
// If the pref is not set, don't create the Promise (which the page wouldn't
// be able to get to anyway) as it causes the window.FontFace constructor
// to be created.
if (FontFaceSet::IsEnabled()) {
ErrorResult rv;
mLoaded = Promise::Create(mParent, rv);
ErrorResult rv;
mLoaded = Promise::Create(mParent, rv);
if (mImpl->Status() == FontFaceLoadStatus::Loaded) {
mLoaded->MaybeResolve(this);
} else if (mLoadedRejection != NS_OK) {
mLoaded->MaybeReject(mLoadedRejection);
}
if (mImpl->Status() == FontFaceLoadStatus::Loaded) {
mLoaded->MaybeResolve(this);
} else if (mLoadedRejection != NS_OK) {
mLoaded->MaybeReject(mLoadedRejection);
}
}

Просмотреть файл

@ -35,7 +35,6 @@
#include "mozilla/ServoStyleSet.h"
#include "mozilla/ServoUtils.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/Telemetry.h"
#include "mozilla/LoadInfo.h"
#include "nsComponentManagerUtils.h"
@ -107,13 +106,6 @@ FontFaceSet::~FontFaceSet() {
Destroy();
}
/* static */ bool FontFaceSet::IsEnabled() {
if (!NS_IsMainThread()) {
return StaticPrefs::layout_css_font_loading_api_workers_enabled();
}
return true;
}
/* static */ already_AddRefed<FontFaceSet> FontFaceSet::CreateForDocument(
dom::Document* aDocument) {
RefPtr<FontFaceSet> set = new FontFaceSet(aDocument->GetScopeObject());
@ -403,20 +395,18 @@ void FontFaceSet::DispatchLoadingEventAndReplaceReadyPromise() {
(new AsyncEventDispatcher(this, u"loading"_ns, CanBubble::eNo))
->PostDOMEvent();
if (IsEnabled()) {
if (mReady && mReady->State() != Promise::PromiseState::Pending) {
if (GetParentObject()) {
ErrorResult rv;
mReady = Promise::Create(GetParentObject(), rv);
}
if (mReady && mReady->State() != Promise::PromiseState::Pending) {
if (GetParentObject()) {
ErrorResult rv;
mReady = Promise::Create(GetParentObject(), rv);
}
// We may previously have been in a state where all fonts had finished
// loading and we'd set mResolveLazilyCreatedReadyPromise to make sure that
// if we lazily create mReady for a consumer that we resolve it before
// returning it. We're now loading fonts, so we need to clear that flag.
mResolveLazilyCreatedReadyPromise = false;
}
// We may previously have been in a state where all fonts had finished
// loading and we'd set mResolveLazilyCreatedReadyPromise to make sure that
// if we lazily create mReady for a consumer that we resolve it before
// returning it. We're now loading fonts, so we need to clear that flag.
mResolveLazilyCreatedReadyPromise = false;
}
void FontFaceSet::MaybeResolve() {

Просмотреть файл

@ -36,10 +36,6 @@ class FontFaceSet final : public DOMEventTargetHelper {
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FontFaceSet, DOMEventTargetHelper)
static bool IsEnabled();
static bool IsEnabled(JSContext* aCx, JSObject* aObj) { return IsEnabled(); }
static already_AddRefed<FontFaceSet> CreateForDocument(
dom::Document* aDocument);

Просмотреть файл

@ -8359,12 +8359,6 @@
mirror: always
rust: true
# Is support for workerGlobalScope.fonts enabled?
- name: layout.css.font-loading-api.workers.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Is support for the @font-palette-values rule and font-palette property enabled?
- name: layout.css.font-palette.enabled
type: RelaxedAtomicBool

Просмотреть файл

@ -74,7 +74,6 @@ user_pref("layout.css.prefers-color-scheme.content-override", 1);
user_pref("gfx.offscreencanvas.enabled", true);
// A lot of tests use the Reporting API for observing things
user_pref("dom.reporting.enabled", true);
user_pref("layout.css.font-loading-api.workers.enabled", true);
// Enable WebDriver BiDi experimental commands and events during tests.
user_pref("remote.experimental.enabled", true);
// Disable always partitioning storage with the Storage Access API