Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (242847 => 242848)
--- branches/safari-607-branch/Source/WebKit/ChangeLog 2019-03-13 07:48:12 UTC (rev 242847)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog 2019-03-13 08:24:09 UTC (rev 242848)
@@ -1,3 +1,38 @@
+2019-03-13 Babak Shafiei <[email protected]>
+
+ Cherry-pick r241002. rdar://problem/48839377
+
+ UserMediaPermissionRequestManagerProxy lambdas should check for 'this' being valid
+ https://bugs.webkit.org/show_bug.cgi?id=194246
+
+ Reviewed by Eric Carlson.
+
+ With PSON enabled, the manager proxy can be destroyed.
+ It is thus important for its callbacks to check for 'this' to be valid.
+
+ * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+ (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
+ (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
+ (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-02-05 Youenn Fablet <[email protected]>
+
+ UserMediaPermissionRequestManagerProxy lambdas should check for 'this' being valid
+ https://bugs.webkit.org/show_bug.cgi?id=194246
+
+ Reviewed by Eric Carlson.
+
+ With PSON enabled, the manager proxy can be destroyed.
+ It is thus important for its callbacks to check for 'this' to be valid.
+
+ * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+ (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
+ (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
+ (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
+
2019-03-12 Kocsen Chung <[email protected]>
Cherry-pick r242502. rdar://problem/48591282
Modified: branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (242847 => 242848)
--- branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp 2019-03-13 07:48:12 UTC (rev 242847)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp 2019-03-13 08:24:09 UTC (rev 242848)
@@ -93,7 +93,9 @@
return;
auto requestID = generateRequestID();
- auto handler = [this, requestID](bool originHasPersistentAccess) mutable {
+ auto handler = [this, weakThis = makeWeakPtr(*this), requestID](bool originHasPersistentAccess) mutable {
+ if (!weakThis)
+ return;
auto pendingRequest = m_pendingDeviceRequests.take(requestID);
if (!pendingRequest || !m_page.isValid())
@@ -383,7 +385,9 @@
};
auto requestID = generateRequestID();
- auto havePermissionInfoHandler = [this, requestID, validHandler = WTFMove(validHandler), invalidHandler = WTFMove(invalidHandler), localUserRequest = userRequest](bool originHasPersistentAccess) mutable {
+ auto havePermissionInfoHandler = [this, weakThis = makeWeakPtr(*this), requestID, validHandler = WTFMove(validHandler), invalidHandler = WTFMove(invalidHandler), localUserRequest = userRequest](bool originHasPersistentAccess) mutable {
+ if (!weakThis)
+ return;
auto pendingRequest = m_pendingDeviceRequests.take(requestID);
if (!pendingRequest)
@@ -455,12 +459,14 @@
static const int defaultMaximumMicrophoneCount = 1;
auto requestID = generateRequestID();
- auto completionHandler = [this, requestID, userMediaID, requestOrigin = userMediaDocumentOrigin.copyRef(), topOrigin = topLevelDocumentOrigin.copyRef()](bool originHasPersistentAccess) {
+ auto completionHandler = [this, weakThis = makeWeakPtr(*this), requestID, userMediaID, requestOrigin = userMediaDocumentOrigin.copyRef(), topOrigin = topLevelDocumentOrigin.copyRef()](bool originHasPersistentAccess) mutable {
+ if (!weakThis)
+ return;
if (!m_page.isValid())
return;
- m_page.websiteDataStore().deviceIdHashSaltStorage().deviceIdHashSaltForOrigin(requestOrigin.get(), topOrigin.get(), [this, weakThis = makeWeakPtr(*this), requestID, userMediaID, &originHasPersistentAccess] (String&& deviceIDHashSalt) {
+ m_page.websiteDataStore().deviceIdHashSaltStorage().deviceIdHashSaltForOrigin(requestOrigin.get(), topOrigin.get(), [this, weakThis = WTFMove(weakThis), requestID, userMediaID, &originHasPersistentAccess] (String&& deviceIDHashSalt) {
if (!weakThis)
return;
auto pendingRequest = m_pendingDeviceRequests.take(requestID);