summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 14:36:39 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 14:36:39 +0000
commit4ea5fcf6d2e8e9ea3fd0daac82d6650f502ce7ff (patch)
tree191e355a62fa5dc55e1b34288202db2d04969376 /webkit
parent0799d64ab9c29e97e9dc7b8c4b3f679fdf231408 (diff)
downloadchromium_src-4ea5fcf6d2e8e9ea3fd0daac82d6650f502ce7ff.zip
chromium_src-4ea5fcf6d2e8e9ea3fd0daac82d6650f502ce7ff.tar.gz
chromium_src-4ea5fcf6d2e8e9ea3fd0daac82d6650f502ce7ff.tar.bz2
DevTools: Set up utility context earlier (prevent from crash).
Review URL: http://codereview.chromium.org/150220 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/debugger_agent_impl.cc3
-rw-r--r--webkit/glue/devtools/js/devtools.js29
-rw-r--r--webkit/glue/devtools/tools_agent.h2
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc18
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h1
5 files changed, 30 insertions, 23 deletions
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc
index dfbe7bc..e7308b4 100644
--- a/webkit/glue/devtools/debugger_agent_impl.cc
+++ b/webkit/glue/devtools/debugger_agent_impl.cc
@@ -96,9 +96,6 @@ void DebuggerAgentImpl::ResetUtilityContext(
context->Dispose();
context->Clear();
}
- if (!document) {
- return;
- }
v8::HandleScope scope;
// TODO(pfeldman): Validate against Soeren.
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 33ba39f..fdc0c25 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -75,7 +75,9 @@ devtools.ToolsAgent.prototype.reset = function() {
devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, callback) {
var callbackId = devtools.Callback.wrap(function(result) {
var pair = JSON.parse(result);
- callback(pair[0], pair[1]);
+ if (callback) {
+ callback(pair[0], pair[1]);
+ }
});
RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
'evaluate', JSON.stringify([script]));
@@ -110,23 +112,20 @@ devtools.ToolsAgent.prototype.updateFocusedNode_ = function(nodeId) {
/**
* @param {string} url Url frame navigated to.
- * @param {bool} topLevel True iff top level navigation occurred.
* @see tools_agent.h
* @private
*/
-devtools.ToolsAgent.prototype.frameNavigate_ = function(url, topLevel) {
- if (topLevel) {
- this.reset();
- // Do not reset Profiles panel.
- var profiles = null;
- if ('profiles' in WebInspector.panels) {
- profiles = WebInspector.panels['profiles'];
- delete WebInspector.panels['profiles'];
- }
- WebInspector.reset();
- if (profiles != null) {
- WebInspector.panels['profiles'] = profiles;
- }
+devtools.ToolsAgent.prototype.frameNavigate_ = function(url) {
+ this.reset();
+ // Do not reset Profiles panel.
+ var profiles = null;
+ if ('profiles' in WebInspector.panels) {
+ profiles = WebInspector.panels['profiles'];
+ delete WebInspector.panels['profiles'];
+ }
+ WebInspector.reset();
+ if (profiles != null) {
+ WebInspector.panels['profiles'] = profiles;
}
};
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index 88c9a9d..ae1e15e 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -38,7 +38,7 @@ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
METHOD1(UpdateFocusedNode, int /* node_id */) \
\
/* Updates focused node on the client. */ \
- METHOD2(FrameNavigate, std::string /* url */, bool /* top_level */) \
+ METHOD1(FrameNavigate, std::string /* url */) \
\
/* Response to the GetNodeProperties. */ \
METHOD3(DidExecuteUtilityFunction, int /* call_id */, String /* result */, \
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index 7f62701..6652ba4 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -135,9 +135,18 @@ void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) {
} else {
doc = NULL;
}
- debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_);
if (doc) {
+ // Do not clear utility context when document is being cleared -
+ // there still can be pending messages from the client that require
+ // context to be processed.
+ debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_);
InitDevToolsAgentHost();
+ if (!report_frame_navigate_url_.empty()) {
+ // This is a document from the first load, issue frame navigate
+ // scheduled in DidCommitLoadForFrame.
+ tools_agent_delegate_stub_->FrameNavigate(report_frame_navigate_url_);
+ report_frame_navigate_url_ = "";
+ }
}
dom_agent_impl_->SetDocument(doc);
}
@@ -155,9 +164,10 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
GURL url = ds->hasUnreachableURL() ?
ds->unreachableURL() :
request.url();
- tools_agent_delegate_stub_->FrameNavigate(
- url.possibly_invalid_spec(),
- webview->GetMainFrame() == frame);
+ if (webview->GetMainFrame() == frame) {
+ // Schedule frame navigate event.
+ report_frame_navigate_url_ = url.possibly_invalid_spec();
+ }
InspectorController* ic = webview->page()->inspectorController();
// Unhide resources panel if necessary.
tools_agent_delegate_stub_->SetResourcesPanelEnabled(
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index 64fd205..2c5d86f 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -101,6 +101,7 @@ class WebDevToolsAgentImpl
// for matching rules.
v8::Persistent<v8::Context> utility_context_;
OwnPtr<BoundObject> devtools_agent_host_;
+ std::string report_frame_navigate_url_;
DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl);
};