Title: [198160] trunk
Revision
198160
Author
[email protected]
Date
2016-03-14 14:53:10 -0700 (Mon, 14 Mar 2016)

Log Message

REGRESSION (r197114): Crash in WebCore::MediaDevicesRequest::didCompletePermissionCheck
https://bugs.webkit.org/show_bug.cgi?id=155453
<rdar://problem/24879447>

Reviewed by Daniel Bates.

Source/WebCore:

Tested by fast/mediastream/enumerating-crash.html.

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::didCompletePermissionCheck): Prevent UserMediaPermissionCheck object from being
destroyed before the method completes.

LayoutTests:

* fast/mediastream/enumerating-crash-expected.txt: Added.
* fast/mediastream/enumerating-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198159 => 198160)


--- trunk/LayoutTests/ChangeLog	2016-03-14 21:50:20 UTC (rev 198159)
+++ trunk/LayoutTests/ChangeLog	2016-03-14 21:53:10 UTC (rev 198160)
@@ -1,3 +1,14 @@
+2016-03-14  Brent Fulgham  <[email protected]>
+
+        REGRESSION (r197114): Crash in WebCore::MediaDevicesRequest::didCompletePermissionCheck
+        https://bugs.webkit.org/show_bug.cgi?id=155453
+        <rdar://problem/24879447>
+
+        Reviewed by Daniel Bates.
+
+        * fast/mediastream/enumerating-crash-expected.txt: Added.
+        * fast/mediastream/enumerating-crash.html: Added.
+
 2016-03-14  Saam barati  <[email protected]>
 
         [ES6] Disallow var assignments in for-in loops

Added: trunk/LayoutTests/fast/mediastream/enumerating-crash-expected.txt (0 => 198160)


--- trunk/LayoutTests/fast/mediastream/enumerating-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/enumerating-crash-expected.txt	2016-03-14 21:53:10 UTC (rev 198160)
@@ -0,0 +1 @@
+Test to ensure we don't crash when enumerating media devices. The test passes if it does not crash.

Added: trunk/LayoutTests/fast/mediastream/enumerating-crash.html (0 => 198160)


--- trunk/LayoutTests/fast/mediastream/enumerating-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/enumerating-crash.html	2016-03-14 21:53:10 UTC (rev 198160)
@@ -0,0 +1,33 @@
+<html>
+<head>
+</head>
+<body>
+<p>Test to ensure we don't crash when enumerating media devices. The test passes if it does not crash.</p>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+</script>
+</body>
+<script>
+function shouldNotCrash() {
+    try {
+        document.addEventListener("webglcontextlost", function () {
+            var x = window.navigator.mediaDevices;
+            x.enumerateDevices();
+            x.getUserMediaFromJS(123456789.);
+        }, true);
+
+        var dispatch_fn = function() {
+            var evt = document.createEvent("Event");
+            evt.initEvent("webglcontextlost", false, false);
+            document.dispatchEvent(evt);
+        }
+        window.setInterval(dispatch_fn, 202);
+    } catch(e) {
+        document.write("Errlog shouldNotCrash: " + e.name + ": " + e.message + "<br>");
+    }
+}
+shouldNotCrash();
+</script>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (198159 => 198160)


--- trunk/Source/WebCore/ChangeLog	2016-03-14 21:50:20 UTC (rev 198159)
+++ trunk/Source/WebCore/ChangeLog	2016-03-14 21:53:10 UTC (rev 198160)
@@ -1,3 +1,17 @@
+2016-03-14  Brent Fulgham  <[email protected]>
+
+        REGRESSION (r197114): Crash in WebCore::MediaDevicesRequest::didCompletePermissionCheck
+        https://bugs.webkit.org/show_bug.cgi?id=155453
+        <rdar://problem/24879447>
+
+        Reviewed by Daniel Bates.
+
+        Tested by fast/mediastream/enumerating-crash.html.
+
+        * Modules/mediastream/MediaDevicesRequest.cpp:
+        (WebCore::MediaDevicesRequest::didCompletePermissionCheck): Prevent UserMediaPermissionCheck object from being
+        destroyed before the method completes.
+
 2016-03-14  Simon Fraser  <[email protected]>
 
         Fix crash when reloading a page using requestAnimationFrame on iOS

Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp (198159 => 198160)


--- trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp	2016-03-14 21:50:20 UTC (rev 198159)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp	2016-03-14 21:53:10 UTC (rev 198160)
@@ -85,13 +85,14 @@
 
 void MediaDevicesRequest::didCompletePermissionCheck(const String& salt, bool canAccess)
 {
+    RefPtr<UserMediaPermissionCheck> permissionCheckProtector = m_permissionCheck;
     m_permissionCheck->setClient(nullptr);
     m_permissionCheck = nullptr;
 
     m_idHashSalt = salt;
     m_havePersistentPermission = canAccess;
 
-    callOnMainThread([this] {
+    callOnMainThread([this, permissionCheckProtector] {
         RealtimeMediaSourceCenter::singleton().getMediaStreamTrackSources(this);
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to