Summary: | REGRESSION(AppleWebKit/605.1.15): WebDownloadDelegate delegate methods called on non-main thread | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Nick Beadman <nbeadman> | ||||||||
Component: | New Bugs | Assignee: | Alex Christensen <achristensen> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | achristensen, cdumez, commit-queue, darin, ggaren, rniwa, webkit-bug-importer, youennf | ||||||||
Priority: | P2 | Keywords: | InRadar, Regression | ||||||||
Version: | Safari 11 | ||||||||||
Hardware: | Mac | ||||||||||
OS: | macOS 10.12 | ||||||||||
Attachments: |
|
Description
Nick Beadman
2018-10-25 14:46:30 PDT
Documention at https://developer.apple.com/documentation/foundation/nsurldownloaddelegate says: """ Note that these delegate methods will be called on the thread that started the asynchronous load operation for the associated NSURLDownload object. """ Created attachment 366836 [details]
Patch
Comment on attachment 366836 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366836&action=review > Source/WebKitLegacy/mac/Misc/WebDownload.mm:85 > + callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download)] { Why the mix of callOnMainThread and dispatch_sync(dispatch_get_main_queue())? I use dispatch_sync where I need to return a result synchronously on the non-main thread. This is equivalent to the use of m_semaphore in WebCoreResourceHandleAsOperationQueueDelegate. I use callOnMainThread where I just need to forward a call with no immediate callback. I'm going to add a check to see if we are on the main thread before calling dispatch_sync to be conservative and prevent a deadlock I think should be impossible. Created attachment 366841 [details]
Patch
|