diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 20:42:34 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 20:42:34 +0000 |
commit | 2791f2f77db0017409d856f0aa74294f0db75d18 (patch) | |
tree | 8bdfe66156c515b194cf90149b79abe15d6340ce /webkit | |
parent | b3a9433df3d904e56410ef2878ea7364c6b28a70 (diff) | |
download | chromium_src-2791f2f77db0017409d856f0aa74294f0db75d18.zip chromium_src-2791f2f77db0017409d856f0aa74294f0db75d18.tar.gz chromium_src-2791f2f77db0017409d856f0aa74294f0db75d18.tar.bz2 |
DevTools: reset ScriptState in InspectorController on page refresh.
TBR=yurys
Review URL: http://codereview.chromium.org/178003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 45 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 3 |
2 files changed, 29 insertions, 19 deletions
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index cf79aec..9c651fe 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -90,23 +90,10 @@ void WebDevToolsAgentImpl::Attach() { new DebuggerAgentImpl(web_view_impl_, debugger_agent_delegate_stub_.get(), this)); - Page* page = web_view_impl_->page(); - debugger_agent_impl_->CreateUtilityContext(page->mainFrame(), &utility_context_); - InitDevToolsAgentHost(); - + ResetInspectorFrontendProxy(); UnhideResourcesPanelIfNecessary(); - v8::HandleScope scope; - v8::Context::Scope context_scope(utility_context_); - - ScriptState* state = scriptStateFromPage(web_view_impl_->page()); - v8::Handle<v8::Object> injected_script = v8::Local<v8::Object>::Cast( - utility_context_->Global()->Get(v8::String::New("InjectedScript"))); - InspectorController* ic = web_view_impl_->page()->inspectorController(); - ic->setFrontendProxyObject( - state, - ScriptObject(state, utility_context_->Global()), - ScriptObject(state, injected_script)); // Allow controller to send messages to the frontend. + InspectorController* ic = web_view_impl_->page()->inspectorController(); ic->setWindowVisible(true, false); attached_ = true; } @@ -116,6 +103,7 @@ void WebDevToolsAgentImpl::Detach() { InspectorController* ic = web_view_impl_->page()->inspectorController(); ic->setWindowVisible(false, false); DisposeUtilityContext(); + inspector_frontend_script_state_.clear(); devtools_agent_host_.set(NULL); debugger_agent_impl_.set(NULL); attached_ = false; @@ -138,10 +126,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame( ds->unreachableURL() : request.url(); if (webview->GetMainFrame() == frame) { - DisposeUtilityContext(); - debugger_agent_impl_->CreateUtilityContext(webview->page()->mainFrame(), - &utility_context_); - InitDevToolsAgentHost(); + ResetInspectorFrontendProxy(); tools_agent_delegate_stub_->FrameNavigate( url.possibly_invalid_spec()); } @@ -246,6 +231,28 @@ void WebDevToolsAgentImpl::InitDevToolsAgentHost() { ic->inspectorBackend())); } +void WebDevToolsAgentImpl::ResetInspectorFrontendProxy() { + DisposeUtilityContext(); + debugger_agent_impl_->CreateUtilityContext( + web_view_impl_->page()->mainFrame(), + &utility_context_); + InitDevToolsAgentHost(); + + v8::HandleScope scope; + v8::Context::Scope context_scope(utility_context_); + inspector_frontend_script_state_.set(new ScriptState( + web_view_impl_->page()->mainFrame(), + utility_context_)); + v8::Handle<v8::Object> injected_script = v8::Local<v8::Object>::Cast( + utility_context_->Global()->Get(v8::String::New("InjectedScript"))); + ScriptState* state = inspector_frontend_script_state_.get(); + InspectorController* ic = web_view_impl_->page()->inspectorController(); + ic->setFrontendProxyObject( + state, + ScriptObject(state, utility_context_->Global()), + ScriptObject(state, injected_script)); +} + // static v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient( const v8::Arguments& args) { diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h index af5b271..0df46d9 100644 --- a/webkit/glue/webdevtoolsagent_impl.h +++ b/webkit/glue/webdevtoolsagent_impl.h @@ -17,6 +17,7 @@ namespace WebCore { class Document; class Node; +class ScriptState; class String; } @@ -86,6 +87,7 @@ class WebDevToolsAgentImpl void UnhideResourcesPanelIfNecessary(); void InitDevToolsAgentHost(); + void ResetInspectorFrontendProxy(); int host_id_; WebDevToolsAgentDelegate* delegate_; @@ -99,6 +101,7 @@ class WebDevToolsAgentImpl // for matching rules. v8::Persistent<v8::Context> utility_context_; OwnPtr<BoundObject> devtools_agent_host_; + OwnPtr<WebCore::ScriptState> inspector_frontend_script_state_; DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); }; |