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

Unified Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 1004283003: Pepper: add validity checks in RendererPpapiHostImpl::GetDocumentURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 9 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: content/renderer/pepper/renderer_ppapi_host_impl.cc
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index bf132d78ff23701d86d34ac19ff8f300eb23353f..62faf51e12df571aa5221ccb536826dba6efc4af 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -259,11 +259,19 @@ void RendererPpapiHostImpl::CreateBrowserResourceHosts(
}
GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const {
- PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
- if (!instance_object || !instance_object->container())
+ blink::WebPluginContainer* container = GetContainerForInstance(instance);
+ if (!container)
+ return GURL();
+
+ blink::WebElement element = container->element();
+ if (element.isNull())
+ return GURL();
+
+ blink::WebDocument document = element.document();
+ if (document.isNull())
return GURL();
- return instance_object->container()->element().document().url();
+ return document.url();
}
PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance(
« 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