diff options
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 45 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 3 |
3 files changed, 30 insertions, 20 deletions
@@ -1,7 +1,7 @@ vars = { "webkit_trunk": "http://svn.webkit.org/repository/webkit/trunk", - "webkit_revision": "47830", + "webkit_revision": "47831", } 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); }; |