2022-05-25 Alan Coon Cherry-pick a173819be243. rdar://problem/87980543 Cherry-pick r294280. rdar://problem/87980543 This reverts r294684. Canonical link: https://commits.webkit.org/245886.574@safari-7613.3.1.1-branch git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-7613.3.1.1-branch@294731 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-05-23 Alan Coon Cherry-pick r294280. rdar://problem/87980543 REGRESSION(r249162): CanvasRenderingContext2DBase::drawImage() crashes if the image is animated and the first frame cannot be decoded https://bugs.webkit.org/show_bug.cgi?id=239113 rdar://87980543 Reviewed by Simon Fraser. Source/WebCore: CanvasRenderingContext2DBase::drawImage() needs to ensure the first frame of the animated image can be decoded correctly before creating the temporary static image. If the first frame can't be decoded, this function should return immediately. This matches the behavior of this function before r249162. The animated image decodes its frames asynchronously in a work queue. But the first frame has to be decoded synchronously in the main run loop. So to avoid running the image decoder in two different threads we are going to keep the first and the current frame cached when we receive a memory pressure warning. This should not increase the memory allocation of the animated image because the numbers of cached frames increases quickly and we keep all of them till a memory warning is received. But the memory pressure warning will be received a little bit more often. This depends on the memory size of the first frame. To make the code more robust, make ImageSource take a Ref instead of taking a RefPtr. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::BitmapImage): (WebCore::BitmapImage::destroyDecodedData): * platform/graphics/BitmapImage.h: * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): (WebCore::ImageSource::destroyDecodedData): (WebCore::ImageSource::setNativeImage): * platform/graphics/ImageSource.h: (WebCore::ImageSource::create): (WebCore::ImageSource::isDecoderAvailable const): (WebCore::ImageSource::destroyAllDecodedData): Deleted. (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame): Deleted. (WebCore::ImageSource::destroyDecodedDataBeforeFrame): Deleted. Source/WebKit: * GPUProcess/graphics/RemoteDisplayListRecorder.cpp: (WebKit::RemoteDisplayListRecorder::drawSystemImage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294280 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-05-16 Said Abou-Hallawa REGRESSION(r249162): CanvasRenderingContext2DBase::drawImage() crashes if the image is animated and the first frame cannot be decoded https://bugs.webkit.org/show_bug.cgi?id=239113 rdar://87980543 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteDisplayListRecorder.cpp: (WebKit::RemoteDisplayListRecorder::drawSystemImage): 2022-05-16 Alan Coon Cherry-pick r293894. rdar://problem/74201964 [iOS] Infinite recursion at -[WKFullScreenWindowController _exitFullscreenImmediately] https://bugs.webkit.org/show_bug.cgi?id=239744 Reviewed by Eric Carlson. Source/WebCore: Even after fullscreen is correctly torn down during an immediate exit, fullscreen can never again be entered for the lifetime of the page. This is due to the ivar m_pendingExitFullscreen being set to true with no opportunity for that state to be cleared. This occurs because the callbacks for exiting fullscreen are performed before the lambda form FullscreenManager::exitFullscreen() is called. Set m_pendingExitFullscreen inside exitFullscreen(), rather than the lambda, and clear it explicitly in the cases where fullscreen exiting is not actually necessary. The mock behavior of Fullscreen inside DumpRenderTree and WebKitTestRunner are not able to exercise this same path. Track improvements to this mock in bug #239747. * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::requestFullscreenForElement): (WebCore::FullscreenManager::exitFullscreen): (WebCore::FullscreenManager::setAnimatingFullscreen): (WebCore::FullscreenManager::setFullscreenControlsHidden): Source/WebKit: When exiting fullscreen immediately, we trigger the correct state transition by calling -[self exitFullScreen]. However, when no fullscreen manager exists (as may happen during navigation), -exitFullscreen may itself call -_exitFullscreenImmediately, which causes an infinite recursion and stack overflow. Unroll the implementation by performing all the same pieces as would have been done by -exitFullScreen, but inline. Refactor out common behavior into -_reinsertWebViewUnderPlaceholder, and call that both from -_exitFullscreenImmediately and _completedExitFullScreen. Unfortunately, no API tests are possible here because TestWebKitAPI is not an actual iOS UI application. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController _reinsertWebViewUnderPlaceholder]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController _exitFullscreenImmediately]): Canonical link: https://commits.webkit.org/250352@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293894 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-05-06 Jer Noble [iOS] Infinite recursion at -[WKFullScreenWindowController _exitFullscreenImmediately] https://bugs.webkit.org/show_bug.cgi?id=239744 Reviewed by Eric Carlson. When exiting fullscreen immediately, we trigger the correct state transition by calling -[self exitFullScreen]. However, when no fullscreen manager exists (as may happen during navigation), -exitFullscreen may itself call -_exitFullscreenImmediately, which causes an infinite recursion and stack overflow. Unroll the implementation by performing all the same pieces as would have been done by -exitFullScreen, but inline. Refactor out common behavior into -_reinsertWebViewUnderPlaceholder, and call that both from -_exitFullscreenImmediately and _completedExitFullScreen. Unfortunately, no API tests are possible here because TestWebKitAPI is not an actual iOS UI application. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController _reinsertWebViewUnderPlaceholder]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController _exitFullscreenImmediately]): 2022-05-16 Alan Coon Cherry-pick r293433. rdar://problem/91981865 [WebAuthn] Do not pass ASCCredentialRequestTypePlatform... if LocalService unavailable https://bugs.webkit.org/show_bug.cgi?id=239746 rdar://91981865 Reviewed by Brent Fulgham. Passing platform in requestTypes breaks the UI in registerations with the syncing platform authenticator off and local service is unavailable. This patch stops passing it in this case. * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: (WebKit::configureRegistrationRequestContext): (WebKit::WebAuthenticatorCoordinatorProxy::performRequest): Canonical link: https://commits.webkit.org/249993@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293433 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-04-26 J Pascoe [WebAuthn] Do not pass ASCCredentialRequestTypePlatform... if LocalService unavailable https://bugs.webkit.org/show_bug.cgi?id=239746 rdar://91981865 Reviewed by Brent Fulgham. Passing platform in requestTypes breaks the UI in registerations with the syncing platform authenticator off and local service is unavailable. This patch stops passing it in this case. * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: (WebKit::configureRegistrationRequestContext): (WebKit::WebAuthenticatorCoordinatorProxy::performRequest): 2022-05-16 Alan Coon Cherry-pick r293170. rdar://problem/91117803 AVSampleBufferRenderSynchronizer timeline sometimes goes backwards when playback begins https://bugs.webkit.org/show_bug.cgi?id=239471 rdar://91117803 Reviewed by Jer Noble. Source/WebCore: Test: media/media-source/media-source-current-time.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Log current time and requested playback rate. (WebCore::HTMLMediaElement::setPausedInternal): Log. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): If time has gone backward, clamp to the most recent seek time. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): INFO_LOG -> ALWAYS_LOG (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal): Ditto. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const): Use clampTimeToLastSeekTime. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::clampTimeToLastSeekTime const): New, clamp time value to the most recent seek time. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback): Use clampTimeToLastSeekTime. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance): INFO_LOG -> ALWAYS_LOG (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal): INFO_LOG -> ALWAYS_LOG (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer): INFO_LOG -> ALWAYS_LOG (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): INFO_LOG -> ALWAYS_LOG (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged): INFO_LOG -> ALWAYS_LOG Source/WebKit: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Log when time jumps backwards. LayoutTests: * media/media-source/media-source-current-time-expected.txt: Added. * media/media-source/media-source-current-time.html: Added. Canonical link: https://commits.webkit.org/249852@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293170 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-04-21 Eric Carlson AVSampleBufferRenderSynchronizer timeline sometimes goes backwards when playback begins https://bugs.webkit.org/show_bug.cgi?id=239471 rdar://91117803 Reviewed by Jer Noble. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Log when time jumps backwards. 2022-05-16 Alan Coon Cherry-pick r292738. rdar://problem/91295875 Use WebKit::blockedError instead of ResourceLoader::blockedError in WebLoaderStrategy::scheduleLoadFromNetworkProcess https://bugs.webkit.org/show_bug.cgi?id=239089 Patch by Alex Christensen on 2022-04-11 Reviewed by Chris Dumez. The latter dereferences the frame loader which can be null. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Canonical link: https://commits.webkit.org/249522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292738 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-04-11 Alex Christensen Use WebKit::blockedError instead of ResourceLoader::blockedError in WebLoaderStrategy::scheduleLoadFromNetworkProcess https://bugs.webkit.org/show_bug.cgi?id=239089 Reviewed by Chris Dumez. The latter dereferences the frame loader which can be null. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): 2022-05-02 Alan Coon Apply patch. rdar://problem/92617943 2022-05-02 Alex Christensen Revert all use of _setPrivacyProxyFailClosedForUnreachableNonMainHosts https://bugs.webkit.org/show_bug.cgi?id=239977 Due to what is likely confusion about internal integration processes, the powers that be have decided that the best course of action for now is to restore the status quo and accept any consequences that may entail. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::createWebSocketTask): 2022-04-29 Alan Coon Cherry-pick r287877. rdar://problem/92357915 Non-unified build fixes, early January 2022 edition https://bugs.webkit.org/show_bug.cgi?id=235013 Unreviewed non-unified build fixes. Source/JavaScriptCore: * wasm/js/JSWebAssemblyModule.cpp: Add missing JSWebAssemblyLinkError.h header. * wasm/js/JSWebAssemblyModule.h: Add missing forward declaration for the JSC::OptimizingCallLinkInfo type. Source/WebCore: No new tests needed. * Modules/fetch/FetchBodyConsumer.cpp: Add missing FormData.h header. * Modules/fetch/FormDataConsumer.h: Add missing ExceptionOr.h header, and forward declaration for the WebCore::ScriptExecutionContext type. * animation/CSSAnimation.cpp: Add missing KeyframeEffect.h header. * animation/KeyframeEffect.cpp: Add missing StyledElement.h header. * html/HTMLFormElement.cpp: Add missing PseudoClassChangeInvalidation.h header. * platform/network/SynchronousLoaderClient.cpp: Add missing SharedBuffer.h header. * rendering/svg/RenderSVGBlock.cpp: Add missing SVGRenderSupport.h header. * rendering/svg/RenderSVGForeignObject.cpp: Ditto. * rendering/svg/RenderSVGInline.cpp: Ditto. * rendering/svg/RenderSVGModelObject.cpp: Add missing SVGElementInlines.h header. * rendering/svg/SVGInlineTextBox.cpp: Add missing FloatConversion.h header. * svg/SVGViewElement.cpp: Add missing RenderElement.h header. * workers/service/context/ServiceWorkerFetch.h: Add missing forward declaration for the WebCore::SharedBuffer type, remove unused one for WebCore::FragmentedSharedBuffer. Source/WebKit: * Platform/IPC/SharedBufferCopy.cpp: Add missing WebCoreArgumentCoders.h header, remove now unneeded ArgumentCoders.h header. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287877 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-11 Adrian Perez de Castro Non-unified build fixes, early January 2022 edition https://bugs.webkit.org/show_bug.cgi?id=235013 Unreviewed non-unified build fixes. * Platform/IPC/SharedBufferCopy.cpp: Add missing WebCoreArgumentCoders.h header, remove now unneeded ArgumentCoders.h header. 2022-04-22 Alan Coon Cherry-pick r291724. rdar://problem/91975589 Expose the AX tree of PDFs loaded via iframes on the Mac https://bugs.webkit.org/show_bug.cgi?id=238168 Reviewed by Chris Fleizach. Source/WebKit: Given this markup: