Title: [204492] trunk
Revision
204492
Author
[email protected]
Date
2016-08-15 19:06:45 -0700 (Mon, 15 Aug 2016)

Log Message

ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
https://bugs.webkit.org/show_bug.cgi?id=160433

Reviewed by Eric Carlson.

Source/WebCore:

Early return from WebAVPlayerLayerView_videoView() if the PiP layer does not have a non-nil delegate view.

Test: media/controls/close-page-with-picture-in-picture-video-assertion-failure.html

* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebAVPlayerLayerView_videoView):

LayoutTests:

Add a layout test to ensure that we do not cause an assertion failure when exiting PiP by closing the tab.

* TestExpectations: Skip media/control/ipad tests on all ports. We will re-enable these tests for iOS.
* media/controls/close-page-with-picture-in-picture-video-assertion-failure-expected.txt: Added.
* media/controls/close-page-with-picture-in-picture-video-assertion-failure.html: Added.
* media/controls/resources/picture-in-picture.html: Added.
* platform/ios-simulator/TestExpectations: Mark tests media/control/ipad  as Pass so that we run them
in the iPad simulator.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204491 => 204492)


--- trunk/LayoutTests/ChangeLog	2016-08-16 01:43:31 UTC (rev 204491)
+++ trunk/LayoutTests/ChangeLog	2016-08-16 02:06:45 UTC (rev 204492)
@@ -1,3 +1,19 @@
+2016-08-15  Daniel Bates  <[email protected]>
+
+        ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
+        https://bugs.webkit.org/show_bug.cgi?id=160433
+
+        Reviewed by Eric Carlson.
+
+        Add a layout test to ensure that we do not cause an assertion failure when exiting PiP by closing the tab.
+
+        * TestExpectations: Skip media/control/ipad tests on all ports. We will re-enable these tests for iOS.
+        * media/controls/close-page-with-picture-in-picture-video-assertion-failure-expected.txt: Added.
+        * media/controls/close-page-with-picture-in-picture-video-assertion-failure.html: Added.
+        * media/controls/resources/picture-in-picture.html: Added.
+        * platform/ios-simulator/TestExpectations: Mark tests media/control/ipad  as Pass so that we run them
+        in the iPad simulator.
+
 2016-08-15  Jiewen Tan  <[email protected]>
 
         Expose crypto.getRandomValues to Web Workers

Modified: trunk/LayoutTests/TestExpectations (204491 => 204492)


--- trunk/LayoutTests/TestExpectations	2016-08-16 01:43:31 UTC (rev 204491)
+++ trunk/LayoutTests/TestExpectations	2016-08-16 02:06:45 UTC (rev 204492)
@@ -24,6 +24,7 @@
 fast/scrolling/ios [ Skip ]
 fast/content-observation [ Skip ]
 media/mac [ Skip ]
+media/controls/ipad [ Skip ]
 
 fast/forms/attributed-strings.html [ Skip ]
 fast/scrolling/latching [ Skip ]

Added: trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure-expected.txt (0 => 204492)


--- trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure-expected.txt	2016-08-16 02:06:45 UTC (rev 204492)
@@ -0,0 +1,10 @@
+This tests that closing a window that is presenting a video in picture-in-picture does not cause an assertion failure in a debug build. To run this test by hand, click the Open new window button then click the picture-in-picture button (tap the video on iOS).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS did not cause an assertion failure.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure.html (0 => 204492)


--- trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure.html	                        (rev 0)
+++ trunk/LayoutTests/media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure.html	2016-08-16 02:06:45 UTC (rev 204492)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+window.jsTestIsAsync = true;
+
+var child;
+
+if (window.testRunner) {
+    testRunner.setCanOpenWindows(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+
+// Called by resources/picture-in-picture.html
+function notifyDidChangePresentationMode()
+{
+    // For some reason waiting ~200ms to allow the video to transition from the page to its
+    // picture-in-picture window seems to make triggering the assertion more reliable (why?).
+    function closeWindowAndDone()
+    {
+        child.close(); // Trigger assertion failure
+        testPassed("did not cause an assertion failure.");
+        // For some reason waiting ~500ms after closing the window seems to make triggering the assertion more reliable (why?).
+        window.setTimeout(finishJSTest, 500);
+    }
+    window.setTimeout(closeWindowAndDone, 200);
+}
+
+function openNewWindow()
+{
+    child = window.open("resources/picture-in-picture.html");
+    document.body.removeChild(openNewWindowButton);
+}
+
+window._onload_ = function () {
+    var openNewWindowButton = document.getElementById("openNewWindowButton");
+    if (window.testRunner)
+        openNewWindow();
+    else
+        openNewWindowButton._onclick_ = openNewWindow;
+}
+</script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This tests that closing a window that is presenting a video in picture-in-picture does not cause an assertion failure in a debug build. To run this test by hand, click the Open new window button then click the picture-in-picture button (tap the video on iOS).");
+</script>
+<button id="openNewWindowButton">Open new window</button>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/media/controls/ipad/resources/picture-in-picture.html (0 => 204492)


--- trunk/LayoutTests/media/controls/ipad/resources/picture-in-picture.html	                        (rev 0)
+++ trunk/LayoutTests/media/controls/ipad/resources/picture-in-picture.html	2016-08-16 02:06:45 UTC (rev 204492)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<video controls></video>
+<script>
+if (window.internals)
+    internals.settings.setAllowsPictureInPictureMediaPlayback(true);
+
+function dispatchDidChangePresentationMode()
+{
+    window.opener.notifyDidChangePresentationMode();
+}
+
+var video = document.querySelector("video");
+if (window.internals)
+    internals.setMediaElementRestrictions(video, "NoRestrictions");
+video.addEventListener("webkitpresentationmodechanged", dispatchDidChangePresentationMode, false);
+video.addEventListener("canplaythrough", function () { video.webkitSetPresentationMode("picture-in-picture"); }, false);
+video.src = "" "../../../content/test");
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (204491 => 204492)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-08-16 01:43:31 UTC (rev 204491)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-08-16 02:06:45 UTC (rev 204492)
@@ -10,6 +10,7 @@
 displaylists [ Pass ]
 quicklook [ Pass ]
 http/tests/quicklook [ Pass ]
+media/controls/ipad [ Pass ]
 
 fast/text-autosizing/ios [ Pass ]
 

Modified: trunk/Source/WebCore/ChangeLog (204491 => 204492)


--- trunk/Source/WebCore/ChangeLog	2016-08-16 01:43:31 UTC (rev 204491)
+++ trunk/Source/WebCore/ChangeLog	2016-08-16 02:06:45 UTC (rev 204492)
@@ -1,3 +1,17 @@
+2016-08-15  Daniel Bates  <[email protected]>
+
+        ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
+        https://bugs.webkit.org/show_bug.cgi?id=160433
+
+        Reviewed by Eric Carlson.
+
+        Early return from WebAVPlayerLayerView_videoView() if the PiP layer does not have a non-nil delegate view.
+
+        Test: media/controls/close-page-with-picture-in-picture-video-assertion-failure.html
+
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebAVPlayerLayerView_videoView):
+
 2016-08-15  Alex Christensen  <[email protected]>
 
         Rename SocketStreamHandleBase to SocketStreamHandle and SocketStreamHandle to SocketStreamHandleImpl

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (204491 => 204492)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2016-08-16 01:43:31 UTC (rev 204491)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2016-08-16 02:06:45 UTC (rev 204492)
@@ -397,7 +397,7 @@
     __AVPlayerLayerView *playerLayer = aSelf;
     WebAVPlayerLayer *webAVPlayerLayer = (WebAVPlayerLayer *)[playerLayer playerLayer];
     CALayer* videoLayer = [webAVPlayerLayer videoSublayer];
-    if (!videoLayer)
+    if (!videoLayer || !videoLayer.delegate)
         return nil;
     ASSERT([[videoLayer delegate] isKindOfClass:getUIViewClass()]);
     return (UIView *)[videoLayer delegate];
@@ -430,7 +430,8 @@
 static void WebAVPlayerLayerView_stopRoutingVideoToPictureInPicturePlayerLayerView(id aSelf, SEL)
 {
     WebAVPlayerLayerView *playerLayerView = aSelf;
-    [playerLayerView addSubview:playerLayerView.videoView];
+    if (UIView *videoView = playerLayerView.videoView)
+        [playerLayerView addSubview:videoView];
     WebAVPictureInPicturePlayerLayerView *pipView = (WebAVPictureInPicturePlayerLayerView *)[playerLayerView pictureInPicturePlayerLayerView];
     WebAVPlayerLayer *playerLayer = (WebAVPlayerLayer *)[playerLayerView playerLayer];
     WebAVPlayerLayer *pipPlayerLayer = (WebAVPlayerLayer *)[pipView layer];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to