Changeset 259531 in webkit


Ignore:
Timestamp:
Apr 4, 2020 10:06:23 AM (4 years ago)
Author:
Peng Liu
Message:

REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
https://bugs.webkit.org/show_bug.cgi?id=209680

Reviewed by Jer Noble.

Source/WebCore:

API test: WebKitLegacy.PreemptVideoFullscreen

Call fullscreenModeChanged(VideoFullscreenModeNone) right before calling the
functions of ChromeClient to make sure the state (m_videoFullscreenMode)
has the expected value when some callbacks come back to the video element.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::dispatchEvent):
(WebCore::HTMLMediaElement::exitFullscreen):

Add null pointer checkings to fix two crashes found in stress tests.

  • platform/ios/WebVideoFullscreenControllerAVKit.mm:

(VideoFullscreenControllerContext::requestVideoContentLayer):
(VideoFullscreenControllerContext::returnVideoContentLayer):

Source/WebKitLegacy/mac:

With this patch, the WebKit-Legacy can support multiple video elements request
to enter video fullscreen almost at the same time, and only the last one will succeed.
Also, this patch fixes webkit.org/b/209610 for WebKit-Legacy.

  • WebView/WebView.mm:
  • WebView/WebViewData.h:

Tools:

Add an API test for the video fullscreen support of WebKitLegacy on iOS.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitLegacy/ios/PreemptVideoFullscreen.mm: Added.

(-[VideoFullscreenStressUIWebViewDelegate webViewDidFinishLoad:]):
(-[VideoFullscreenStressUIWebViewDelegate uiWebView:didCommitLoadForFrame:]):
(-[VideoFullscreenStressUIWebViewDelegate handleEvent:]):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKitLegacy/ios/two-videos.html: Added.

LayoutTests:

Remove the crashing expectation for media/media-fullscreen-return-to-inline.html

  • platform/mac/TestExpectations:
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259516 r259531  
     12020-04-04  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
     4        https://bugs.webkit.org/show_bug.cgi?id=209680
     5
     6        Reviewed by Jer Noble.
     7
     8        Remove the crashing expectation for media/media-fullscreen-return-to-inline.html
     9
     10        * platform/mac/TestExpectations:
     11
    1122020-04-03  Truitt Savell  <tsavell@apple.com>
    213
  • trunk/LayoutTests/platform/mac/TestExpectations

    r259480 r259531  
    16521652webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ]
    16531653
    1654 webkit.org/b/193399 media/media-fullscreen-return-to-inline.html [ Pass Timeout Crash ]
     1654webkit.org/b/193399 media/media-fullscreen-return-to-inline.html [ Pass Timeout ]
    16551655
    16561656http/tests/websocket/tests/hybi/handshake-ok-with-legacy-sec-websocket-response-headers.html [ Pass Failure ]
  • trunk/Source/WebCore/ChangeLog

    r259527 r259531  
     12020-04-04  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
     4        https://bugs.webkit.org/show_bug.cgi?id=209680
     5
     6        Reviewed by Jer Noble.
     7
     8        API test: WebKitLegacy.PreemptVideoFullscreen
     9
     10        Call fullscreenModeChanged(VideoFullscreenModeNone) right before calling the
     11        functions of ChromeClient to make sure the state (m_videoFullscreenMode)
     12        has the expected value when some callbacks come back to the video element.
     13
     14        * html/HTMLMediaElement.cpp:
     15        (WebCore::HTMLMediaElement::dispatchEvent):
     16        (WebCore::HTMLMediaElement::exitFullscreen):
     17
     18        Add null pointer checkings to fix two crashes found in stress tests.
     19        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
     20        (VideoFullscreenControllerContext::requestVideoContentLayer):
     21        (VideoFullscreenControllerContext::returnVideoContentLayer):
     22
    1232020-04-03  David Kilzer  <ddkilzer@apple.com>
    224
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r259435 r259531  
    58175817    // to change the position/size back *before* exiting fullscreen.
    58185818    // Otherwise, the exit fullscreen animation will be incorrect.
    5819     if (!m_videoFullscreenStandby && event.type() == eventNames().webkitendfullscreenEvent)
     5819    if (!m_videoFullscreenStandby && event.type() == eventNames().webkitendfullscreenEvent) {
     5820        fullscreenModeChanged(VideoFullscreenModeNone);
    58205821        document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
     5822    }
    58215823}
    58225824
     
    60576059
    60586060#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    6059     if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped())
     6061    if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped()) {
     6062        fullscreenModeChanged(VideoFullscreenModeNone);
    60606063        document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
     6064    }
    60616065    else
    60626066#endif
    60636067    if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
    6064         if (m_videoFullscreenStandby)
     6068        if (m_videoFullscreenStandby) {
     6069            fullscreenModeChanged(VideoFullscreenModeNone);
    60656070            document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
     6071        }
    60666072
    60676073        scheduleEvent(eventNames().webkitendfullscreenEvent);
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r254490 r259531  
    261261        m_fullscreenModel->setVideoFullscreenLayer(videoFullscreenLayer.get(), [protectedThis = WTFMove(protectedThis), this] () mutable {
    262262            dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
     263                if (!m_interface)
     264                    return;
     265
    263266                m_interface->setHasVideoContentLayer(true);
    264267            });
     
    278281        m_fullscreenModel->setVideoFullscreenLayer(nil, [protectedThis = WTFMove(protectedThis), this] () mutable {
    279282            dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
     283                if (!m_interface)
     284                    return;
     285
    280286                m_interface->setHasVideoContentLayer(false);
    281287            });
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r259523 r259531  
     12020-04-04  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
     4        https://bugs.webkit.org/show_bug.cgi?id=209680
     5
     6        Reviewed by Jer Noble.
     7
     8        With this patch, the WebKit-Legacy can support multiple video elements request
     9        to enter video fullscreen almost at the same time, and only the last one will succeed.
     10        Also, this patch fixes webkit.org/b/209610 for WebKit-Legacy.
     11
     12        * WebView/WebView.mm:
     13        * WebView/WebViewData.h:
     14
    1152020-04-03  Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r259523 r259531  
    93379337        // First exit Fullscreen for the old videoElement.
    93389338        [_private->fullscreenController videoElement]->exitFullscreen();
    9339         // This previous call has to trigger _exitFullscreen,
    9340         // which has to clear _private->fullscreenController.
    9341         ASSERT(!_private->fullscreenController);
    9342     }
     9339        _private->fullscreenControllersExiting.append(std::exchange(_private->fullscreenController, nil));
     9340    }
     9341
    93439342    if (!_private->fullscreenController) {
    9344         _private->fullscreenController = [[WebVideoFullscreenController alloc] init];
     9343        _private->fullscreenController = adoptNS([[WebVideoFullscreenController alloc] init]);
    93459344        [_private->fullscreenController setVideoElement:videoElement];
    93469345#if PLATFORM(IOS_FAMILY)
     
    93569355- (void)_exitVideoFullscreen
    93579356{
    9358     if (!_private->fullscreenController)
    9359         return;
    9360     [_private->fullscreenController exitFullscreen];
    9361     [_private->fullscreenController release];
     9357    if (!_private->fullscreenController && _private->fullscreenControllersExiting.isEmpty())
     9358        return;
     9359
     9360    if (!_private->fullscreenControllersExiting.isEmpty()) {
     9361        auto controller = _private->fullscreenControllersExiting.first();
     9362        _private->fullscreenControllersExiting.remove(0);
     9363
     9364        [controller exitFullscreen];
     9365        return;
     9366    }
     9367
     9368    auto fullscreenController = _private->fullscreenController;
    93629369    _private->fullscreenController = nil;
     9370
     9371    [fullscreenController exitFullscreen];
    93639372}
    93649373
  • trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h

    r256834 r259531  
    317317    RetainPtr<NSImage> _mainFrameIcon;
    318318#endif
    319            
     319
    320320    NSSize lastLayoutSize;
    321321
    322322#if ENABLE(VIDEO)
    323     WebVideoFullscreenController *fullscreenController;
     323    RetainPtr<WebVideoFullscreenController> fullscreenController;
     324    Vector<RetainPtr<WebVideoFullscreenController>> fullscreenControllersExiting;
    324325#endif
    325326
  • trunk/Tools/ChangeLog

    r259523 r259531  
     12020-04-04  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS
     4        https://bugs.webkit.org/show_bug.cgi?id=209680
     5
     6        Reviewed by Jer Noble.
     7
     8        Add an API test for the video fullscreen support of WebKitLegacy on iOS.
     9
     10        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     11        * TestWebKitAPI/Tests/WebKitLegacy/ios/PreemptVideoFullscreen.mm: Added.
     12        (-[VideoFullscreenStressUIWebViewDelegate webViewDidFinishLoad:]):
     13        (-[VideoFullscreenStressUIWebViewDelegate uiWebView:didCommitLoadForFrame:]):
     14        (-[VideoFullscreenStressUIWebViewDelegate handleEvent:]):
     15        (TestWebKitAPI::TEST):
     16        * TestWebKitAPI/Tests/WebKitLegacy/ios/two-videos.html: Added.
     17
    1182020-04-03  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r259461 r259531  
    114114                1CF59AE321E68932006E37EC /* ForceLightAppearanceInBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */; };
    115115                1CF59AE521E6977D006E37EC /* dark-mode.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CF59AE421E696FB006E37EC /* dark-mode.html */; };
     116                1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */; };
     117                1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1D67BFD92433DFD8006B5047 /* two-videos.html */; };
    116118                1F83571B1D3FFB2300E3967B /* WKBackForwardList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */; };
    117119                26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
     
    15191521                                C22FA32D228F8AEB009D7988 /* TextWidth.html in Copy Resources */,
    15201522                                F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */,
     1523                                1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */,
    15211524                                C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */,
    15221525                                CD57779D211CE91F001B371E /* video-with-audio-and-web-audio.html in Copy Resources */,
     
    16651668                1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle_Bundle.mm; sourceTree = "<group>"; };
    16661669                1CF59AE421E696FB006E37EC /* dark-mode.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "dark-mode.html"; sourceTree = "<group>"; };
     1670                1D67BFD92433DFD8006B5047 /* two-videos.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-videos.html"; sourceTree = "<group>"; };
     1671                1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreemptVideoFullscreen.mm; sourceTree = "<group>"; };
    16671672                1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBackForwardList.mm; path = Tests/WebKit/WKBackForwardList.mm; sourceTree = SOURCE_ROOT; };
    16681673                260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; };
     
    43274332                                CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */,
    43284333                                E35FC7B122B82A6D00F32F98 /* JSLockTakesWebThreadLock.mm */,
     4334                                1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */,
    43294335                                CDC0932A21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm */,
    43304336                                F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */,
     
    43384344                        children = (
    43394345                                CD9E292D1C90C1BA000BB800 /* audio-only.html */,
     4346                                1D67BFD92433DFD8006B5047 /* two-videos.html */,
    43404347                                CDC8E4891BC5C96200594FEC /* video-with-audio.html */,
    43414348                                CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */,
     
    50035010                                7CCE7EA71A411A1300447C4C /* PlatformWebViewMac.mm in Sources */,
    50045011                                83BAEE8D1EF4625500DDE894 /* PluginLoadClientPolicies.mm in Sources */,
     5012                                1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */,
    50055013                                C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */,
    50065014                                7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.