Summary: | Add WKUIDelegatePrivate SPI _webView:printFrame:completionHandler: | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alex Christensen <achristensen> | ||||
Component: | New Bugs | Assignee: | Alex Christensen <achristensen> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | ggaren, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Alex Christensen
2020-03-17 12:34:57 PDT
Created attachment 393777 [details]
Patch
Comment on attachment 393777 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393777&action=review r=me > Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:1099 > + auto handle = API::FrameHandle::create(webFrameProxy.frameID()); > + if (m_uiDelegate.m_delegateMethods.webViewPrintFrame) { > + [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(handle)]; > + completionHandler(); > + } else if (m_uiDelegate.m_delegateMethods.webViewPrintFrameCompletionHandler) { > + auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:printFrame:completionHandler:)); > + [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(handle) completionHandler:makeBlockPtr([checker = WTFMove(checker), completionHandler = WTFMove(completionHandler)] () mutable { > + if (checker->completionHandlerHasBeenCalled()) > + return; > + checker->didCallCompletionHandler(); > + completionHandler(); > + }).get()]; > + } else > + completionHandler(); I think you want to do the delegate method check in the opposite order, so the new API wins if implemented. That way, a client can implement both if they need to support older WebKits, without doing #ifdef stuff. They could also do crazy things with their own implementation of respondsToSelector, but you're right. I switched them. http://trac.webkit.org/r258574 This change caused assertion failures with multiple layout and API tests: ASSERTION FAILED: Completion handler should always be called !m_function /Volumes/Data/slave/catalina-debug/build/WebKitBuild/Debug/usr/local/include/wtf/CompletionHandler.h(53) : WTF::CompletionHandler<void ()>::~CompletionHandler() https://build.webkit.org/builders/Apple-Catalina-Debug-WK2-Tests/builds/2971 Investigating now. http://trac.webkit.org/r258610 :( Will be more careful in the future |