Commit 0aff12c2 authored by aroben@apple.com's avatar aroben@apple.com

Fix Bug 19051: REGRESSION (r33447): Assertion in...

        Fix Bug 19051: REGRESSION (r33447): Assertion in JSDebugServer::removeListener closing tab with Inspector open

        m_inspectedPage is now cleared when the Page is destroyed, which never
        used to happen. Some of InspectorController's code was not prepared
        for this.

        Reviewed by Dave Hyatt.

        * page/InspectorController.cpp:
        (WebCore::InspectorController::~InspectorController): Removed a call
        to stopDebugging and added an assertion. Debugging should have already
        been stopped by this point.
        (WebCore::InspectorController::inspectedPageDestroyed): Moved here
        from the header file. Added a call to stopDebugging.
        (WebCore::InspectorController::enabled): Return false if our inspected
        Page has already been destroyed, since we can't really do much at this
        point anyway.
        (WebCore::InspectorController::didCommitLoad):
        (WebCore::InspectorController::didLoadResourceFromMemoryCache):
        (WebCore::InspectorController::identifierForInitialRequest):
        (WebCore::InspectorController::startDebuggingAndReloadInspectedPage):
        (WebCore::InspectorController::stopDebugging):
        (WebCore::InspectorController::drawNodeHighlight):
        Assert that m_inspectedPage hasn't been cleared.
        * page/InspectorController.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3571e8f6
2008-05-14 Adam Roben <aroben@apple.com>
Fix Bug 19051: REGRESSION (r33447): Assertion in
JSDebugServer::removeListener closing tab with Inspector open
m_inspectedPage is now cleared when the Page is destroyed, which never
used to happen. Some of InspectorController's code was not prepared
for this.
Reviewed by Dave Hyatt.
* page/InspectorController.cpp:
(WebCore::InspectorController::~InspectorController): Removed a call
to stopDebugging and added an assertion. Debugging should have already
been stopped by this point.
(WebCore::InspectorController::inspectedPageDestroyed): Moved here
from the header file. Added a call to stopDebugging.
(WebCore::InspectorController::enabled): Return false if our inspected
Page has already been destroyed, since we can't really do much at this
point anyway.
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::didLoadResourceFromMemoryCache):
(WebCore::InspectorController::identifierForInitialRequest):
(WebCore::InspectorController::startDebuggingAndReloadInspectedPage):
(WebCore::InspectorController::stopDebugging):
(WebCore::InspectorController::drawNodeHighlight):
Assert that m_inspectedPage hasn't been cleared.
* page/InspectorController.h:
2008-05-14 Justin Garcia <justin.garcia@apple.com>
Reviewed by Darin.
......@@ -997,14 +997,25 @@ InspectorController::~InspectorController()
if (m_page)
m_page->setParentInspectorController(0);
stopDebugging();
// m_inspectedPage should have been cleared in inspectedPageDestroyed().
ASSERT(!m_inspectedPage);
deleteAllValues(m_frameResources);
deleteAllValues(m_consoleMessages);
}
void InspectorController::inspectedPageDestroyed()
{
ASSERT(m_inspectedPage);
stopDebugging();
m_inspectedPage = 0;
}
bool InspectorController::enabled() const
{
if (!m_inspectedPage)
return false;
return m_inspectedPage->settings()->developerExtrasEnabled();
}
......@@ -1797,6 +1808,8 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
if (!enabled())
return;
ASSERT(m_inspectedPage);
if (loader->frame() == m_inspectedPage->mainFrame()) {
m_client->inspectedURLChanged(loader->url().string());
......@@ -1889,6 +1902,8 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader,
resource->responseReceivedTime = resource->startTime;
resource->endTime = resource->startTime;
ASSERT(m_inspectedPage);
if (loader->frame() == m_inspectedPage->mainFrame() && request.url() == loader->requestURL())
m_mainResource = resource;
......@@ -1907,6 +1922,8 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier,
updateResourceRequest(resource.get(), request);
ASSERT(m_inspectedPage);
if (loader->frame() == m_inspectedPage->mainFrame() && request.url() == loader->requestURL())
m_mainResource = resource;
......@@ -2064,6 +2081,8 @@ void InspectorController::moveWindowBy(float x, float y) const
void InspectorController::startDebuggingAndReloadInspectedPage()
{
ASSERT(m_inspectedPage);
JavaScriptDebugServer::shared().addListener(this, m_inspectedPage);
m_debuggerAttached = true;
JavaScriptDebugServer::shared().clearBreakpoints();
......@@ -2072,6 +2091,8 @@ void InspectorController::startDebuggingAndReloadInspectedPage()
void InspectorController::stopDebugging()
{
ASSERT(m_inspectedPage);
JavaScriptDebugServer::shared().removeListener(this, m_inspectedPage);
m_debuggerAttached = false;
}
......@@ -2206,6 +2227,8 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const
lineBoxRects.append(boundingBox);
}
ASSERT(m_inspectedPage);
FrameView* view = m_inspectedPage->mainFrame()->view();
FloatRect overlayRect = view->visibleContentRect();
......
......@@ -74,7 +74,7 @@ public:
InspectorController(Page*, InspectorClient*);
~InspectorController();
void inspectedPageDestroyed() { m_inspectedPage = 0; }
void inspectedPageDestroyed();
void pageDestroyed() { m_page = 0; }
bool enabled() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment