diff --git a/dom/locales/en-US/dom/media.ftl b/dom/locales/en-US/dom/media.ftl deleted file mode 100644 index 8e2d4bf97a6f..000000000000 --- a/dom/locales/en-US/dom/media.ftl +++ /dev/null @@ -1,5 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -mediastatus-fallback-title = { -brand-short-name } is playing media diff --git a/dom/locales/jar.mn b/dom/locales/jar.mn index 84cb933a4cab..9cc596cb28d9 100644 --- a/dom/locales/jar.mn +++ b/dom/locales/jar.mn @@ -3,8 +3,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -[localization] @AB_CD@.jar: - dom (%dom/**/*.ftl) @AB_CD@.jar: locale/@AB_CD@/global/css.properties (%chrome/layout/css.properties) diff --git a/dom/media/mediacontrol/MediaControlService.cpp b/dom/media/mediacontrol/MediaControlService.cpp index 8d10fb8ff0d9..f37354f6de5e 100644 --- a/dom/media/mediacontrol/MediaControlService.cpp +++ b/dom/media/mediacontrol/MediaControlService.cpp @@ -6,16 +6,14 @@ #include "MediaController.h" #include "MediaControlUtils.h" + #include "mozilla/Assertions.h" -#include "mozilla/intl/Localization.h" #include "mozilla/Logging.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsIObserverService.h" #include "nsXULAppAPI.h" -using mozilla::intl::Localization; - #undef LOG #define LOG(msg, ...) \ MOZ_LOG(gMediaControlLog, LogLevel::Debug, \ @@ -113,24 +111,6 @@ void MediaControlService::Init() { MOZ_ASSERT(mMediaControlKeyManager->IsOpened()); mMediaControlKeyManager->AddListener(mMediaKeysHandler.get()); mControllerManager = MakeUnique(this); - - // Initialize the fallback title - nsCOMPtr global = - xpc::NativeGlobal(xpc::PrivilegedJunkScope()); - RefPtr l10n = Localization::Create(global, true, {}); - l10n->AddResourceId(u"branding/brand.ftl"_ns); - l10n->AddResourceId(u"dom/media.ftl"_ns); - { - AutoSafeJSContext cx; - - nsAutoCString translation; - ErrorResult rv; - l10n->FormatValueSync(cx, "mediastatus-fallback-title"_ns, {}, translation, - rv); - if (!rv.Failed()) { - mFallbackTitle = NS_ConvertUTF8toUTF16(translation); - } - } } MediaControlService::~MediaControlService() { @@ -282,10 +262,6 @@ MediaSessionPlaybackState MediaControlService::GetMainControllerPlaybackState() : MediaSessionPlaybackState::None; } -nsString MediaControlService::GetFallbackTitle() const { - return mFallbackTitle; -} - // Following functions belong to ControllerManager MediaControlService::ControllerManager::ControllerManager( MediaControlService* aService) diff --git a/dom/media/mediacontrol/MediaControlService.h b/dom/media/mediacontrol/MediaControlService.h index 4aa9af4421ca..7e1606794b64 100644 --- a/dom/media/mediacontrol/MediaControlService.h +++ b/dom/media/mediacontrol/MediaControlService.h @@ -82,11 +82,6 @@ class MediaControlService final : public nsIObserver { MediaMetadataBase GetMainControllerMediaMetadata() const; MediaSessionPlaybackState GetMainControllerPlaybackState() const; - // Media title that should be used as a fallback. This commonly used - // when playing media in private browsing mode and we are trying to avoid - // exposing potentially sensitive titles. - nsString GetFallbackTitle() const; - private: MediaControlService(); ~MediaControlService(); @@ -171,7 +166,6 @@ class MediaControlService final : public nsIObserver { RefPtr mMediaKeysHandler; MediaEventProducer mMediaControllerAmountChangedEvent; UniquePtr mControllerManager; - nsString mFallbackTitle; }; } // namespace dom diff --git a/dom/media/mediacontrol/MediaStatusManager.cpp b/dom/media/mediacontrol/MediaStatusManager.cpp index 8173df75dc9d..d190b28ab2f6 100644 --- a/dom/media/mediacontrol/MediaStatusManager.cpp +++ b/dom/media/mediacontrol/MediaStatusManager.cpp @@ -198,8 +198,9 @@ MediaMetadataBase MediaStatusManager::CreateDefaultMetadata() const { } nsString MediaStatusManager::GetDefaultTitle() const { - RefPtr service = MediaControlService::GetService(); - nsString defaultTitle = service->GetFallbackTitle(); + // TODO : maybe need l10n? (bug1657701) + nsString defaultTitle; + defaultTitle.AssignLiteral("Firefox is playing media"); RefPtr bc = CanonicalBrowsingContext::Get(mTopLevelBrowsingContextId); diff --git a/dom/media/mediacontrol/tests/head.js b/dom/media/mediacontrol/tests/head.js index 04e20053dd9b..632bb36630c2 100644 --- a/dom/media/mediacontrol/tests/head.js +++ b/dom/media/mediacontrol/tests/head.js @@ -220,23 +220,13 @@ function isCurrentMetadataEqualTo(metadata) { * the `options`. */ async function isGivenTabUsingDefaultMetadata(tab, options = {}) { - const localization = new Localization([ - "branding/brand.ftl", - "dom/media.ftl", - ]); - const fallbackTitle = await localization.formatValue( - "mediastatus-fallback-title" - ); - ok(fallbackTitle.length > 0, "l10n fallback title is not empty"); - const metadata = tab.linkedBrowser.browsingContext.mediaController.getMetadata(); - await SpecialPowers.spawn( tab.linkedBrowser, - [metadata.title, fallbackTitle, options.isPrivateBrowsing], - (title, fallbackTitle, isPrivateBrowsing) => { + [metadata.title, options.isPrivateBrowsing], + (title, isPrivateBrowsing) => { if (isPrivateBrowsing || !content.document.title.length) { - is(title, fallbackTitle, "Using a generic default fallback title"); + is(title, "Firefox is playing media", "Using a generic default title"); } else { is( title,