Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Off screen renderer fails to export sandboxes iframes to pdf #3798

Closed
ebrandin opened this issue Oct 7, 2024 · 4 comments
Closed

Off screen renderer fails to export sandboxes iframes to pdf #3798

ebrandin opened this issue Oct 7, 2024 · 4 comments
Labels
bug Bug report

Comments

@ebrandin
Copy link

ebrandin commented Oct 7, 2024

Describe the bug
Starting from CEF 125, PrintToPDF fails when trying to render sandboxed iframes. It does however work if the sandbox attribute is set to "allow-script allow-same-origin".

The CefPdfPrintCallback is never invoked due to CefPdfPrintCallbackCToCpp::OnPdfPrintFinished being called with empty path, which makes our application hang on export to pdf.

To Reproduce

  1. Apply the provided patch
  2. Run the unit tests (--gtest_filter=OSRTest.PrintToPdf*) (may also require --disable-features=PrintCompositorLPAC)
  3. All provided tests except one passes. The last, with attribute sandbox="allow-scripts" fails with "Printing failed"
[1007/133205.422:WARNING:browser_info.cc(345)] Returning a speculative frame for [12,5]
[1007/133205.422:WARNING:browser_info.cc(345)] Returning a speculative frame for [12,5]
[1007/133205.423:WARNING:browser_info.cc(345)] Returning a speculative frame for [12,5]
[1007/133205.423:WARNING:browser_info.cc(345)] Returning a speculative frame for [12,5]
[1007/133205.555:WARNING:browser_info.cc(345)] Returning a speculative frame for [12,5]
C:\Source\github\cef-project\third_party\cef\cef_binary_127.3.4+ge9e2e14+chromium-127.0.6533.100_windows64\tests\ceftests\test_handler.cc(556): error: Value of: false
  Actual: false
Expected: true
Test timed out after 5000ms
[1007/133210.329:ERROR:print_util.cc(40)] PrintToPDF failed with error: Printing failed
[1007/133210.330:FATAL:pdf_print_callback_ctocpp.cc(34)] Check failed: !path.empty().

Expected behavior
All unit tests should pass, rendering all versions of the sandboxed iframes.

Versions (please complete the following information):

  • OS: Windows 11
  • CEF Version: 125.0.22, 126.2.18, 127.3.4

Additional context
This used to work up to version 124.

Does the problem reproduce with Google Chrome at the same version?
No, Chrome is able to export sandboxed iframes to pdf.

Add any other context about the problem here.
iframe_to_pdf.patch

@ebrandin ebrandin added the bug Bug report label Oct 7, 2024
@jasminjasmin2
Copy link

I could also reproduce this issue. It seems somehow related to bug #3768 . The behavior is very similar. However, I could not find any evidence of sandbox iframe usage in www.corriere.it website which cannot be printed to PDF .

Should it matter if the application is built with or without sandbox enabled? In my tests reproduces in both situations if did not do anything wrong.

I also could not find any Chromium command line switch to force the allow-scripts and allow-same-origin for sandbox frames.

@ebrandin
Copy link
Author

ebrandin commented Oct 8, 2024

It seems somewhat related to #3768. In that issue I was able to get a print preview when all iframes were removed (using dev tools). Those removed iframes were not sandboxed, but since they had another origin both issues might be related to site isolation.

In CEF 130.0.3 (beta), the #3768 issue seems to be fixed. However, my issue regarding sandboxed iframes is still reproducible.

@magreenblatt
Copy link
Collaborator

Likely fixed with #3768. Please report back if it isn't.

@magreenblatt magreenblatt closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
@handerss-spotfire
Copy link

Fix for #3768 does indeed fix the issue, thanks @mbragg12 and @magreenblatt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

No branches or pull requests

4 participants