mirror of
https://github.com/openharmony/third_party_cef.git
synced 2026-07-18 16:34:31 -04:00
Fix renderer crash when printing a PDF file (fixes issue #3100)
This commit is contained in:
@@ -39,10 +39,14 @@ blink::WebElement CefPrintRenderFrameHelperDelegate::GetPdfElement(
|
||||
url.host_piece() == extension_misc::kPdfExtensionId;
|
||||
if (inside_print_preview || inside_pdf_extension) {
|
||||
// <object> with id="plugin" is created in
|
||||
// chrome/browser/resources/pdf/pdf.js.
|
||||
auto plugin_element = frame->GetDocument().GetElementById("plugin");
|
||||
if (!plugin_element.IsNull()) {
|
||||
return plugin_element;
|
||||
// chrome/browser/resources/pdf/pdf_viewer_base.js.
|
||||
auto viewer_element = frame->GetDocument().GetElementById("viewer");
|
||||
if (!viewer_element.IsNull() && !viewer_element.ShadowRoot().IsNull()) {
|
||||
auto plugin_element =
|
||||
viewer_element.ShadowRoot().QuerySelector("#plugin");
|
||||
if (!plugin_element.IsNull()) {
|
||||
return plugin_element;
|
||||
}
|
||||
}
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user