Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3a096e98b91e8590a57ce0f78b59088378ebee06
      
https://github.com/WebKit/WebKit/commit/3a096e98b91e8590a57ce0f78b59088378ebee06
  Author: Joanne Pan <[email protected]>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFScriptEvaluation.mm
    A Tools/TestWebKitAPI/Resources/cocoa/test_openaction_destination.pdf
    A Tools/TestWebKitAPI/Resources/cocoa/test_openaction_goto.pdf
    A Tools/TestWebKitAPI/Resources/cocoa/test_openaction_nonprint.pdf
    A Tools/TestWebKitAPI/Resources/cocoa/test_print_openaction.pdf
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKPrinting.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKPrinting.mm

  Log Message:
  -----------
  calendar.google.com: Safari: Print job fails to start when attempting to 
print Google Calendar
https://bugs.webkit.org/show_bug.cgi?id=315720
rdar://173413224

Reviewed by Abrar Rahman Protyasha and Tim Horton.

The problem: clicking "Print" on calendar.google.com does nothing in Safari.
Gcal hands us a PDF that's supposed to print itself, the print() call lives on
the PDF's /OpenAction. But our PDF scanner only looked in one spot (the /Names
tree), it never checked /OpenAction, so it missed the print() and nothing
happened. Firefox works because its PDF viewer actually runs /OpenAction when
the PDF opens. We don't run it, we just scan the PDF for a print() and call it
ourselves, we were just looking in the wrong spot.

The fix: also check /OpenAction for a print(), not just the /Names tree. If
/OpenAction is just a destination (jump to a page) instead of a script, we
ignore it.

* Source/WebKit/WebProcess/Plugins/PDF/PDFScriptEvaluation.mm:
(WebKit::PDFScriptEvaluation::actionContainsPrintScript):
(WebKit::PDFScriptEvaluation::pdfDocumentContainsPrintScript):
* Tools/TestWebKitAPI/Resources/cocoa/test_openaction_destination.pdf: Added.
* Tools/TestWebKitAPI/Resources/cocoa/test_openaction_goto.pdf: Added.
* Tools/TestWebKitAPI/Resources/cocoa/test_openaction_nonprint.pdf: Added.
* Tools/TestWebKitAPI/Resources/cocoa/test_print_openaction.pdf: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:
(TestWebKitAPI::TEST_P):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKPrinting.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKPrinting.mm:
(-[TestPDFPrintDelegate 
_webView:printFrame:pdfFirstPageSize:completionHandler:]):
(-[TestPDFPrintDelegate waitForPrintFrameCall]):
(-[TestPDFPrintDelegate printFrameCallCount]):
(PrintWithJSExecutionOptionTests::namedPDFRequest):
(PrintWithJSExecutionOptionTests::pdfRequest):
(PrintWithJSExecutionOptionTests::openActionPDFRequest):
(PrintWithJSExecutionOptionTests::runTest):
(PrintWithJSExecutionOptionTests::runNonPrintingOpenActionTest):
(TEST_P):

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



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

Reply via email to