| Index: Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
|
| index 8541804f0f6467bcea4ba1efcdfc9ebb8935fb92..42db5e9a383349cb05d58fcc6c1c0bee34d2d1c1 100644
|
| --- a/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -276,9 +276,10 @@ void InspectorDOMAgent::clearFrontend()
|
|
|
| void InspectorDOMAgent::restore()
|
| {
|
| - // Reset document to avoid early return from setDocument.
|
| - m_document = nullptr;
|
| - setDocument(m_pageAgent->mainFrame()->document());
|
| + if (!enabled())
|
| + return;
|
| + innerEnable();
|
| + notifyDocumentUpdated();
|
| }
|
|
|
| Vector<Document*> InspectorDOMAgent::documents()
|
| @@ -486,15 +487,27 @@ Element* InspectorDOMAgent::assertEditableElement(ErrorString* errorString, int
|
| return element;
|
| }
|
|
|
| -void InspectorDOMAgent::enable(ErrorString*)
|
| +void InspectorDOMAgent::innerEnable()
|
| {
|
| - if (enabled())
|
| - return;
|
| m_state->setBoolean(DOMAgentState::domAgentEnabled, true);
|
| if (m_listener)
|
| m_listener->domAgentWasEnabled();
|
| }
|
|
|
| +void InspectorDOMAgent::enable(ErrorString*)
|
| +{
|
| + if (enabled())
|
| + return;
|
| + innerEnable();
|
| + notifyDocumentUpdated();
|
| +}
|
| +
|
| +void InspectorDOMAgent::notifyDocumentUpdated()
|
| +{
|
| + m_document = nullptr;
|
| + setDocument(m_pageAgent->mainFrame()->document());
|
| +}
|
| +
|
| bool InspectorDOMAgent::enabled() const
|
| {
|
| return m_state->getBoolean(DOMAgentState::domAgentEnabled);
|
| @@ -513,7 +526,8 @@ 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);
|
| + if (!enabled())
|
| + innerEnable();
|
|
|
| if (!m_document) {
|
| *errorString = "Document is not available";
|
|
|