Title: [241002] trunk/Source/WebKit
Revision
241002
Author
[email protected]
Date
2019-02-05 16:49:48 -0800 (Tue, 05 Feb 2019)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241001 => 241002)


--- trunk/Source/WebKit/ChangeLog	2019-02-06 00:39:46 UTC (rev 241001)
+++ trunk/Source/WebKit/ChangeLog	2019-02-06 00:49:48 UTC (rev 241002)
@@ -1,3 +1,18 @@
+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-02-05  Daniel Bates  <[email protected]>
 
         Attempt to fix the build following r241000

Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (241001 => 241002)


--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2019-02-06 00:39:46 UTC (rev 241001)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2019-02-06 00:49:48 UTC (rev 241002)
@@ -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())
@@ -391,7 +393,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)
@@ -467,12 +471,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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to