diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 17:30:16 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 17:30:16 +0000 |
commit | d1aed1f5d4a59371b0b041884089745d65b29cf3 (patch) | |
tree | 9911b54f322194a0588763167d9d0820725e11be /webkit | |
parent | 54d8d45198e73c705030f2bb9cb67d91808141e6 (diff) | |
download | chromium_src-d1aed1f5d4a59371b0b041884089745d65b29cf3.zip chromium_src-d1aed1f5d4a59371b0b041884089745d65b29cf3.tar.gz chromium_src-d1aed1f5d4a59371b0b041884089745d65b29cf3.tar.bz2 |
DevTools: Fix errors found during dogfooding.
Review URL: http://codereview.chromium.org/62152
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/dom_agent_impl.cc | 24 | ||||
-rw-r--r-- | webkit/glue/devtools/dom_agent_impl.h | 7 | ||||
-rw-r--r-- | webkit/glue/devtools/dom_agent_unittest.cc | 2 | ||||
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 12 | ||||
-rw-r--r-- | webkit/glue/devtools/js/dom_agent.js | 12 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 4 |
6 files changed, 25 insertions, 36 deletions
diff --git a/webkit/glue/devtools/dom_agent_impl.cc b/webkit/glue/devtools/dom_agent_impl.cc index f67dfdd..04b11da 100644 --- a/webkit/glue/devtools/dom_agent_impl.cc +++ b/webkit/glue/devtools/dom_agent_impl.cc @@ -71,10 +71,10 @@ DomAgentImpl::DomAgentImpl(DomAgentDelegate* delegate) } DomAgentImpl::~DomAgentImpl() { - SetDocument(NULL, false); + SetDocument(NULL); } -void DomAgentImpl::SetDocument(Document* doc, bool loaded) { +void DomAgentImpl::SetDocument(Document* doc) { if (doc == GetMainFrameDocument()) { return; } @@ -85,12 +85,12 @@ void DomAgentImpl::SetDocument(Document* doc, bool loaded) { StopListening((*it).get()); } ASSERT(documents_.size() == 0); - ASSERT(loaded_documents_.size() == 0); if (doc) { StartListening(doc); - if (loaded) { - loaded_documents_.add(doc); + if (document_element_requested_) { + GetDocumentElement(); + document_element_requested_ = false; } } else { DiscardBindings(); @@ -125,7 +125,6 @@ void DomAgentImpl::StopListening(Document* doc) { doc->removeEventListener(eventNames().DOMAttrModifiedEvent, event_listener_.get(), false); documents_.remove(doc); - loaded_documents_.remove(doc); } int DomAgentImpl::Bind(Node* node) { @@ -250,18 +249,15 @@ void DomAgentImpl::handleEvent(Event* event, bool isWindowEvent) { delegate_->ChildNodeRemoved(parent_id, id); } } else if (type == eventNames().DOMContentLoadedEvent) { - Document* doc = static_cast<Document*>(node); - loaded_documents_.add(doc); - if (document_element_requested_ && - loaded_documents_.contains(GetMainFrameDocument())) { - GetDocumentElement(); - document_element_requested_ = false; - } + // Re-push document once it is loaded. + DiscardBindings(); + PushDocumentElementToClient(); } } void DomAgentImpl::GetDocumentElement() { - if (loaded_documents_.contains(GetMainFrameDocument())) { + Document* main_document = GetMainFrameDocument(); + if (main_document) { PushDocumentElementToClient(); } else { document_element_requested_ = true; diff --git a/webkit/glue/devtools/dom_agent_impl.h b/webkit/glue/devtools/dom_agent_impl.h index 88a251c..9c1bfc0 100644 --- a/webkit/glue/devtools/dom_agent_impl.h +++ b/webkit/glue/devtools/dom_agent_impl.h @@ -55,11 +55,7 @@ class DomAgentImpl : public DomAgent { void DiscardBindings(); // Initializes dom agent with the given document. - // 'loaded' must be set to true iff main resource has been loaded - // and document has been parsed. Otherwise, 'loaded' should be - // false. DomAgent will then add itself as a listener to the - // DOMContentLoaded event and will track document loading by itself. - void SetDocument(WebCore::Document* document, bool loaded); + void SetDocument(WebCore::Document* document); // Returns node for given id according to the present binding. WebCore::Node* GetNodeForId(int id); @@ -146,7 +142,6 @@ class DomAgentImpl : public DomAgent { HashSet<int> children_requested_; int last_node_id_; ListHashSet<RefPtr<WebCore::Document> > documents_; - HashSet<RefPtr<WebCore::Document> > loaded_documents_; RefPtr<WebCore::EventListener> event_listener_; // Captures pending document element request's call id. // Defaults to 0 meaning no pending request. diff --git a/webkit/glue/devtools/dom_agent_unittest.cc b/webkit/glue/devtools/dom_agent_unittest.cc index 0f31abc..b88a183 100644 --- a/webkit/glue/devtools/dom_agent_unittest.cc +++ b/webkit/glue/devtools/dom_agent_unittest.cc @@ -66,7 +66,7 @@ class DomAgentTests : public TestShellTest { mock_delegate_.set(new MockDomAgentDelegate()); dom_agent_.set(new DomAgentImpl(mock_delegate_.get())); - dom_agent_->SetDocument(document_.get(), true); + dom_agent_->SetDocument(document_.get()); } virtual void TearDown() { diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index 647a84b..fe9e72b 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -290,18 +290,8 @@ devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) { this.parsedScripts_[script.id] = new devtools.ScriptInfo( script.id, script.lineOffset); - var name = script.name; - if (name.indexOf('http') == 0) { - var slash = name.lastIndexOf('/'); - if (slash != -1) { - name = name.substr(slash + 1); - } - } - if (name.length > 100) { - name = name.substr(0, 50) + '...' + name.substr(name.length - 50); - } WebInspector.parsedScriptSource( - script.id, name, script.source, script.lineOffset); + script.id, script.name, script.source, script.lineOffset); } }; diff --git a/webkit/glue/devtools/js/dom_agent.js b/webkit/glue/devtools/js/dom_agent.js index 31d13a7..c33b03f 100644 --- a/webkit/glue/devtools/js/dom_agent.js +++ b/webkit/glue/devtools/js/dom_agent.js @@ -692,12 +692,13 @@ devtools.DomAgent.prototype.getNodeForId = function(nodeId) { devtools.DomAgent.prototype.setDocumentElement = function(payload) { var doc = this.getDocument(); if (doc.documentElement) { - return; + this.reset(); + doc = this.getDocument(); } this.setChildNodes(0, [payload]); doc.documentElement = doc.firstChild; doc.documentElement.ownerDocument = doc; - doc.fireDomEvent_("DOMContentLoaded"); + WebInspector.panels.elements.reset(); }; @@ -735,6 +736,13 @@ devtools.DomAgent.prototype.bindNodes_ = function(children) { * {@inheritDoc}. */ devtools.DomAgent.prototype.hasChildrenUpdated = function(nodeId, newValue) { + var node = this.idToDomNode_[nodeId]; + var outline = WebInspector.panels.elements.treeOutline; + var treeElement = outline.findTreeElement(node); + if (treeElement) { + treeElement.hasChildren = newValue; + treeElement.whitespaceIgnored = Preferences.ignoreWhitespace; + } }; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index e5cf8ad..4a6201f 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -71,7 +71,7 @@ void WebDevToolsAgentImpl::Attach() { Document* doc = page->mainFrame()->document(); if (doc) { debugger_agent_impl_->SetDocument(doc); - dom_agent_impl_->SetDocument(doc, true); + dom_agent_impl_->SetDocument(doc); net_agent_impl_->SetDocument(doc); } @@ -108,7 +108,7 @@ void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) { doc = NULL; } debugger_agent_impl_->SetDocument(doc); - dom_agent_impl_->SetDocument(doc, false); + dom_agent_impl_->SetDocument(doc); net_agent_impl_->SetDocument(doc); } |