Drop unnecessary DatabaseManager::hasOpenDatabases() in PageCache::canCachePageContai...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 19:22:10 +0000 (19:22 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 19:22:10 +0000 (19:22 +0000)
commitc0f20370b788a3d1353154c6641b9a70632903bd
treec2da4d553b4352af1058c2051c5d12cf9d4c00c4
parent30143c047029818917f7ee476f0c5915b5a85e6a
Drop unnecessary DatabaseManager::hasOpenDatabases() in PageCache::canCachePageContainingThisFrame()
https://bugs.webkit.org/show_bug.cgi?id=142052

Reviewed by Andreas Kling.

Source/WebCore:

Drop WebDatabase special-handling from PageCache::canCachePageContainingThisFrame().
DatabaseContext is already an ActiveDOMObject and DatabaseContext::canSuspend() was
returning false so pages using WebDatabase would never enter the PageCache anyway.

This patch also overrides ActiveDOMObject::canSuspend() in DatabaseContext to only
return false when there are open databases. This check is now equivalent to the one
that was in PageCache.

An issue that remains is that DatabaseContext::m_hasOpenDatabases is never reset
to false so once a page opened a database, it will never be page-cacheable. This
will be taken care of separately though.

Test: fast/history/page-cache-webdatabase-opened-db.html

* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::canSuspend):
* Modules/webdatabase/DatabaseContext.h:
* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision):
(WebCore::PageCache::canCachePageContainingThisFrame):
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::hasOpenDatabasesKey): Deleted.
* page/DiagnosticLoggingKeys.h:

LayoutTests:

Add a layout test to check that a page with an open WebDatabase does
not enter the PageCache.

* fast/history/page-cache-webdatabase-opened-db-expected.txt: Added.
* fast/history/page-cache-webdatabase-opened-db.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/history/page-cache-webdatabase-opened-db-expected.txt [new file with mode: 0644]
LayoutTests/fast/history/page-cache-webdatabase-opened-db.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
Source/WebCore/Modules/webdatabase/DatabaseContext.h
Source/WebCore/history/PageCache.cpp
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h