Diff
Modified: trunk/LayoutTests/ChangeLog (259530 => 259531)
--- trunk/LayoutTests/ChangeLog 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/LayoutTests/ChangeLog 2020-04-04 17:06:23 UTC (rev 259531)
@@ -1,3 +1,14 @@
+2020-04-04 Peng Liu <[email protected]>
+
+ 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.
+
+ Remove the crashing expectation for media/media-fullscreen-return-to-inline.html
+
+ * platform/mac/TestExpectations:
+
2020-04-03 Truitt Savell <[email protected]>
Unreviewed, reverting r259440.
Modified: trunk/LayoutTests/platform/mac/TestExpectations (259530 => 259531)
--- trunk/LayoutTests/platform/mac/TestExpectations 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2020-04-04 17:06:23 UTC (rev 259531)
@@ -1651,7 +1651,7 @@
webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html [ Pass Failure ]
webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ]
-webkit.org/b/193399 media/media-fullscreen-return-to-inline.html [ Pass Timeout Crash ]
+webkit.org/b/193399 media/media-fullscreen-return-to-inline.html [ Pass Timeout ]
http/tests/websocket/tests/hybi/handshake-ok-with-legacy-sec-websocket-response-headers.html [ Pass Failure ]
Modified: trunk/Source/WebCore/ChangeLog (259530 => 259531)
--- trunk/Source/WebCore/ChangeLog 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebCore/ChangeLog 2020-04-04 17:06:23 UTC (rev 259531)
@@ -1,3 +1,25 @@
+2020-04-04 Peng Liu <[email protected]>
+
+ 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.
+
+ 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):
+
2020-04-03 David Kilzer <[email protected]>
Build fix: HTMLFormElement should use WeakPtr to keep track of its FormNamedItem
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (259530 => 259531)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-04-04 17:06:23 UTC (rev 259531)
@@ -5816,8 +5816,10 @@
// We need to fire the end fullscreen event to notify the page
// to change the position/size back *before* exiting fullscreen.
// Otherwise, the exit fullscreen animation will be incorrect.
- if (!m_videoFullscreenStandby && event.type() == eventNames().webkitendfullscreenEvent)
+ if (!m_videoFullscreenStandby && event.type() == eventNames().webkitendfullscreenEvent) {
+ fullscreenModeChanged(VideoFullscreenModeNone);
document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
+ }
}
bool HTMLMediaElement::addEventListener(const AtomString& eventType, Ref<EventListener>&& listener, const AddEventListenerOptions& options)
@@ -6056,13 +6058,17 @@
}
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
- if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped())
+ if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped()) {
+ fullscreenModeChanged(VideoFullscreenModeNone);
document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
+ }
else
#endif
if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
- if (m_videoFullscreenStandby)
+ if (m_videoFullscreenStandby) {
+ fullscreenModeChanged(VideoFullscreenModeNone);
document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
+ }
scheduleEvent(eventNames().webkitendfullscreenEvent);
}
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (259530 => 259531)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2020-04-04 17:06:23 UTC (rev 259531)
@@ -260,6 +260,9 @@
[videoFullscreenLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
m_fullscreenModel->setVideoFullscreenLayer(videoFullscreenLayer.get(), [protectedThis = WTFMove(protectedThis), this] () mutable {
dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
+ if (!m_interface)
+ return;
+
m_interface->setHasVideoContentLayer(true);
});
});
@@ -277,6 +280,9 @@
[videoFullscreenLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
m_fullscreenModel->setVideoFullscreenLayer(nil, [protectedThis = WTFMove(protectedThis), this] () mutable {
dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
+ if (!m_interface)
+ return;
+
m_interface->setHasVideoContentLayer(false);
});
});
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (259530 => 259531)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-04-04 17:06:23 UTC (rev 259531)
@@ -1,3 +1,17 @@
+2020-04-04 Peng Liu <[email protected]>
+
+ 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.
+
+ 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:
+
2020-04-03 Alex Christensen <[email protected]>
Add SPI to make WKUserScripts wait for a notification
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (259530 => 259531)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2020-04-04 17:06:23 UTC (rev 259531)
@@ -9336,12 +9336,11 @@
// First exit Fullscreen for the old videoElement.
[_private->fullscreenController videoElement]->exitFullscreen();
- // This previous call has to trigger _exitFullscreen,
- // which has to clear _private->fullscreenController.
- ASSERT(!_private->fullscreenController);
+ _private->fullscreenControllersExiting.append(std::exchange(_private->fullscreenController, nil));
}
+
if (!_private->fullscreenController) {
- _private->fullscreenController = [[WebVideoFullscreenController alloc] init];
+ _private->fullscreenController = adoptNS([[WebVideoFullscreenController alloc] init]);
[_private->fullscreenController setVideoElement:videoElement];
#if PLATFORM(IOS_FAMILY)
[_private->fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate] mode:mode];
@@ -9355,11 +9354,21 @@
- (void)_exitVideoFullscreen
{
- if (!_private->fullscreenController)
+ if (!_private->fullscreenController && _private->fullscreenControllersExiting.isEmpty())
return;
- [_private->fullscreenController exitFullscreen];
- [_private->fullscreenController release];
+
+ if (!_private->fullscreenControllersExiting.isEmpty()) {
+ auto controller = _private->fullscreenControllersExiting.first();
+ _private->fullscreenControllersExiting.remove(0);
+
+ [controller exitFullscreen];
+ return;
+ }
+
+ auto fullscreenController = _private->fullscreenController;
_private->fullscreenController = nil;
+
+ [fullscreenController exitFullscreen];
}
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h (259530 => 259531)
--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h 2020-04-04 17:06:23 UTC (rev 259531)
@@ -316,11 +316,12 @@
NSPasteboard *insertionPasteboard;
RetainPtr<NSImage> _mainFrameIcon;
#endif
-
+
NSSize lastLayoutSize;
#if ENABLE(VIDEO)
- WebVideoFullscreenController *fullscreenController;
+ RetainPtr<WebVideoFullscreenController> fullscreenController;
+ Vector<RetainPtr<WebVideoFullscreenController>> fullscreenControllersExiting;
#endif
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
Modified: trunk/Tools/ChangeLog (259530 => 259531)
--- trunk/Tools/ChangeLog 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Tools/ChangeLog 2020-04-04 17:06:23 UTC (rev 259531)
@@ -1,3 +1,20 @@
+2020-04-04 Peng Liu <[email protected]>
+
+ 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.
+
+ 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.
+
2020-04-03 Alex Christensen <[email protected]>
Add SPI to make WKUserScripts wait for a notification
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (259530 => 259531)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-04 16:14:49 UTC (rev 259530)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-04 17:06:23 UTC (rev 259531)
@@ -113,6 +113,8 @@
1CF59AE221E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */; };
1CF59AE321E68932006E37EC /* ForceLightAppearanceInBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */; };
1CF59AE521E6977D006E37EC /* dark-mode.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CF59AE421E696FB006E37EC /* dark-mode.html */; };
+ 1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */; };
+ 1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1D67BFD92433DFD8006B5047 /* two-videos.html */; };
1F83571B1D3FFB2300E3967B /* WKBackForwardList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */; };
26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
26F52EAD1828827B0023D412 /* geolocationGetCurrentPosition.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26F52EAC1828820E0023D412 /* geolocationGetCurrentPosition.html */; };
@@ -1518,6 +1520,7 @@
F41AB9AA1EF4696B0083FA08 /* textarea-to-input.html in Copy Resources */,
C22FA32D228F8AEB009D7988 /* TextWidth.html in Copy Resources */,
F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */,
+ 1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */,
C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */,
CD57779D211CE91F001B371E /* video-with-audio-and-web-audio.html in Copy Resources */,
CDC8E4941BC6F10800594FEC /* video-with-audio.html in Copy Resources */,
@@ -1664,6 +1667,8 @@
1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle.mm; sourceTree = "<group>"; };
1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle_Bundle.mm; sourceTree = "<group>"; };
1CF59AE421E696FB006E37EC /* dark-mode.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "dark-mode.html"; sourceTree = "<group>"; };
+ 1D67BFD92433DFD8006B5047 /* two-videos.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-videos.html"; sourceTree = "<group>"; };
+ 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreemptVideoFullscreen.mm; sourceTree = "<group>"; };
1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBackForwardList.mm; path = Tests/WebKit/WKBackForwardList.mm; sourceTree = SOURCE_ROOT; };
260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; };
260BA57A1B1D2EE2004FA07C /* DFAHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFAHelpers.h; sourceTree = "<group>"; };
@@ -4326,6 +4331,7 @@
CDC8E49A1BC728FE00594FEC /* Resources */,
CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */,
E35FC7B122B82A6D00F32F98 /* JSLockTakesWebThreadLock.mm */,
+ 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */,
CDC0932A21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm */,
F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */,
0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */,
@@ -4337,6 +4343,7 @@
isa = PBXGroup;
children = (
CD9E292D1C90C1BA000BB800 /* audio-only.html */,
+ 1D67BFD92433DFD8006B5047 /* two-videos.html */,
CDC8E4891BC5C96200594FEC /* video-with-audio.html */,
CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */,
CD321B031E3A84B700EB21C8 /* video-with-muted-audio-and-webaudio.html */,
@@ -5002,6 +5009,7 @@
7CCE7EA61A411A0F00447C4C /* PlatformUtilitiesMac.mm in Sources */,
7CCE7EA71A411A1300447C4C /* PlatformWebViewMac.mm in Sources */,
83BAEE8D1EF4625500DDE894 /* PluginLoadClientPolicies.mm in Sources */,
+ 1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */,
C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */,
7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */,
CD227E44211A4D5D00D285AF /* PreferredAudioBufferSize.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/PreemptVideoFullscreen.mm (0 => 259531)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/PreemptVideoFullscreen.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/PreemptVideoFullscreen.mm 2020-04-04 17:06:23 UTC (rev 259531)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if HAVE(UIWEBVIEW)
+
+#import "PlatformUtilities.h"
+#import <UIKit/UIKit.h>
+#import <WebKit/DOMHTMLMediaElement.h>
+#import <WebKit/WebFramePrivate.h>
+#import <WebKitLegacy/WebPreferencesPrivate.h>
+#import <wtf/MainThread.h>
+#import <wtf/RetainPtr.h>
+
+static bool didFinishLoad = false;
+static bool gotMainFrame = false;
+static RetainPtr<WebFrame> mainFrame;
+static int countOfVideoElementsCanPlay = 0;
+static bool readyToTest = false;
+static int fullscreenBegin = 0;
+static int fullscreenEnd = 0;
+static bool doneTest = false;
+
+@interface PreemptVideoFullscreenUIWebViewDelegate : NSObject <UIWebViewDelegate, DOMEventListener>
+@end
+
+@implementation PreemptVideoFullscreenUIWebViewDelegate
+IGNORE_WARNINGS_BEGIN("deprecated-implementations")
+- (void)webViewDidFinishLoad:(UIWebView *)webView
+{
+ didFinishLoad = true;
+}
+IGNORE_WARNINGS_END
+
+- (void)uiWebView:(UIWebView *)sender didCommitLoadForFrame:(WebFrame *)frame
+{
+ gotMainFrame = true;
+ mainFrame = frame;
+}
+
+- (void)handleEvent:(DOMEvent *)event
+{
+ if ([event.type isEqualToString:@"canplaythrough"])
+ countOfVideoElementsCanPlay++;
+
+ if (countOfVideoElementsCanPlay == 2)
+ readyToTest = true;
+
+ if ([event.type isEqualToString:@"webkitbeginfullscreen"])
+ fullscreenBegin++;
+
+ if ([event.type isEqualToString:@"webkitendfullscreen"])
+ fullscreenEnd++;
+
+ if (fullscreenBegin == 2 && fullscreenEnd == 1)
+ doneTest = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKitLegacy, PreemptVideoFullscreen)
+{
+ RetainPtr<WebPreferences> preferences = [WebPreferences standardPreferences];
+ preferences.get().mediaDataLoadsAutomatically = YES;
+ preferences.get().mediaPlaybackAllowsInline = NO;
+ preferences.get().mediaPlaybackRequiresUserGesture = NO;
+
+ RetainPtr<UIWindow> uiWindow = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+ RetainPtr<UIWebView> uiWebView = adoptNS([[UIWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+ [uiWindow addSubview:uiWebView.get()];
+
+ RetainPtr<PreemptVideoFullscreenUIWebViewDelegate> uiDelegate = adoptNS([[PreemptVideoFullscreenUIWebViewDelegate alloc] init]);
+ uiWebView.get().delegate = uiDelegate.get();
+
+ [uiWebView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"two-videos" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+ Util::run(&didFinishLoad);
+ Util::run(&gotMainFrame);
+
+ callOnMainThreadAndWait([&] () mutable {
+ [mainFrame setTimeoutsPaused:YES];
+ DOMHTMLMediaElement* video1 = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] getElementById:@"video1"];
+ [video1 addEventListener:@"canplaythrough" listener:uiDelegate.get() useCapture:NO];
+ [video1 addEventListener:@"webkitbeginfullscreen" listener:uiDelegate.get() useCapture:NO];
+ [video1 addEventListener:@"webkitendfullscreen" listener:uiDelegate.get() useCapture:NO];
+
+ DOMHTMLMediaElement* video2 = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] getElementById:@"video2"];
+ [video2 addEventListener:@"canplaythrough" listener:uiDelegate.get() useCapture:NO];
+ [video2 addEventListener:@"webkitbeginfullscreen" listener:uiDelegate.get() useCapture:NO];
+
+ [video1 setSrc:@"video-with-audio.mp4"];
+ [video2 setSrc:@"video-without-audio.mp4"];
+ [mainFrame setTimeoutsPaused:NO];
+ });
+
+ // Wait until both video elements are ready to play.
+ Util::run(&readyToTest);
+
+ callOnMainThreadAndWait([&] () mutable {
+ DOMHTMLMediaElement* video1 = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] getElementById:@"video1"];
+ DOMHTMLMediaElement* video2 = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] getElementById:@"video2"];
+ [video1 play];
+ [video2 play];
+ });
+
+ // Eventually, only one video will be in fullscreen.
+ Util::run(&doneTest);
+}
+
+}
+
+#endif
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/two-videos.html (0 => 259531)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/two-videos.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/two-videos.html 2020-04-04 17:06:23 UTC (rev 259531)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+ <video id="video1" loop></video>
+ <video id="video2" loop></video>
+</body>
+</html>