Diff
Modified: trunk/LayoutTests/ChangeLog (261708 => 261709)
--- trunk/LayoutTests/ChangeLog 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/ChangeLog 2020-05-14 20:38:44 UTC (rev 261709)
@@ -1,3 +1,20 @@
+2020-05-14 Eric Carlson <[email protected]>
+
+ [Cocoa] Don't clear NowPlaying state unless it was set
+ https://bugs.webkit.org/show_bug.cgi?id=211899
+ <rdar://problem/62249870>
+
+ Reviewed by Jer Noble.
+
+ * media/now-playing-status-without-media-expected.txt: Added.
+ * media/now-playing-status-without-media.html: Added.
+
+ * gpu-process/TestExpectations: Skip test because media session isn't fully functional in GPUP.
+ * platform/mac-wk1/TestExpectations: Skip test because media session manager is a singleton.
+ * platform/gtk/TestExpectations: Skip Cocoa-only test.
+ * platform/win/TestExpectations: Ditto.
+ * platform/wpe/TestExpectations: Ditto.
+
2020-05-14 Myles C. Maxfield <[email protected]>
fast/text/multiple-codeunit-vertical-upright.html is failing
Modified: trunk/LayoutTests/gpu-process/TestExpectations (261708 => 261709)
--- trunk/LayoutTests/gpu-process/TestExpectations 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/gpu-process/TestExpectations 2020-05-14 20:38:44 UTC (rev 261709)
@@ -248,6 +248,7 @@
media/muted-video-is-playing-audio.html [ Skip ]
media/navigate-with-pip-should-not-crash.html [ Skip ]
+media/now-playing-status-without-media.html [ Skip ]
media/picture-in-picture/picture-in-picture-api-css-selector.html [ Skip ]
media/picture-in-picture/picture-in-picture-api-enter-pip-4.html [ Skip ]
media/picture-in-picture/picture-in-picture-api-events.html [ Skip ]
Added: trunk/LayoutTests/media/now-playing-status-without-media-expected.txt (0 => 261709)
--- trunk/LayoutTests/media/now-playing-status-without-media-expected.txt (rev 0)
+++ trunk/LayoutTests/media/now-playing-status-without-media-expected.txt 2020-05-14 20:38:44 UTC (rev 261709)
@@ -0,0 +1,16 @@
+
+NowPlaying status should not be updated when no media is active.
+
+
+** Check state initially.
+EXPECTED (state.haveEverRegisteredAsNowPlayingApplication == 'false') OK
+
+** Suspend process.
+RUN(internals.applicationWillBecomeInactive())
+EXPECTED (state.haveEverRegisteredAsNowPlayingApplication == 'false') OK
+
+** Activate process.
+RUN(internals.applicationDidBecomeActive())
+EXPECTED (state.haveEverRegisteredAsNowPlayingApplication == 'false') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/now-playing-status-without-media.html (0 => 261709)
--- trunk/LayoutTests/media/now-playing-status-without-media.html (rev 0)
+++ trunk/LayoutTests/media/now-playing-status-without-media.html 2020-05-14 20:38:44 UTC (rev 261709)
@@ -0,0 +1,38 @@
+<html>
+ <head>
+ <script src=""
+ <script>
+
+ let state;
+
+ window.addEventListener('load', async event => {
+
+ if (!window.internals) {
+ failTest(`<br>This test requires internals!`);
+ return;
+ }
+
+ consoleWrite("<br>** Check state initially.")
+ state = internals.nowPlayingState;
+ testExpected('state.haveEverRegisteredAsNowPlayingApplication', false);
+
+ consoleWrite("<br>** Suspend process.")
+ run('internals.applicationWillBecomeInactive()');
+ state = internals.nowPlayingState;
+ testExpected('state.haveEverRegisteredAsNowPlayingApplication', false);
+
+ consoleWrite("<br>** Activate process.")
+ run('internals.applicationDidBecomeActive()');
+ state = internals.nowPlayingState;
+ testExpected('state.haveEverRegisteredAsNowPlayingApplication', false);
+
+ endTest();
+ });
+
+ </script>
+ </head>
+ <body>
+ <video controls></video>
+ <p>NowPlaying status should not be updated when no media is active.</p>
+ </body>
+</html>
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (261708 => 261709)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2020-05-14 20:38:44 UTC (rev 261709)
@@ -1162,6 +1162,7 @@
# Currently enabled on Mac only
media/media-usage-state.html [ Skip ]
+media/now-playing-status-without-media.html [ Skip ]
# No support for WebGPU yet
webkit.org/b/191005 webgpu/ [ Skip ]
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (261708 => 261709)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2020-05-14 20:38:44 UTC (rev 261709)
@@ -196,8 +196,9 @@
fast/forms/color [ Skip ]
imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/color.html [ Skip ]
-# Audio session is a singleton
+# Audio session and media session manager are a singletons
platform/mac/media/media-source/media-source-change-source.html [ Skip ]
+media/now-playing-status-without-media.html [ Skip ]
#//////////////////////////////////////////////////////////////////////////////////////////
# End features not supported in WebKit1
Modified: trunk/LayoutTests/platform/win/TestExpectations (261708 => 261709)
--- trunk/LayoutTests/platform/win/TestExpectations 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/platform/win/TestExpectations 2020-05-14 20:38:44 UTC (rev 261709)
@@ -1163,6 +1163,7 @@
# Currently enabled on Mac only
media/media-usage-state.html [ Skip ]
+media/now-playing-status-without-media.html [ Skip ]
################################################################################
############################ End Media Failures ############################
Modified: trunk/LayoutTests/platform/wpe/TestExpectations (261708 => 261709)
--- trunk/LayoutTests/platform/wpe/TestExpectations 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/LayoutTests/platform/wpe/TestExpectations 2020-05-14 20:38:44 UTC (rev 261709)
@@ -724,6 +724,7 @@
# Currently enabled on Mac only
media/media-usage-state.html [ Skip ]
+media/now-playing-status-without-media.html [ Skip ]
webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php [ Failure ]
webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (261708 => 261709)
--- trunk/Source/WebCore/ChangeLog 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/ChangeLog 2020-05-14 20:38:44 UTC (rev 261709)
@@ -1,3 +1,27 @@
+2020-05-14 Eric Carlson <[email protected]>
+
+ [Cocoa] Don't clear NowPlaying state unless it was set
+ https://bugs.webkit.org/show_bug.cgi?id=211899
+ <rdar://problem/62249870>
+
+ Reviewed by Jer Noble.
+
+ Test: media/now-playing-status-without-media.html
+
+ * platform/audio/PlatformMediaSessionManager.h:
+ (WebCore::PlatformMediaSessionManager::haveEverRegisteredAsNowPlayingApplication const): Method
+ added for testing.
+
+ * platform/audio/cocoa/MediaSessionManagerCocoa.h:
+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+ (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Don't clear NowPlaying state unless
+ it was setup in the first place.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::nowPlayingState const): Add new property.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2020-05-14 Andres Gonzalez <[email protected]>
AXCoreObject font comparison methods should take another AXCoreObject instead of a RenderObject.
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (261708 => 261709)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2020-05-14 20:38:44 UTC (rev 261709)
@@ -72,6 +72,7 @@
virtual double lastUpdatedNowPlayingElapsedTime() const { return NAN; }
virtual MediaSessionIdentifier lastUpdatedNowPlayingInfoUniqueIdentifier() const { return { }; }
virtual bool registeredAsNowPlayingApplication() const { return false; }
+ virtual bool haveEverRegisteredAsNowPlayingApplication() const { return false; }
virtual void prepareToSendUserMediaPermissionRequest() { }
bool willIgnoreSystemInterruptions() const { return m_willIgnoreSystemInterruptions; }
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (261708 => 261709)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2020-05-14 20:38:44 UTC (rev 261709)
@@ -55,6 +55,8 @@
double lastUpdatedNowPlayingElapsedTime() const final { return m_lastUpdatedNowPlayingElapsedTime; }
MediaSessionIdentifier lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; }
bool registeredAsNowPlayingApplication() const final { return m_registeredAsNowPlayingApplication; }
+ bool haveEverRegisteredAsNowPlayingApplication() const final { return m_haveEverRegisteredAsNowPlayingApplication; }
+
void prepareToSendUserMediaPermissionRequest() final;
static WEBCORE_EXPORT void clearNowPlayingInfo();
@@ -100,6 +102,7 @@
bool m_nowPlayingActive { false };
bool m_registeredAsNowPlayingApplication { false };
+ bool m_haveEverRegisteredAsNowPlayingApplication { false };
// For testing purposes only.
String m_lastUpdatedNowPlayingTitle;
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (261708 => 261709)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2020-05-14 20:38:44 UTC (rev 261709)
@@ -322,9 +322,12 @@
nowPlayingInfo = session->nowPlayingInfo();
if (!nowPlayingInfo) {
- ALWAYS_LOG(LOGIDENTIFIER, "clearing now playing info");
- platformStrategies()->mediaStrategy().clearNowPlayingInfo();
+ if (m_registeredAsNowPlayingApplication) {
+ ALWAYS_LOG(LOGIDENTIFIER, "clearing now playing info");
+ platformStrategies()->mediaStrategy().clearNowPlayingInfo();
+ }
+
m_registeredAsNowPlayingApplication = false;
m_nowPlayingActive = false;
m_lastUpdatedNowPlayingTitle = emptyString();
@@ -335,8 +338,7 @@
return;
}
- ALWAYS_LOG(LOGIDENTIFIER, "title = \"", nowPlayingInfo->title, "\", isPlaying = ", nowPlayingInfo->isPlaying, ", duration = ", nowPlayingInfo->duration, ", now = ", nowPlayingInfo->currentTime, ", id = ", nowPlayingInfo->uniqueIdentifier.toUInt64(), ", registered = ", m_registeredAsNowPlayingApplication);
-
+ m_haveEverRegisteredAsNowPlayingApplication = true;
platformStrategies()->mediaStrategy().setNowPlayingInfo(!m_registeredAsNowPlayingApplication, *nowPlayingInfo);
if (!m_registeredAsNowPlayingApplication) {
@@ -344,6 +346,8 @@
providePresentingApplicationPIDIfNecessary();
}
+ ALWAYS_LOG(LOGIDENTIFIER, "title = \"", nowPlayingInfo->title, "\", isPlaying = ", nowPlayingInfo->isPlaying, ", duration = ", nowPlayingInfo->duration, ", now = ", nowPlayingInfo->currentTime, ", id = ", nowPlayingInfo->uniqueIdentifier.toUInt64(), ", registered = ", m_registeredAsNowPlayingApplication);
+
if (!nowPlayingInfo->title.isEmpty())
m_lastUpdatedNowPlayingTitle = nowPlayingInfo->title;
Modified: trunk/Source/WebCore/testing/Internals.cpp (261708 => 261709)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-05-14 20:38:44 UTC (rev 261709)
@@ -4282,7 +4282,8 @@
PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingElapsedTime(),
PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingInfoUniqueIdentifier().toUInt64(),
PlatformMediaSessionManager::sharedManager().hasActiveNowPlayingSession(),
- PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication()
+ PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication(),
+ PlatformMediaSessionManager::sharedManager().haveEverRegisteredAsNowPlayingApplication()
} };
#else
return Exception { InvalidAccessError };
Modified: trunk/Source/WebCore/testing/Internals.h (261708 => 261709)
--- trunk/Source/WebCore/testing/Internals.h 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/testing/Internals.h 2020-05-14 20:38:44 UTC (rev 261709)
@@ -830,6 +830,7 @@
uint64_t uniqueIdentifier;
bool hasActiveSession;
bool registeredAsNowPlayingApplication;
+ bool haveEverRegisteredAsNowPlayingApplication;
};
ExceptionOr<NowPlayingState> nowPlayingState() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (261708 => 261709)
--- trunk/Source/WebCore/testing/Internals.idl 2020-05-14 20:31:08 UTC (rev 261708)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-05-14 20:38:44 UTC (rev 261709)
@@ -105,12 +105,13 @@
Conditional=VIDEO,
JSGenerateToJSObject,
] dictionary NowPlayingState {
- boolean hasActiveSession;
- boolean registeredAsNowPlayingApplication;
DOMString title;
unrestricted double duration;
unrestricted double elapsedTime;
unsigned long long uniqueIdentifier;
+ boolean hasActiveSession;
+ boolean registeredAsNowPlayingApplication;
+ boolean haveEverRegisteredAsNowPlayingApplication;
};
[