Skip to content
  • jberlin@webkit.org's avatar
    Crash in WebDatabaseManagerProxy::getDatabaseOrigins when called after the WebProcess has · 2a7b7853
    jberlin@webkit.org authored
    died at least once
    https://bugs.webkit.org/show_bug.cgi?id=52730
    
    Reviewed by Darin Adler.
    
    WebDatabaseManagerProxy::invalidate was setting m_webContext to 0, and invalidate gets
    called in WebContext::processDidClose. However, m_webContext is only set in the
    constructor, which is only called from the constructor of WebContext, so attempting to send
    a message to any new WebProcess after the first one died was causing a null deref.
    
    This patch moves setting m_webcontext into clearContext and clearContext is only called in
    the WebContext destructor.
    
    This patch also adds checks for a valid WebProcessProxy before attempting to send messages to
    the WebProcessProxy so that if the WebProcess has died and has not been revived, it does not
    attempt to dereference a null WebProcessProxy.
    
    * UIProcess/WebContext.cpp:
    (WebKit::WebContext::~WebContext):
    Call WebDatabaseManagerProxy::clearContext.
    * UIProcess/WebContext.h:
    (WebKit::WebContext::hasValidProcess):
    Make this method public so that it can be called from WebDatabaseManagerProxy.
    
    * UIProcess/WebDatabaseManagerProxy.cpp:
    (WebKit::WebDatabaseManagerProxy::getDatabasesByOrigin):
    If there isn't a valid process, invalidate the callback and return early.
    (WebKit::WebDatabaseManagerProxy::getDatabaseOrigins):
    Ditto.
    (WebKit::WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin):
    If tehre isn't a valid process return early.
    (WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin):
    Ditto.
    (WebKit::WebDatabaseManagerProxy::deleteAllDatabases):
    Ditto.
    (WebKit::WebDatabaseManagerProxy::setQuotaForOrigin):
    Ditto.
    (WebKit::WebDatabaseManagerProxy::invalidate):
    Move setting m_webContext to 0 from here ...
    * UIProcess/WebDatabaseManagerProxy.h:
    (WebKit::WebDatabaseManagerProxy::clearContext):
    ... to here.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2a7b7853