Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 155da2799248ca670579e8abdf2030037caa1297
      
https://github.com/WebKit/WebKit/commit/155da2799248ca670579e8abdf2030037caa1297
  Author: Jer Noble <[email protected]>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M Source/JavaScriptCore/runtime/WaiterListManager.cpp
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/FunctionDispatcher.h
    M Source/WTF/wtf/MainThreadDispatcher.cpp
    M Source/WTF/wtf/MainThreadDispatcher.h
    M Source/WTF/wtf/RunLoop.cpp
    M Source/WTF/wtf/RunLoop.h
    M Source/WTF/wtf/WorkQueue.cpp
    M Source/WTF/wtf/WorkQueue.h
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/page/DeprecatedGlobalSettings.cpp
    M Source/WebCore/page/DeprecatedGlobalSettings.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
    M Source/WebKit/GPUProcess/GPUProcess.cpp
    M Source/WebKit/GPUProcess/GPUProcessPreferences.cpp
    M Source/WebKit/GPUProcess/GPUProcessPreferences.h
    M Source/WebKit/GPUProcess/GPUProcessPreferences.serialization.in
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/MediaLoading.mm

  Log Message:
  -----------
  [iOS] Custom URL scheme timeouts lead to crashes in mediaplaybackd
rdar://184511202
https://bugs.webkit.org/show_bug.cgi?id=324711

Reviewed by Jean-Yves Avenard.

WebKit enables 
AVAssetResourceLoadingContentInformationRequest.isEntireLengthAvailableOnDemand 
when
loading custom URL schemes because most clients implement a custom URL scheme 
in order to load media
from within their own bundle or from a locally stored database. Some clients, 
however, re-implement
HTTP loading via a custom URL scheme for reasons unknown. In these 
circumstances, a network request
that times out can cause a watchdog-timer crash in mediaplaybackd, which is 
expecting all its issued
requests to be acted upon immediately.

Add a separate timeout timer for such loads, set to 10s initially, which is 
enough time for the
general case of blob URLs and immediately loadable resources. Network requests 
via custom schemes
may see loading errors due to timeouts rather than errors due to mediaplaybackd 
crashes.

Because the WebCoreAVAssetResourceLoader only has access to a 
GuaranteedSerialFunctionDispatcher,
that object must be extended to include a virtual `dispatchAfter()` method, 
with implementations
in MainThreadDispatcher, RunLoop, WorkQueue, and 
ScriptExecutionContextDispatcher. This required
renaming an existing function with the same name to a new name, 
`scheduleTimer()`, as that method
returns a DispatchTimer object.

And because API tests should be fast, a debug-only setting to reduce the 
timeout from its default
10s to a more reasonable 1/2s was added and passed through to 
DeprecatedGlobalSettings in the
GPU process.

Test: MediaLoading.UnansweredCustomSchemeRequestTimesOut

* Source/JavaScriptCore/runtime/WaiterListManager.cpp:
(JSC::WaiterListManager::waitAsyncImpl):
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/FunctionDispatcher.h:
* Source/WTF/wtf/MainThreadDispatcher.cpp:
(WTF::MainThreadDispatcher::dispatchAfter):
* Source/WTF/wtf/MainThreadDispatcher.h:
* Source/WTF/wtf/RunLoop.cpp:
(WTF::RunLoop::scheduleTimer):
(WTF::RunLoop::dispatchAfter): Deleted.
* Source/WTF/wtf/RunLoop.h:
* Source/WTF/wtf/WorkQueue.cpp:
(WTF::WorkQueue::dispatchAfter):
* Source/WTF/wtf/WorkQueue.h:
* Source/WebCore/dom/ScriptExecutionContext.cpp:
* Source/WebCore/page/DeprecatedGlobalSettings.cpp:
(WebCore::DeprecatedGlobalSettings::setMediaResourceLoadTimeoutForTesting):
* Source/WebCore/page/DeprecatedGlobalSettings.h:
(WebCore::DeprecatedGlobalSettings::mediaResourceLoadTimeoutForTesting):
* Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::resourceLoadTimeout):
(WebCore::WebCoreAVFResourceLoader::startLoading):
(WebCore::WebCoreAVFResourceLoader::stopLoading):
(WebCore::WebCoreAVFResourceLoader::startLoadingTimer):
(WebCore::WebCoreAVFResourceLoader::stopLoadingTimer):
(WebCore::WebCoreAVFResourceLoader::loadTimedOut):
* Source/WebKit/GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::updateGPUProcessPreferences):
* Source/WebKit/GPUProcess/GPUProcessPreferences.cpp:
(WebKit::GPUProcessPreferences::copyEnabledWebPreferences):
* Source/WebKit/GPUProcess/GPUProcessPreferences.h:
* Source/WebKit/GPUProcess/GPUProcessPreferences.serialization.in:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scheduleVisibleContentRectUpdateWithDelay:]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::scheduleAccessibilityFrameGeometryUpdate):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/MediaLoading.mm:
(TestWebKitAPI::TEST(MediaLoading, UnansweredCustomSchemeRequestTimesOut)):

Canonical link: https://commits.webkit.org/322083@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to