[iOS] Returning from Auto-PiP causes Safari to be unresponsive
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 18:29:02 +0000 (18:29 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 18:29:02 +0000 (18:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182977
<rdar://problem/37685981>

Reviewed by Jer Noble.

Remove the error handling added in r228115, it breaks auto-pip.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
(VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
(VideoFullscreenInterfaceAVKit::exitFullscreen):
(VideoFullscreenInterfaceAVKit::cleanupFullscreen):
(VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
(VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
(VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
(VideoFullscreenInterfaceAVKit::enterFullscreenHandler):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228824 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

index 5f2d8faf70c665d341765ed64e2fda30bac08fcb..c92b8e16fe9ef3207d7899d06ab865a5e5f9d64b 100644 (file)
@@ -1,3 +1,23 @@
+2018-02-20  Eric Carlson  <eric.carlson@apple.com>
+
+        [iOS] Returning from Auto-PiP causes Safari to be unresponsive
+        https://bugs.webkit.org/show_bug.cgi?id=182977
+        <rdar://problem/37685981>
+
+        Reviewed by Jer Noble.
+
+        Remove the error handling added in r228115, it breaks auto-pip.
+
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
+        (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
+        (VideoFullscreenInterfaceAVKit::exitFullscreen):
+        (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
+        (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
+        (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
+        (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
+        (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
+
 2018-02-20  Jer Noble  <jer.noble@apple.com>
 
         [EME] Adopt new AVContentKeySession success delegate callback
index 7fcec8227e6a4449f6abaf52cf6ceecd89bff831..dfb0695e2a85a11ad155a4376099c6403b054750 100644 (file)
@@ -592,10 +592,8 @@ void VideoFullscreenInterfaceAVKit::applicationDidBecomeActive()
     if (m_currentMode.hasFullscreen() && m_currentMode.hasPictureInPicture()) {
         [[m_playerViewController view] layoutIfNeeded];
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError* error) {
-            if (!success) {
+            if (!success)
                 WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-                ASSERT_NOT_REACHED();
-            }
 
             [m_window setHidden:YES];
             [[m_playerViewController view] setHidden:YES];
@@ -721,12 +719,8 @@ void VideoFullscreenInterfaceAVKit::enterFullscreenStandard()
 
     [[m_playerViewController view] layoutIfNeeded];
     [m_playerViewController enterFullScreenAnimated:YES completionHandler:[this, protectedThis = makeRefPtr(this)] (BOOL succeeded, NSError* error) {
-        if (!succeeded) {
+        if (!succeeded)
             WTFLogAlways("-[AVPlayerViewController enterFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-            ASSERT_NOT_REACHED();
-            m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, YES);
-            return;
-        }
 
         LOG(Fullscreen, "VideoFullscreenInterfaceAVKit::enterFullscreenStandard - lambda(%p) - succeeded(%s)", this, boolString(succeeded));
         [m_playerViewController setShowsPlaybackControls:YES];
@@ -763,10 +757,8 @@ void VideoFullscreenInterfaceAVKit::exitFullscreen(const IntRect& finalRect)
         [m_playerViewController stopPictureInPicture];
     } else if (m_currentMode.hasPictureInPicture() && m_currentMode.hasFullscreen()) {
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError* error) {
-            if (!success) {
+            if (!success)
                 WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-                ASSERT_NOT_REACHED();
-            }
 
             clearMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
             [m_window setHidden:NO];
@@ -774,9 +766,8 @@ void VideoFullscreenInterfaceAVKit::exitFullscreen(const IntRect& finalRect)
         }];
     } else if (m_currentMode.isFullscreen()) {
         [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError* error) mutable {
-            if (!success) {
+            if (!success)
                 WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-            }
 
             m_exitCompleted = true;
 
@@ -811,9 +802,8 @@ void VideoFullscreenInterfaceAVKit::cleanupFullscreen()
     if (m_currentMode.hasFullscreen()) {
         [[m_playerViewController view] layoutIfNeeded];
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[] (BOOL success, NSError* error) {
-            if (!success) {
+            if (!success)
                 WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-            }
         }];
     }
     
@@ -902,10 +892,8 @@ void VideoFullscreenInterfaceAVKit::didStartPictureInPicture()
         if (![m_playerViewController pictureInPictureWasStartedWhenEnteringBackground]) {
             [[m_playerViewController view] layoutIfNeeded];
             [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError* error) {
-                if (!success) {
+                if (!success)
                     WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-                    ASSERT_NOT_REACHED();
-                }
                 [m_window setHidden:YES];
                 [[m_playerViewController view] setHidden:YES];
             }];
@@ -989,12 +977,8 @@ void VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletion
 
         [[m_playerViewController view] layoutIfNeeded];
         [m_playerViewController enterFullScreenAnimated:YES completionHandler:^(BOOL succeeded, NSError *error) {
-            if (!succeeded) {
+            if (!succeeded)
                 WTFLogAlways("-[AVPlayerViewController enterFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-                ASSERT_NOT_REACHED();
-                m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, YES);
-                return;
-            }
 
             m_restoringFullscreenForPictureInPictureStop = false;
             setMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
@@ -1110,10 +1094,8 @@ void VideoFullscreenInterfaceAVKit::cleanupFullscreen()
     if (m_currentMode.hasFullscreen()) {
         [[m_playerViewController view] layoutIfNeeded];
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[] (BOOL success, NSError* error) {
-            if (!success) {
+            if (!success)
                 WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-                ASSERT_NOT_REACHED();
-            }
         }];
     }
     
@@ -1554,11 +1536,9 @@ void VideoFullscreenInterfaceAVKit::doExitFullscreen()
 
 void VideoFullscreenInterfaceAVKit::exitFullscreenHandler(BOOL success, NSError* error)
 {
-    if (!success) {
+    if (!success)
         WTFLogAlways("-[AVPlayerViewController exitFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-    }
 
-    UNUSED_PARAM(success);
     LOG(Fullscreen, "VideoFullscreenInterfaceAVKit::didExitFullscreen(%p) - %d", this, success);
 
     clearMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
@@ -1583,12 +1563,8 @@ void VideoFullscreenInterfaceAVKit::exitFullscreenHandler(BOOL success, NSError*
 
 void VideoFullscreenInterfaceAVKit::enterFullscreenHandler(BOOL success, NSError* error)
 {
-    if (!success) {
+    if (!success)
         WTFLogAlways("-[AVPlayerViewController enterFullScreenAnimated:completionHandler:] failed with error %s", [[error localizedDescription] UTF8String]);
-        ASSERT_NOT_REACHED();
-        m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, YES);
-        return;
-    }
 
     LOG(Fullscreen, "VideoFullscreenInterfaceAVKit::enterFullscreenStandard - lambda(%p)", this);
     setMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);