Fix renderer crash when printing a PDF file (fixes issue #3100)
This commit is contained in:
parent
74db00fc89
commit
a17c59ce1d
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue