[webkit-changes] [WebKit/WebKit] 144fac: REGRESSION (275244 at main): Crash in MediaCapability...

aestes noreply at github.com
Thu Feb 29 19:36:46 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 144facca643556ff386784f2ff15735984bb049b
      https://github.com/WebKit/WebKit/commit/144facca643556ff386784f2ff15735984bb049b
  Author: Andy Estes <aestes at apple.com>
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
    M Source/WebKit/Platform/cocoa/MediaCapability.h
    M Source/WebKit/Platform/cocoa/MediaCapability.mm
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  REGRESSION (275244 at main): Crash in MediaCapability::MediaCapability when loading 'about:blank'
https://bugs.webkit.org/show_bug.cgi?id=270318
rdar://123856265

Reviewed by Jer Noble.

In 275244 at main MediaCapability was changed to track a SecurityOrigin rather than a URL. Since
'about:blank' is considered an opaque origin, a nil NSURL is returned by SecurityOrigin::toURL()
(after implicit conversion). A crash occurs when MediaCapability attempts to instantiate a
BEMediaEnvironment with the nil URL since -initWithWebPageURL: requires a nonnull NSURL.

Fixed this by reverting MediaCapability to storing the webpage URL as a WebCore::URL, and instead
using URL::protocolHostAndPort() and protocolHostAndPortAreEqual() to ensure that the
MediaEnvironment is not reset during same-origin navigations.

* Source/WebKit/Platform/cocoa/MediaCapability.h:
* Source/WebKit/Platform/cocoa/MediaCapability.mm:
(WebKit::createMediaEnvironment):
(WebKit::MediaCapability::MediaCapability):
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setMediaCapability):
(WebKit::WebPageProxy::deactivateMediaCapability):
(WebKit::WebPageProxy::resetMediaCapability):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/275533@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list