Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: components/pdf/renderer/pepper_pdf_host.cc

Issue 2174963002: Fix a crash in pdf::PepperPDFHost::OnHostMsgHasUnsupportedFeature(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/pdf/renderer/pepper_pdf_host.cc
diff --git a/components/pdf/renderer/pepper_pdf_host.cc b/components/pdf/renderer/pepper_pdf_host.cc
index 1355141c2d4d5d9ddd74f6b9b75537f809b2c1cb..609e2406be6c9dc94682149ba90122ac84c2a905 100644
--- a/components/pdf/renderer/pepper_pdf_host.cc
+++ b/components/pdf/renderer/pepper_pdf_host.cc
@@ -142,14 +142,10 @@ int32_t PepperPDFHost::OnHostMsgHasUnsupportedFeature(
if (!instance)
return PP_ERROR_FAILED;
- // TODO(thestig): Turn CHECKs into the proper if statement after figuring out
- // what's wrong for https://crbug.com/627814
- CHECK(instance->GetContainer());
- CHECK(instance->GetContainer()->document().frame());
Lei Zhang 2016/07/22 20:35:37 I found this CHECK() failed, but then I looked bel
- CHECK(instance->GetContainer()->document().frame()->view());
- blink::WebView* view =
- instance->GetContainer()->document().frame()->view();
- content::RenderView* render_view = content::RenderView::FromWebView(view);
+ content::RenderView* render_view = instance->GetRenderView();
+ if (!render_view)
+ return PP_ERROR_FAILED;
+
render_view->Send(
new PDFHostMsg_PDFHasUnsupportedFeature(render_view->GetRoutingID()));
return PP_OK;
@@ -166,8 +162,12 @@ int32_t PepperPDFHost::OnHostMsgSaveAs(
host_->GetPluginInstance(pp_instance());
if (!instance)
return PP_ERROR_FAILED;
- GURL url = instance->GetPluginURL();
+
content::RenderView* render_view = instance->GetRenderView();
Lei Zhang 2016/07/22 20:35:37 This can also return a nullptr and crash later dow
+ if (!render_view)
+ return PP_ERROR_FAILED;
+
+ GURL url = instance->GetPluginURL();
content::Referrer referrer;
referrer.url = url;
referrer.policy = blink::WebReferrerPolicyDefault;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698