Title: [262324] trunk
Revision
262324
Author
[email protected]
Date
2020-05-29 16:16:15 -0700 (Fri, 29 May 2020)

Log Message

[EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode.
https://bugs.webkit.org/show_bug.cgi?id=212540
<rdar://problem/61125757>

Reviewed by Eric Carlson.

Source/WebCore:

A MediaKeySystemAccess with a PUR session type will never be able to create media keys when created in
private browsing mode. Allow clients to fail over to non-PUR session by rejecting the promise returned by
requestMediaKeySystemAccess() when in private browsing mode.

Test: platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html

* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::getSupportedConfiguration):

LayoutTests:

* platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262323 => 262324)


--- trunk/LayoutTests/ChangeLog	2020-05-29 23:09:46 UTC (rev 262323)
+++ trunk/LayoutTests/ChangeLog	2020-05-29 23:16:15 UTC (rev 262324)
@@ -1,3 +1,14 @@
+2020-05-29  Jer Noble  <[email protected]>
+
+        [EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode.
+        https://bugs.webkit.org/show_bug.cgi?id=212540
+        <rdar://problem/61125757>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess-expected.txt: Added.
+        * platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html: Added.
+
 2020-05-29  Devin Rousso  <[email protected]>
 
         Web Inspector: add test for protocol "condition" logic

Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess-expected.txt (0 => 262324)


--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess-expected.txt	2020-05-29 23:16:15 UTC (rev 262324)
@@ -0,0 +1,4 @@
+RUN(promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities))
+Promise rejected correctly OK
+END OF TEST
+

Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html (0 => 262324)


--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html	2020-05-29 23:16:15 UTC (rev 262324)
@@ -0,0 +1,28 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+    <title>fps-ephemeral-requestMediaKeySystemAccess</title>
+    <script src=""
+    <script>
+    var capabilities = [{
+        initDataTypes: ['sinf'],
+        videoCapabilities: [{ contentType: 'video/mp4', robustness: '' }],
+        distinctiveIdentifier: 'not-allowed',
+        sessionTypes: ['persistent-usage-record'],
+    }];
+    var promise;
+    var access;
+
+    window.addEventListener('load', event => {
+        if (!window.internals)
+            consoleWrite('This test must be run in private browsing mode.')
+
+        run('promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities)');
+        shouldReject(promise).then(endTest, endTest);
+    });
+    </script>
+</head>
+<body>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (262323 => 262324)


--- trunk/Source/WebCore/ChangeLog	2020-05-29 23:09:46 UTC (rev 262323)
+++ trunk/Source/WebCore/ChangeLog	2020-05-29 23:16:15 UTC (rev 262324)
@@ -1,3 +1,20 @@
+2020-05-29  Jer Noble  <[email protected]>
+
+        [EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode.
+        https://bugs.webkit.org/show_bug.cgi?id=212540
+        <rdar://problem/61125757>
+
+        Reviewed by Eric Carlson.
+
+        A MediaKeySystemAccess with a PUR session type will never be able to create media keys when created in
+        private browsing mode. Allow clients to fail over to non-PUR session by rejecting the promise returned by
+        requestMediaKeySystemAccess() when in private browsing mode.
+
+        Test: platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html
+
+        * Modules/encryptedmedia/CDM.cpp:
+        (WebCore::CDM::getSupportedConfiguration):
+
 2020-05-29  Wenson Hsieh  <[email protected]>
 
         [iOS] Unable to paste images when composing mail at yahoo.com

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (262323 => 262324)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2020-05-29 23:09:46 UTC (rev 262323)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2020-05-29 23:16:15 UTC (rev 262324)
@@ -96,9 +96,11 @@
         return;
     }
 
+    bool isEphemeral = !document->page() || document->page()->sessionID().isEphemeral();
+
     SecurityOrigin& origin = document->securityOrigin();
     SecurityOrigin& topOrigin = document->topOrigin();
-    CDMPrivate::LocalStorageAccess access = origin.canAccessLocalStorage(&topOrigin) ? CDMPrivate::LocalStorageAccess::Allowed : CDMPrivate::LocalStorageAccess::NotAllowed;
+    CDMPrivate::LocalStorageAccess access = !isEphemeral && origin.canAccessLocalStorage(&topOrigin) ? CDMPrivate::LocalStorageAccess::Allowed : CDMPrivate::LocalStorageAccess::NotAllowed;
     m_private->getSupportedConfiguration(WTFMove(candidateConfiguration), access, WTFMove(callback));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to