Title: [264355] trunk
Revision
264355
Author
eric.carl...@apple.com
Date
2020-07-14 11:07:24 -0700 (Tue, 14 Jul 2020)

Log Message

[macOS] Do not update ScreenTime when in private browsing mode
https://bugs.webkit.org/show_bug.cgi?id=214288
<rdar://problem/63735067>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/media-usage-state-private-browsing.html

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::updateMediaUsageIfChanged): Return early if the
page is in private mode.

LayoutTests:

* media/media-usage-state-private-browsing-expected.txt: Added.
* media/media-usage-state-private-browsing.html: Added.
* platform/gtk/TestExpectations: Skip new test.
* platform/win/TestExpectations: Ditto.
* platform/wpe/TestExpectations: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264354 => 264355)


--- trunk/LayoutTests/ChangeLog	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/LayoutTests/ChangeLog	2020-07-14 18:07:24 UTC (rev 264355)
@@ -1,3 +1,17 @@
+2020-07-14  Eric Carlson  <eric.carl...@apple.com>
+
+        [macOS] Do not update ScreenTime when in private browsing mode
+        https://bugs.webkit.org/show_bug.cgi?id=214288
+        <rdar://problem/63735067>
+
+        Reviewed by Jer Noble.
+
+        * media/media-usage-state-private-browsing-expected.txt: Added.
+        * media/media-usage-state-private-browsing.html: Added.
+        * platform/gtk/TestExpectations: Skip new test.
+        * platform/win/TestExpectations: Ditto.
+        * platform/wpe/TestExpectations: Ditto.
+
 2020-07-14  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK] Gardening after r264345

Added: trunk/LayoutTests/media/media-usage-state-private-browsing-expected.txt (0 => 264355)


--- trunk/LayoutTests/media/media-usage-state-private-browsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-usage-state-private-browsing-expected.txt	2020-07-14 18:07:24 UTC (rev 264355)
@@ -0,0 +1,21 @@
+
+Test mediaUsageState.
+
+EVENT(canplaythrough)
+
+** Check state before playback, there should be no usage state.
+NotSupportedError: The operation is not supported.
+
+** Mute video, there should still be no usage state.
+RUN(video.muted = true)
+NotSupportedError: The operation is not supported.
+
+** Unmute video, there should still be no usage state.
+RUN(video.muted = false)
+NotSupportedError: The operation is not supported.
+
+** Try to play without user gesture, there should still be no usage state.
+EVENT(playing)
+NotSupportedError: The operation is not supported.
+END OF TEST
+

Added: trunk/LayoutTests/media/media-usage-state-private-browsing.html (0 => 264355)


--- trunk/LayoutTests/media/media-usage-state-private-browsing.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-usage-state-private-browsing.html	2020-07-14 18:07:24 UTC (rev 264355)
@@ -0,0 +1,53 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<html>
+    <head>
+        <script src=''></script>
+        <script src=''></script>
+        <script>
+
+            let usage;
+            let videoURL;
+
+            window.addEventListener('load', async event => {
+
+                if (!window.internals) {
+                    failTest(`<br>This test requires internals!`);
+                    return;
+                }
+
+                findMediaElement();
+
+                videoURL = findMediaFile("video", "content/test");
+                video.src = ""
+
+                await waitFor(video, 'canplaythrough');
+
+                consoleWrite("<br>** Check state before playback, there should be no usage state.");
+			    testExpected('internals.mediaUsageState(video)', "NotSupportedError");
+
+                consoleWrite("<br>** Mute video, there should still be no usage state.");
+                run('video.muted = true');
+			    testExpected('internals.mediaUsageState(video)', "NotSupportedError");
+
+                consoleWrite("<br>** Unmute video, there should still be no usage state.");
+                run('video.muted = false');
+			    testExpected('internals.mediaUsageState(video)', "NotSupportedError");
+
+                consoleWrite("<br>** Try to play without user gesture, there should still be no usage state.")
+                runWithKeyDown(() => { 
+                    video.play(); 
+                });
+                await waitFor(video, 'playing');
+
+			    testExpected('internals.mediaUsageState(video)', "NotSupportedError");
+
+                endTest();
+            });
+
+        </script>
+    </head>
+    <body>
+        <video controls></video>
+        <p>Test mediaUsageState.</p>
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (264354 => 264355)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2020-07-14 18:07:24 UTC (rev 264355)
@@ -1039,6 +1039,7 @@
 
 # Currently enabled on Mac only
 media/media-usage-state.html [ Skip ]
+media/media-usage-state-private-browsing.html [ Skip ]
 media/now-playing-status-without-media.html [ Skip ]
 
 # No support for screen capture

Modified: trunk/LayoutTests/platform/win/TestExpectations (264354 => 264355)


--- trunk/LayoutTests/platform/win/TestExpectations	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/LayoutTests/platform/win/TestExpectations	2020-07-14 18:07:24 UTC (rev 264355)
@@ -1163,6 +1163,7 @@
 
 # Currently enabled on Mac only
 media/media-usage-state.html [ Skip ]
+media/media-usage-state-private-browsing.html [ Skip ]
 media/now-playing-status-without-media.html [ Skip ]
 
 ################################################################################

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (264354 => 264355)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2020-07-14 18:07:24 UTC (rev 264355)
@@ -642,6 +642,7 @@
 
 # Currently enabled on Mac only
 media/media-usage-state.html [ Skip ]
+media/media-usage-state-private-browsing.html [ Skip ]
 media/now-playing-status-without-media.html [ Skip ]
 
 webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (264354 => 264355)


--- trunk/Source/WebCore/ChangeLog	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/Source/WebCore/ChangeLog	2020-07-14 18:07:24 UTC (rev 264355)
@@ -1,3 +1,17 @@
+2020-07-14  Eric Carlson  <eric.carl...@apple.com>
+
+        [macOS] Do not update ScreenTime when in private browsing mode
+        https://bugs.webkit.org/show_bug.cgi?id=214288
+        <rdar://problem/63735067>
+
+        Reviewed by Jer Noble.
+
+        Test: media/media-usage-state-private-browsing.html
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::updateMediaUsageIfChanged): Return early if the
+        page is in private mode.
+
 2020-07-14  Clark Wang  <clark_w...@apple.com>
 
         Updated AudioContext constructor according to spec

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (264354 => 264355)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2020-07-14 18:01:11 UTC (rev 264354)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2020-07-14 18:07:24 UTC (rev 264355)
@@ -1031,7 +1031,7 @@
 {
     auto& document = m_element.document();
     auto* page = document.page();
-    if (!page)
+    if (!page || page->sessionID().isEphemeral())
         return;
 
     bool isOutsideOfFullscreen = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to