diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 13:22:30 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 13:22:30 +0000 |
commit | a7f0ddfbac9124bb25994eef1a7d1939f9b0fe0f (patch) | |
tree | d8b20073fdb2f0d6e62ce39b2dd71f92c199833b /webkit | |
parent | 0423bcf19239f09f6c88f19a7b310b020fb7e1e7 (diff) | |
download | chromium_src-a7f0ddfbac9124bb25994eef1a7d1939f9b0fe0f.zip chromium_src-a7f0ddfbac9124bb25994eef1a7d1939f9b0fe0f.tar.gz chromium_src-a7f0ddfbac9124bb25994eef1a7d1939f9b0fe0f.tar.bz2 |
Check that frame has not been closed when getting DevToolsAgent.
BUG=29339
Review URL: http://codereview.chromium.org/464033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 22 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index c0c035d..a3148b1 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -703,7 +703,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, response_info.last_modified, request_is_seekable); - if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) { ClientInfo* client_info = GetClientInfoFromLoader(loader); if (client_info) devtools_agent->didReceiveResponse(client_info->id, response); @@ -745,7 +745,7 @@ void WebPluginImpl::didReceiveData(WebURLLoader* loader, client->DidReceiveData(buffer, length, 0); } - if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) { ClientInfo* client_info = GetClientInfoFromLoader(loader); if (client_info) devtools_agent->didReceiveData(client_info->id, length); @@ -770,7 +770,7 @@ void WebPluginImpl::didFinishLoading(WebURLLoader* loader) { client_info->client = NULL; resource_client->DidFinishLoading(); - if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) devtools_agent->didFinishLoading(client_info->id); } } @@ -786,7 +786,7 @@ void WebPluginImpl::didFail(WebURLLoader* loader, client_info->client = NULL; resource_client->DidFail(); - if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) devtools_agent->didFailLoading(client_info->id, error); } } @@ -928,7 +928,7 @@ bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id, // Sets the routing id to associate the ResourceRequest with the RenderView. webframe_->dispatchWillSendRequest(info.request); - if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) { devtools_agent->identifierForInitialRequest(resource_id, webframe_, info.request); devtools_agent->willSendRequest(resource_id, info.request); @@ -991,8 +991,7 @@ void WebPluginImpl::SetDeferResourceLoading(unsigned long resource_id, resource_client->DidFail(); // Report that resource loading finished. - WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent(); - if (devtools_agent) + if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) devtools_agent->didFinishLoading(resource_id); } break; @@ -1122,4 +1121,13 @@ void WebPluginImpl::SetReferrer(WebKit::WebURLRequest* request, } } +WebDevToolsAgent* WebPluginImpl::GetDevToolsAgent() { + if (!webframe_) + return NULL; + WebView* view = webframe_->view(); + if (!view) + return NULL; + return view->devToolsAgent(); +} + } // namespace webkit_glue diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index 7ed3e6f..f4e1108 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -25,6 +25,7 @@ class WebViewDelegate; namespace WebKit { +class WebDevToolsAgent; class WebFrame; class WebPluginContainer; class WebURLResponse; @@ -244,6 +245,9 @@ class WebPluginImpl : public WebPlugin, // Helper function to set the referrer on the request passed in. void SetReferrer(WebKit::WebURLRequest* request, Referrer referrer_flag); + // Returns DevToolsAgent for the frame or 0. + WebKit::WebDevToolsAgent* GetDevToolsAgent(); + std::vector<ClientInfo> clients_; bool windowless_; |