Chromium Code Reviews| Index: Source/core/inspector/InspectorDOMAgent.cpp |
| diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp |
| index 8541804f0f6467bcea4ba1efcdfc9ebb8935fb92..470a9301bbd74a8bc6a4fccb115679200fe5f9ad 100644 |
| --- a/Source/core/inspector/InspectorDOMAgent.cpp |
| +++ b/Source/core/inspector/InspectorDOMAgent.cpp |
| @@ -276,6 +276,8 @@ void InspectorDOMAgent::clearFrontend() |
| void InspectorDOMAgent::restore() |
| { |
| + if (!enabled()) |
|
pfeldman
2014/06/27 11:35:23
restore should always be
if (m_state->getBoolean(
|
| + return; |
| // Reset document to avoid early return from setDocument. |
| m_document = nullptr; |
| setDocument(m_pageAgent->mainFrame()->document()); |
| @@ -486,7 +488,7 @@ Element* InspectorDOMAgent::assertEditableElement(ErrorString* errorString, int |
| return element; |
| } |
| -void InspectorDOMAgent::enable(ErrorString*) |
| +void InspectorDOMAgent::innerEnable() |
| { |
| if (enabled()) |
|
pfeldman
2014/06/27 11:35:23
innerEnable should not check for enabled, enable s
|
| return; |
| @@ -495,6 +497,13 @@ void InspectorDOMAgent::enable(ErrorString*) |
| m_listener->domAgentWasEnabled(); |
| } |
| +void InspectorDOMAgent::enable(ErrorString*) |
| +{ |
| + innerEnable(); |
| + m_document = nullptr; |
| + setDocument(m_pageAgent->mainFrame()->document()); |
|
pfeldman
2014/06/27 11:35:23
This should be a part of innerEnable.
|
| +} |
| + |
| bool InspectorDOMAgent::enabled() const |
| { |
| return m_state->getBoolean(DOMAgentState::domAgentEnabled); |
| @@ -513,7 +522,7 @@ void InspectorDOMAgent::disable(ErrorString*) |
| void InspectorDOMAgent::getDocument(ErrorString* errorString, RefPtr<TypeBuilder::DOM::Node>& root) |
| { |
| // Backward compatibility. Mark agent as enabled when it requests document. |
| - enable(errorString); |
| + innerEnable(); |
| if (!m_document) { |
| *errorString = "Document is not available"; |