Changeset 73373 in webkit


Ignore:
Timestamp:
Dec 6, 2010 9:35:05 AM (13 years ago)
Author:
tony@chromium.org
Message:

2010-12-03 Tony Chang <tony@chromium.org>

Reviewed by Kent Tamura.

[chromium] fix 2 bugs with inspector tests in DRT
https://bugs.webkit.org/show_bug.cgi?id=50492

Tasks can outlive the tasklist (even when canceled) so this was
causing a crash when ~WebTask() ran. Avoid this by unregistering
when a task is canceled.

Also fix an assert when closing devtool windows by copying some
logic from test_shell.

  • DumpRenderTree/chromium/Task.cpp: (WebTask::~WebTask): (TaskList::revokeAll):
  • DumpRenderTree/chromium/Task.h: Canceling a task now removes it from

the tasklist (since the task can outlive the tasklist).

  • DumpRenderTree/chromium/TestShell.h: (TestShell::devToolsWebView):
  • DumpRenderTree/chromium/WebViewHost.cpp: (WebViewHost::~WebViewHost): Don't load about:blank when closing

a window if the window has devtools loaded. This avoids an
ASSERT and matches test_shell.

Location:
trunk/WebKitTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r73367 r73373  
     12010-12-03  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [chromium] fix 2 bugs with inspector tests in DRT
     6        https://bugs.webkit.org/show_bug.cgi?id=50492
     7
     8        Tasks can outlive the tasklist (even when canceled) so this was
     9        causing a crash when ~WebTask() ran.  Avoid this by unregistering
     10        when a task is canceled.
     11
     12        Also fix an assert when closing devtool windows by copying some
     13        logic from test_shell.
     14
     15        * DumpRenderTree/chromium/Task.cpp:
     16        (WebTask::~WebTask):
     17        (TaskList::revokeAll):
     18        * DumpRenderTree/chromium/Task.h: Canceling a task now removes it from
     19            the tasklist (since the task can outlive the tasklist).
     20        * DumpRenderTree/chromium/TestShell.h:
     21        (TestShell::devToolsWebView):
     22        * DumpRenderTree/chromium/WebViewHost.cpp:
     23        (WebViewHost::~WebViewHost): Don't load about:blank when closing
     24            a window if the window has devtools loaded.  This avoids an
     25            ASSERT and matches test_shell.
     26
    1272010-12-06  Alejandro G. Castro  <alex@igalia.com>
    228
  • trunk/WebKitTools/DumpRenderTree/chromium/Task.cpp

    r70064 r73373  
    3737
    3838WebTask::WebTask(TaskList* list): m_taskList(list) { m_taskList->registerTask(this); }
    39 WebTask::~WebTask() { m_taskList->unregisterTask(this); }
     39WebTask::~WebTask()
     40{
     41    if (m_taskList)
     42        m_taskList->unregisterTask(this);
     43}
    4044
    4145void TaskList::unregisterTask(WebTask* task)
     
    4852void TaskList::revokeAll()
    4953{
    50     for (unsigned i = 0; i < m_tasks.size(); ++i)
    51         m_tasks[i]->cancel();
    52     m_tasks.clear();
     54    while (!m_tasks.isEmpty())
     55        m_tasks[0]->cancel();
    5356}
    5457
  • trunk/WebKitTools/DumpRenderTree/chromium/Task.h

    r66701 r73373  
    4646    virtual void cancel() = 0;
    4747    virtual ~WebTask();
    48 private:
     48protected:
    4949    TaskList* m_taskList;
    5050};
     
    7272            runIfValid();
    7373    }
    74     virtual void cancel() { m_object = 0; }
     74    virtual void cancel()
     75    {
     76        m_object = 0;
     77        m_taskList->unregisterTask(this);
     78        m_taskList = 0;
     79    }
    7580    virtual void runIfValid() = 0;
    7681protected:
  • trunk/WebKitTools/DumpRenderTree/chromium/TestShell.h

    r71030 r73373  
    164164    DRTDevToolsAgent* drtDevToolsAgent() { return m_drtDevToolsAgent.get(); }
    165165    DRTDevToolsClient* drtDevToolsClient() { return m_drtDevToolsClient.get(); }
     166    WebViewHost* devToolsWebView() { return m_devTools; }
    166167
    167168    static const int virtualWindowBorder = 3;
  • trunk/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp

    r72206 r73373  
    11121112WebViewHost::~WebViewHost()
    11131113{
    1114     // Navigate to an empty page to fire all the destruction logic for the
    1115     // current page.
    1116     loadURLForFrame(GURL("about:blank"), WebString());
     1114    // DevTools frontend page is supposed to be navigated only once and
     1115    // loading another URL in that Page is an error.
     1116    if (m_shell->devToolsWebView() != this) {
     1117        // Navigate to an empty page to fire all the destruction logic for the
     1118        // current page.
     1119        loadURLForFrame(GURL("about:blank"), WebString());
     1120    }
    11171121
    11181122    // Call GC twice to clean up garbage.
Note: See TracChangeset for help on using the changeset viewer.