Title: [275651] trunk/Source/WebCore
Revision
275651
Author
[email protected]
Date
2021-04-07 21:21:19 -0700 (Wed, 07 Apr 2021)

Log Message

Site could crash if MediaRemote framework isn't available.
https://bugs.webkit.org/show_bug.cgi?id=224308
<rdar://problem/76273591>

Reviewed by Eric Carlson.

Check that MediaRemote framework is available before calling any of its method.
We put the check in the two static methods calling MediaRemote in order to keep all code dealing with MediaRemote in the same place.

* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::clearNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):  Add a test with isMediaRemoteFrameworkAvailable

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275650 => 275651)


--- trunk/Source/WebCore/ChangeLog	2021-04-08 02:19:20 UTC (rev 275650)
+++ trunk/Source/WebCore/ChangeLog	2021-04-08 04:21:19 UTC (rev 275651)
@@ -1,3 +1,18 @@
+2021-04-07  Jean-Yves Avenard  <[email protected]>
+
+        Site could crash if MediaRemote framework isn't available.
+        https://bugs.webkit.org/show_bug.cgi?id=224308
+        <rdar://problem/76273591>
+
+        Reviewed by Eric Carlson.
+
+        Check that MediaRemote framework is available before calling any of its method.
+        We put the check in the two static methods calling MediaRemote in order to keep all code dealing with MediaRemote in the same place.
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (WebCore::MediaSessionManagerCocoa::clearNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
+        (WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):  Add a test with isMediaRemoteFrameworkAvailable
+
 2021-04-02  Darin Adler  <[email protected]>
 
         Use Hasher more, remove IntegerHasher, fix hashing-related mistakes

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (275650 => 275651)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-04-08 02:19:20 UTC (rev 275650)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-04-08 04:21:19 UTC (rev 275651)
@@ -258,6 +258,9 @@
 
 void MediaSessionManagerCocoa::clearNowPlayingInfo()
 {
+    if (!isMediaRemoteFrameworkAvailable())
+        return;
+
     if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility())
         MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible);
 
@@ -275,6 +278,9 @@
 
 void MediaSessionManagerCocoa::setNowPlayingInfo(bool setAsNowPlayingApplication, const NowPlayingInfo& nowPlayingInfo)
 {
+    if (!isMediaRemoteFrameworkAvailable())
+        return;
+
     if (setAsNowPlayingApplication)
         MRMediaRemoteSetCanBeNowPlayingApplication(true);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to