-
joepeck@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=64177 Reviewed by Alexey Proskuryakov. 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> Include spaceNeeded information in the output dumped for appcache quota delegates. Add and update tests related to handling of per-origin quotas. * http/tests/appcache/origin-quota-continued-download-expected.txt: Added. * http/tests/appcache/origin-quota-continued-download.html: Added. * http/tests/appcache/resources/quota-origin-continued-download.html: Added. * http/tests/appcache/resources/quota-origin-continued-download.manifest: Added. New test which checks that there will still be a successful cache when the per-origin quota is reached and increased at the end of downloading. * http/tests/appcache/origin-quota-continued-download-multiple-manifests-expected.txt: Added. * http/tests/appcache/origin-quota-continued-download-multiple-manifests.html: Added. * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-1.html: Added. * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-1.manifest: Added. * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-2.html: Added. * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-2.manifest: Added. * http/tests/appcache/resources/quota-origin-continued-download.html: Added. * http/tests/appcache/resources/quota-origin-continued-download.manifest: Added. New test which checks that the spaceNeeded appropriately lists enough space for multiple manifests across multiple frames for the same origin. * http/tests/appcache/resources/quota-origin-iframe-3.manifest: Fix a typo. * http/tests/appcache/origin-quota.html: Update the old test to disallow automatic increase of the quota, which is the default handling of DRT when reaching the quota. * platform/chromium/test_expectations.txt: * platform/gtk/Skipped: * platform/qt/Skipped: * platform/win/Skipped: * platform/wk2/Skipped: Skip the test on ports that don't implement ApplicationCache per-origin quotas. 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> New behavior of handling ApplicationCache per-origin quotas. Previously, if the quota was reached while downloading we would fail the download and then prompt the user for a storage increase. This required a refresh, a redownload of resources, and the total storage was not known so the process could be repeated multiple times before an acceptable quota was found or the user disallowed an increase. The new behavior is to complete the download of the entire appcache. When the cache completes downloading and it is greater than the origin quota, prompt the user to allow a quota increase with the known space needed. If the quota is increased, the cache will succeed, otherwise it will fail with the normal failure steps. An alternative behavior is prompting while downloading immediately when the origin quota is reached, however at that point the entire space needed is unknown and so quota increases might not be enough and could result in multiple prompts to the user. Tests: http/tests/appcache/origin-quota-continued-download-multiple-manifests.html http/tests/appcache/origin-quota-continued-download.html * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): Rename instance variable to be more clear on its intent. (WebCore::ApplicationCacheGroup::didFinishLoading): Check the quota limit while downloading so we can fail early if the user already denied a quota increase. (WebCore::ApplicationCacheGroup::didReachOriginQuota): Pass the space needed information to the chrome client. (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota): Removed. Instead convert the callers to update state and console log when the per-origin quota is reached. This allows us to follow the normal failure steps if the quota is reached at the end of a download, and the alternative short path when we fail during downloading. (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota): Extract to a helper function. (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): Allow for a quota increase at the end of the download now that we know the space needed. Then proceed to fail or succeed as we normally would. * loader/appcache/ApplicationCacheStorage.h: * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::checkOriginQuota): (WebCore::ApplicationCacheStorage::storeNewestCache): Extract checking the origin quota for when an ApplicationCacheGroup will be replacing an ApplicationCacheGroup into a helper function. The helper also provides an out parameter for the space needed to properly fit the new cache group if it wouldn't fit. * page/ChromeClient.h: * loader/EmptyClients.h: (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota): Add a space needed parameter when reaching the per-origin quota. 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> * WebView/WebUIDelegatePrivate.h: * DefaultDelegates/WebDefaultUIDelegate.m: (-[WebDefaultUIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:spaceNeeded:]): Update the delegate to include a space needed parameter. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::reachedApplicationCacheOriginQuota): Call the delegate with the new space needed information. 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> * Api/qwebpage.cpp: * Api/qwebpage.h: * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota): * WebCoreSupport/ChromeClientQt.h: Pass the spaceNeeded value through to the applicationCacheQuotaExceeded signal. 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> Add layoutTestController.disallowIncreaseForApplicationCacheQuota() to disable the default behavior of raising the default per-origin quota to 5MB when reached. This allows us to test what happens when the quota is reached and not increased. * DumpRenderTree/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (disallowIncreaseForApplicationCacheQuotaCallback): (LayoutTestController::staticFunctions): * DumpRenderTree/LayoutTestController.h: (LayoutTestController::disallowIncreaseForApplicationCacheQuota): (LayoutTestController::setDisallowIncreaseForApplicationCacheQuota): * DumpRenderTree/qt/LayoutTestControllerQt.cpp: (LayoutTestController::reset): * DumpRenderTree/qt/LayoutTestControllerQt.h: (LayoutTestController::disallowIncreaseForApplicationCacheQuota): (LayoutTestController::dumpApplicationCacheDelegateCallbacks): Expose a function to prevent automatically increasing the per-origin quota when the quota is reached. This allows us to test what happens when a user would "disallow" a quota increase. * DumpRenderTree/mac/UIDelegate.mm: (-[UIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:spaceNeeded:]): * DumpRenderTree/qt/DumpRenderTreeQt.cpp: (WebCore::DumpRenderTree::dumpApplicationCacheQuota): Respect the new disallowIncrease flag and dump the spaceNeeded values for ports that implement application cache quotas. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
98b3b582