Changeset 275651 in webkit


Ignore:
Timestamp:
Apr 7, 2021 9:21:19 PM (3 years ago)
Author:
Jean-Yves Avenard
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

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r275650 r275651  
     12021-04-07  Jean-Yves Avenard  <jya@apple.com>
     2
     3        Site could crash if MediaRemote framework isn't available.
     4        https://bugs.webkit.org/show_bug.cgi?id=224308
     5        <rdar://problem/76273591>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Check that MediaRemote framework is available before calling any of its method.
     10        We put the check in the two static methods calling MediaRemote in order to keep all code dealing with MediaRemote in the same place.
     11
     12        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
     13        (WebCore::MediaSessionManagerCocoa::clearNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
     14        (WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):  Add a test with isMediaRemoteFrameworkAvailable
     15
    1162021-04-02  Darin Adler  <darin@apple.com>
    217
  • trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm

    r275360 r275651  
    259259void MediaSessionManagerCocoa::clearNowPlayingInfo()
    260260{
     261    if (!isMediaRemoteFrameworkAvailable())
     262        return;
     263
    261264    if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility())
    262265        MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible);
     
    276279void MediaSessionManagerCocoa::setNowPlayingInfo(bool setAsNowPlayingApplication, const NowPlayingInfo& nowPlayingInfo)
    277280{
     281    if (!isMediaRemoteFrameworkAvailable())
     282        return;
     283
    278284    if (setAsNowPlayingApplication)
    279285        MRMediaRemoteSetCanBeNowPlayingApplication(true);
Note: See TracChangeset for help on using the changeset viewer.