Changeset 90856 in webkit


Ignore:
Timestamp:
Jul 12, 2011 3:00:45 PM (13 years ago)
Author:
Joseph Pecoraro
Message:

ApplicationCache update should not immediately fail when reaching per-origin quota
https://bugs.webkit.org/show_bug.cgi?id=64177

Reviewed by Alexey Proskuryakov.

2011-07-12 Joseph Pecoraro <Joseph Pecoraro>

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 <Joseph Pecoraro>

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 <Joseph Pecoraro>

  • 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 <Joseph Pecoraro>

  • 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 <Joseph Pecoraro>

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.
Location:
trunk
Files:
9 added
58 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90830 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Include spaceNeeded information in the output dumped for appcache quota delegates.
     9        Add and update tests related to handling of per-origin quotas.
     10
     11        * http/tests/appcache/origin-quota-continued-download-expected.txt: Added.
     12        * http/tests/appcache/origin-quota-continued-download.html: Added.
     13        * http/tests/appcache/resources/quota-origin-continued-download.html: Added.
     14        * http/tests/appcache/resources/quota-origin-continued-download.manifest: Added.
     15        New test which checks that there will still be a successful cache
     16        when the per-origin quota is reached and increased at the end of downloading.
     17
     18        * http/tests/appcache/origin-quota-continued-download-multiple-manifests-expected.txt: Added.
     19        * http/tests/appcache/origin-quota-continued-download-multiple-manifests.html: Added.
     20        * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-1.html: Added.
     21        * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-1.manifest: Added.
     22        * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-2.html: Added.
     23        * http/tests/appcache/resources/quota-origin-continued-download-multiple-manifests-2.manifest: Added.
     24        * http/tests/appcache/resources/quota-origin-continued-download.html: Added.
     25        * http/tests/appcache/resources/quota-origin-continued-download.manifest: Added.
     26        New test which checks that the spaceNeeded appropriately lists enough space for
     27        multiple manifests across multiple frames for the same origin.
     28
     29        * http/tests/appcache/resources/quota-origin-iframe-3.manifest: Fix a typo.
     30        * http/tests/appcache/origin-quota.html:
     31        Update the old test to disallow automatic increase of the quota,
     32        which is the default handling of DRT when reaching the quota.
     33
     34        * platform/chromium/test_expectations.txt:
     35        * platform/gtk/Skipped:
     36        * platform/qt/Skipped:
     37        * platform/win/Skipped:
     38        * platform/wk2/Skipped:
     39        Skip the test on ports that don't implement ApplicationCache per-origin quotas.
     40
    1412011-07-12  Pavel Feldman  <pfeldman@google.com>
    242
  • trunk/LayoutTests/http/tests/appcache/origin-quota-continued-download-multiple-manifests.html

    r90855 r90856  
    3838
    3939function addFirstIFrame() {
    40     // Expected to succeed.
    41     addIFrameWithContinuation("resources/quota-origin-iframe-1.html", function(event) {
     40    // Expected to succeed. Will be ~15kb out of the 20kb limit.
     41    addIFrameWithContinuation("resources/quota-origin-continued-download-multiple-manifests-1.html", function(event) {
    4242        log(event.data);
    4343        addSecondIFrame();
     
    4646
    4747function addSecondIFrame() {
    48     // Expected to fail, then increase the quota.
    49     // NOTE: When this fails, the exceed callback will automatically increase it back to the default quota size.
    50     addIFrameWithContinuation("resources/quota-origin-iframe-2.html", function(event) {
    51         log(event.data);
    52         addThirdIFrame();
    53     });
    54 }
    55 
    56 function addThirdIFrame() {
    57     // Expected to succeed.
    58     addIFrameWithContinuation("resources/quota-origin-iframe-3.html", function(event) {
     48    // Expected to succeed, due to automatically increasing the quota.
     49    addIFrameWithContinuation("resources/quota-origin-continued-download-multiple-manifests-2.html", function(event) {
    5950        log(event.data);
    6051        finishTest();
     
    6556</head>
    6657<body onload="startTest()">
    67 <p>This test checks that per-origin application cache quotas are enforced.</p>
     58<p>This test checks that per-origin application cache quota works correctly with multiple manifests/caches per-origin.</p>
    6859<p>
    6960    This test sets the quota for the origin to 20kb, and attempts to fill
    70     it up with 2 iframes that are 13kb each. The application cache download
    71     process should fail on the 2nd iframe and the UI Delegate should be
    72     informed of the exceeded quota. Increasing the size to 40kb. A 3rd
    73     iframe is added, which should succeed.
     61    it up with 2 different application caches about 15kb each.
     62
     63    The first frame will cache successfully and fill up about 15kb of
     64    the origin quota.
     65
     66    The second frame will reach the quota, cause a delegate callback,
     67    dump the spaceNeeded (which should be enough for both iframe caches),
     68    and succeed due to the default DRT behavior or raising the quota.
    7469</p>
    7570<pre id="console"></pre>
  • trunk/LayoutTests/http/tests/appcache/origin-quota-expected.txt

    r86417 r90856  
    1 UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{http, 127.0.0.1, 8000}
     1UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{http, 127.0.0.1, 8000} spaceNeeded:31161
    22CONSOLE MESSAGE: line 0: Application Cache update failed, because size quota was exceeded.
    33This test checks that per-origin application cache quotas are enforced.
  • trunk/LayoutTests/http/tests/appcache/origin-quota.html

    r64613 r90856  
    1515        layoutTestController.clearAllApplicationCaches();
    1616        layoutTestController.dumpApplicationCacheDelegateCallbacks();
     17        layoutTestController.disallowIncreaseForApplicationCacheQuota();
    1718        layoutTestController.setApplicationCacheOriginQuota(20*1024);
    1819        layoutTestController.dumpAsText();
     
    4748function addSecondIFrame() {
    4849    // Expected to fail, then increase the quota.
    49     // NOTE: When this fails, the exceed callback will automatically increase it back to the default quota size.
    5050    addIFrameWithContinuation("resources/quota-origin-iframe-2.html", function(event) {
    5151        log(event.data);
     52        layoutTestController.setApplicationCacheOriginQuota(100*1024);
    5253        addThirdIFrame();
    5354    });
  • trunk/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.manifest

    r64613 r90856  
    11CACHE MANIFEST
    22
    3 # iframe-3 should succeed. The origin quota shuld have been
     3# iframe-3 should succeed. The origin quota should have been
    44# raised to 40kb, with ~13kb already cached. Caching abe.png
    55# and this manifest will be ~13kb, bringing us up to 26kb.
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r90828 r90856  
    21422142BUGWK42964 WIN LINUX : tables/mozilla_expected_failures/bugs/bug89315.html = PASS FAIL
    21432143
    2144 // Application Cache Quotas
    2145 BUGWK43459 : http/tests/appcache/origin-quota.html = TEXT MISSING
     2144// Application Cache Quotas are N/A to the chromium port.
     2145BUGWK43459 WONTFIX: http/tests/appcache/origin-quota.html = TEXT MISSING
     2146BUGWK43459 WONTFIX: http/tests/appcache/origin-quota-continued-download.html = TEXT MISSING
     2147BUGWK43459 WONTFIX: http/tests/appcache/origin-quota-continued-download-multiple-manifests.html = TEXT MISSING
    21462148
    21472149// Need to support DeviceMotion.
  • trunk/LayoutTests/platform/gtk/Skipped

    r90726 r90856  
    585585http/tests/appcache/fallback.html
    586586http/tests/appcache/origin-quota.html
     587http/tests/appcache/origin-quota-continued-download.html
     588http/tests/appcache/origin-quota-continued-download-multiple-manifests.html
    587589http/tests/appcache/origin-delete.html
    588590http/tests/appcache/origins-with-appcache.html
  • trunk/LayoutTests/platform/qt/Skipped

    r90741 r90856  
    3030# - Failing SVG tests
    3131# - failing animations tests
    32 # - failing application cache quota tests
    3332# - Failing CSS Tests
    3433# - Failing dom/xhtml tests
  • trunk/LayoutTests/platform/win/Skipped

    r90806 r90856  
    11451145# https://bugs.webkit.org/show_bug.cgi?id=43458
    11461146http/tests/appcache/origin-quota.html
     1147http/tests/appcache/origin-quota-continued-download.html
     1148http/tests/appcache/origin-quota-continued-download-multiple-manifests.html
    11471149
    11481150# https://bugs.webkit.org/show_bug.cgi?id=43332
  • trunk/LayoutTests/platform/wk2/Skipped

    r90821 r90856  
    16571657http/tests/appcache/origin-delete.html
    16581658http/tests/appcache/origin-quota.html
     1659http/tests/appcache/origin-quota-continued-download.html
     1660http/tests/appcache/origin-quota-continued-download-multiple-manifests.html
    16591661http/tests/appcache/origins-with-appcache.html
    16601662
  • trunk/Source/WebCore/ChangeLog

    r90853 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        New behavior of handling ApplicationCache per-origin quotas. Previously,
     9        if the quota was reached while downloading we would fail the download
     10        and then prompt the user for a storage increase. This required a refresh,
     11        a redownload of resources, and the total storage was not known so the
     12        process could be repeated multiple times before an acceptable quota
     13        was found or the user disallowed an increase.
     14       
     15        The new behavior is to complete the download of the entire appcache.
     16        When the cache completes downloading and it is greater than the origin
     17        quota, prompt the user to allow a quota increase with the known space
     18        needed. If the quota is increased, the cache will succeed, otherwise
     19        it will fail with the normal failure steps.
     20
     21        An alternative behavior is prompting while downloading immediately
     22        when the origin quota is reached, however at that point the entire
     23        space needed is unknown and so quota increases might not be enough
     24        and could result in multiple prompts to the user.
     25
     26        Tests: http/tests/appcache/origin-quota-continued-download-multiple-manifests.html
     27               http/tests/appcache/origin-quota-continued-download.html
     28
     29        * loader/appcache/ApplicationCacheGroup.h:
     30        * loader/appcache/ApplicationCacheGroup.cpp:
     31        (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
     32        Rename instance variable to be more clear on its intent.
     33
     34        (WebCore::ApplicationCacheGroup::didFinishLoading):
     35        Check the quota limit while downloading so we can fail early
     36        if the user already denied a quota increase.
     37
     38        (WebCore::ApplicationCacheGroup::didReachOriginQuota):
     39        Pass the space needed information to the chrome client.
     40
     41        (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota):
     42        Removed. Instead convert the callers to update state and console
     43        log when the per-origin quota is reached. This allows us to follow
     44        the normal failure steps if the quota is reached at the end of a
     45        download, and the alternative short path when we fail during downloading.
     46
     47        (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
     48        Extract to a helper function.
     49
     50        (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
     51        Allow for a quota increase at the end of the download now that
     52        we know the space needed. Then proceed to fail or succeed
     53        as we normally would.
     54
     55        * loader/appcache/ApplicationCacheStorage.h:
     56        * loader/appcache/ApplicationCacheStorage.cpp:
     57        (WebCore::ApplicationCacheStorage::checkOriginQuota):
     58        (WebCore::ApplicationCacheStorage::storeNewestCache):
     59        Extract checking the origin quota for when an ApplicationCacheGroup
     60        will be replacing an ApplicationCacheGroup into a helper function.
     61        The helper also provides an out parameter for the space needed
     62        to properly fit the new cache group if it wouldn't fit.
     63
     64        * page/ChromeClient.h:
     65        * loader/EmptyClients.h:
     66        (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota):
     67        Add a space needed parameter when reaching the per-origin quota.
     68
    1692011-07-12  Chris Rogers  <crogers@google.com>
    270
  • trunk/Source/WebCore/loader/EmptyClients.h

    r89430 r90856  
    186186#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    187187    virtual void reachedMaxAppCacheSize(int64_t) { }
    188     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*) { }
     188    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t) { }
    189189#endif
    190190
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r90389 r90856  
    7373    , m_loadedSize(0)
    7474    , m_availableSpaceInQuota(ApplicationCacheStorage::unknownQuota())
    75     , m_originQuotaReached(false)
     75    , m_originQuotaExceededPreviously(false)
    7676{
    7777}
     
    601601    // After finishing the loading of any resource, we check if it will
    602602    // fit in our last known quota limit.
    603     if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota()) {
    604         // Failed to determine what is left in the quota. Fallback to allowing anything.
    605         if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota))
    606             m_availableSpaceInQuota = ApplicationCacheStorage::noQuota();
    607     }
    608 
    609     // Check each resource, as it loads, to see if it would fit in our
    610     // idea of the available quota space.
    611     if (m_availableSpaceInQuota < m_loadedSize) {
     603    // FIXME: The quota could be changed by another appcache in the same origin.
     604    if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota())
     605        recalculateAvailableSpaceInQuota();
     606
     607    // While downloading check to see if we have exceeded the available quota.
     608    // We can stop immediately if we have already previously failed
     609    // due to an earlier quota restriction. The client was already notified
     610    // of the quota being reached and decided not to increase it then.
     611    // FIXME: Should we break earlier and prevent redownloading on later page loads?
     612    // We could then also get rid of m_loadedSize.
     613    if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_loadedSize) {
    612614        m_currentResource = 0;
    613         cacheUpdateFailedDueToOriginQuota();
     615        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.", 0, String());
     616        cacheUpdateFailed();
    614617        return;
    615618    }
     
    796799}
    797800
    798 void ApplicationCacheGroup::didReachOriginQuota(PassRefPtr<Frame> frame)
    799 {
    800     // Inform the client the origin quota has been reached,
    801     // they may decide to increase the quota.
    802     frame->page()->chrome()->client()->reachedApplicationCacheOriginQuota(m_origin.get());
     801void ApplicationCacheGroup::didReachOriginQuota(int64_t totalSpaceNeeded)
     802{
     803    // Inform the client the origin quota has been reached, they may decide to increase the quota.
     804    // We expect quota to be increased synchronously while waiting for the call to return.
     805    m_frame->page()->chrome()->client()->reachedApplicationCacheOriginQuota(m_origin.get(), totalSpaceNeeded);
    803806}
    804807
     
    813816}
    814817
    815 void ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota()
    816 {
    817     if (!m_originQuotaReached) {
    818         m_originQuotaReached = true;
    819         scheduleReachedOriginQuotaCallback();
    820     }
    821 
    822     m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.", 0, String());
    823 
    824     // FIXME: Should not abort cache update - the user may choose to increase the quota.
    825     cacheUpdateFailed();
     818void ApplicationCacheGroup::recalculateAvailableSpaceInQuota()
     819{
     820    if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
     821        // Failed to determine what is left in the quota. Fallback to allowing anything.
     822        m_availableSpaceInQuota = ApplicationCacheStorage::noQuota();
     823    }
    826824}
    827825   
     
    904902        }
    905903
     904        RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>() : m_newestCache;
     905
     906        // If we exceeded the origin quota while downloading we can request a quota
     907        // increase now, before we attempt to store the cache.
     908        int64_t totalSpaceNeeded;
     909        if (!cacheStorage().checkOriginQuota(this, oldNewestCache.get(), m_cacheBeingUpdated.get(), totalSpaceNeeded))
     910            didReachOriginQuota(totalSpaceNeeded);
     911
    906912        ApplicationCacheStorage::FailureReason failureReason;
    907         RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>() : m_newestCache;
    908913        setNewestCache(m_cacheBeingUpdated.release());
    909914        if (cacheStorage().storeNewestCache(this, oldNewestCache.get(), failureReason)) {
     
    919924            postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders);
    920925            // It is clear that the origin quota was not reached, so clear the flag if it was set.
    921             m_originQuotaReached = false;
     926            m_originQuotaExceededPreviously = false;
    922927        } else {
    923928            if (failureReason == ApplicationCacheStorage::OriginQuotaReached) {
    924                 // We ran out of space for this origin. Roll back to previous state.
    925                 if (oldNewestCache)
    926                     setNewestCache(oldNewestCache.release());
    927                 cacheUpdateFailedDueToOriginQuota();
    928                 return;
     929                // We ran out of space for this origin. Fall down to the normal error handling
     930                // after recording this state.
     931                m_originQuotaExceededPreviously = true;
     932                m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.", 0, String());
    929933            }
    930934
    931935            if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) {
     936                // FIXME: Should this be handled more like Origin Quotas? Does this fail properly?
     937
    932938                // We ran out of space. All the changes in the cache storage have
    933939                // been rolled back. We roll back to the previous state in here,
     
    10931099}
    10941100
    1095 void ApplicationCacheGroup::scheduleReachedOriginQuotaCallback()
    1096 {
    1097     // FIXME: it might be nice to run this asynchronously, because there is no return value to wait for.
    1098     didReachOriginQuota(m_frame);
    1099 }
    1100 
    11011101class CallCacheListenerTask : public ScriptExecutionContext::Task {
    11021102public:
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h

    r84260 r90856  
    104104
    105105    void scheduleReachedMaxAppCacheSizeCallback();
    106     void scheduleReachedOriginQuotaCallback();
    107106
    108107    PassRefPtr<ResourceHandle> createResourceHandle(const KURL&, ApplicationCacheResource* newestCachedResource);
     
    121120    void didFinishLoadingManifest();
    122121    void didReachMaxAppCacheSize();
    123     void didReachOriginQuota(PassRefPtr<Frame> frame);
     122    void didReachOriginQuota(int64_t totalSpaceNeeded);
    124123   
    125124    void startLoadingEntry();
     
    127126    void checkIfLoadIsComplete();
    128127    void cacheUpdateFailed();
    129     void cacheUpdateFailedDueToOriginQuota();
     128    void recalculateAvailableSpaceInQuota();
    130129    void manifestNotFound();
    131130   
     
    203202    int64_t m_loadedSize;
    204203    int64_t m_availableSpaceInQuota;
    205     bool m_originQuotaReached;
     204    bool m_originQuotaExceededPreviously;
    206205
    207206    friend class ChromeClientCallbackTimer;
    208     friend class OriginQuotaReachedCallbackTimer;
    209207};
    210208
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp

    r87704 r90856  
    956956}
    957957
     958bool ApplicationCacheStorage::checkOriginQuota(ApplicationCacheGroup* group, ApplicationCache* oldCache, ApplicationCache* newCache, int64_t& totalSpaceNeeded)
     959{
     960    // Check if the oldCache with the newCache would reach the per-origin quota.
     961    int64_t remainingSpaceInOrigin;
     962    const SecurityOrigin* origin = group->origin();
     963    if (remainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
     964        if (remainingSpaceInOrigin < newCache->estimatedSizeInStorage()) {
     965            int64_t quota;
     966            if (quotaForOrigin(origin, quota)) {
     967                totalSpaceNeeded = quota - remainingSpaceInOrigin + newCache->estimatedSizeInStorage();
     968                return false;
     969            }
     970
     971            ASSERT_NOT_REACHED();
     972            totalSpaceNeeded = 0;
     973            return false;
     974        }
     975    }
     976
     977    return true;
     978}
     979
    958980bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group, ApplicationCache* oldCache, FailureReason& failureReason)
    959981{
     
    971993
    972994    // Check if this would reach the per-origin quota.
    973     int64_t remainingSpaceInOrigin;
    974     if (remainingSizeForOriginExcludingCache(group->origin(), oldCache, remainingSpaceInOrigin)) {
    975         if (remainingSpaceInOrigin < group->newestCache()->estimatedSizeInStorage()) {
    976             failureReason = OriginQuotaReached;
    977             return false;
    978         }
     995    int64_t totalSpaceNeededIgnored;
     996    if (!checkOriginQuota(group, oldCache, group->newestCache(), totalSpaceNeededIgnored)) {
     997        failureReason = OriginQuotaReached;
     998        return false;
    979999    }
    9801000
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h

    r87704 r90856  
    7070    bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
    7171    bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota);
     72    bool checkOriginQuota(ApplicationCacheGroup*, ApplicationCache* oldCache, ApplicationCache* newCache, int64_t& totalSpaceNeeded);
    7273
    7374    ApplicationCacheGroup* cacheGroupForURL(const KURL&); // Cache to load a main resource from.
  • trunk/Source/WebCore/page/ChromeClient.h

    r90164 r90856  
    193193        // more than allowed on this origin. This callback allows the chrome client
    194194        // to take action, such as prompting the user to ask to increase the quota
    195         // for this origin.
    196         virtual void reachedApplicationCacheOriginQuota(SecurityOrigin* origin) = 0;
     195        // for this origin. The totalSpaceNeeded parameter is the total amount of
     196        // storage, in bytes, needed to store the new cache along with all of the
     197        // other existing caches for the origin that would not be replaced by
     198        // the new cache.
     199        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded) = 0;
    197200#endif
    198201
  • trunk/Source/WebKit/chromium/ChangeLog

    r90850 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * src/ChromeClientImpl.cpp:
     9        (WebKit::ChromeClientImpl::reachedApplicationCacheOriginQuota):
     10        * src/ChromeClientImpl.h:
     11
    1122011-07-12  John Bates  <jbates@google.com>
    213
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r90164 r90856  
    663663}
    664664
    665 void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     665void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    666666{
    667667    ASSERT_NOT_REACHED();
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.h

    r90164 r90856  
    132132#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    133133    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    134     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     134    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
    135135#endif
    136136#if ENABLE(NOTIFICATIONS)
  • trunk/Source/WebKit/efl/ChangeLog

    r90808 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/ChromeClientEfl.cpp:
     9        (WebCore::ChromeClientEfl::reachedApplicationCacheOriginQuota):
     10        * WebCoreSupport/ChromeClientEfl.h:
     11
    1122011-07-11  Jaehun Lim  <ljaehun.lim@samsung.com>
    213
  • trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp

    r89812 r90856  
    384384}
    385385
    386 void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     386void ChromeClientEfl::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    387387{
    388388    notImplemented();
  • trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h

    r89811 r90856  
    115115#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    116116    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    117     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
     117    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
    118118#endif
    119119
  • trunk/Source/WebKit/gtk/ChangeLog

    r90776 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/ChromeClientGtk.cpp:
     9        (WebKit::ChromeClient::reachedApplicationCacheOriginQuota):
     10        * WebCoreSupport/ChromeClientGtk.h:
     11
    1122011-06-14  Mike Stegeman  <mrstegeman@gmail.com>
    213
  • trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r89937 r90856  
    603603}
    604604
    605 void ChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     605void ChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    606606{
    607607    notImplemented();
  • trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

    r89937 r90856  
    123123#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    124124        virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    125         virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     125        virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
    126126#endif
    127127#if ENABLE(CONTEXT_MENUS)
  • trunk/Source/WebKit/haiku/ChangeLog

    r89216 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/ChromeClientHaiku.cpp:
     9        (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
     10        * WebCoreSupport/ChromeClientHaiku.h:
     11
    1122011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
    213
  • trunk/Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp

    r89216 r90856  
    357357}
    358358
    359 void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     359void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    360360{
    361361    notImplemented();
  • trunk/Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h

    r89216 r90856  
    141141#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    142142        virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    143         virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
     143        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
    144144#endif
    145145#if ENABLE(CONTEXT_MENUS)
  • trunk/Source/WebKit/mac/ChangeLog

    r90855 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebView/WebUIDelegatePrivate.h:
     9        * DefaultDelegates/WebDefaultUIDelegate.m:
     10        (-[WebDefaultUIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:spaceNeeded:]):
     11        Update the delegate to include a space needed parameter.
     12
     13        * WebCoreSupport/WebChromeClient.h:
     14        * WebCoreSupport/WebChromeClient.mm:
     15        (WebChromeClient::reachedApplicationCacheOriginQuota):
     16        Call the delegate with the new space needed information.
     17
    1182011-07-12  Adam Roben  <aroben@apple.com>
    219
  • trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m

    r64400 r90856  
    228228}
    229229
    230 - (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin
     230- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded
    231231{
    232232}
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r89216 r90856  
    117117#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    118118    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    119     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     119    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
    120120#endif
    121121    virtual void populateVisitedLinks();
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r89430 r90856  
    699699}
    700700
    701 void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin)
     701void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalSpaceNeeded)
    702702{
    703703    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    704704
    705705    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
    706     CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin);
     706    CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded:), webOrigin, static_cast<NSUInteger>(totalSpaceNeeded));
    707707    [webOrigin release];
    708708
  • trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h

    r86988 r90856  
    198198
    199199/*!
    200     @method webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:
     200    @method webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded:
    201201    @param sender The WebView sending the delegate method.
    202     @param origin The security origin that needs a larger quota
     202    @param origin The security origin that needs a larger quota.
     203    @param totalSpaceNeeded The amount of space needed to store the new manifest and keep all other
     204    previously stored caches for this origin.
    203205    @discussion This method is called when a page attempts to store more in the Application Cache
    204206    for an origin than was allowed by the quota (or default) set for the origin. This allows the
    205207    quota to be increased for the security origin.
    206208*/
    207 - (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin;
     209- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded;
    208210
    209211- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features;
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r90763 r90856  
    41844184*/
    41854185/*!
    4186     \fn void QWebPage::applicationCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 defaultOriginQuota);
     4186    \fn void QWebPage::applicationCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded);
    41874187
    41884188    This signal is emitted whenever the web site is asking to store data to the application cache
  • trunk/Source/WebKit/qt/Api/qwebpage.h

    r87983 r90856  
    395395    void contentsChanged();
    396396    void databaseQuotaExceeded(QWebFrame* frame, QString databaseName);
    397     void applicationCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 defaultOriginQuota);
     397    void applicationCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded);
    398398
    399399    void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item);
  • trunk/Source/WebKit/qt/ChangeLog

    r90763 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * Api/qwebpage.cpp:
     9        * Api/qwebpage.h:
     10        * WebCoreSupport/ChromeClientQt.cpp:
     11        (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota):
     12        * WebCoreSupport/ChromeClientQt.h:
     13        Pass the spaceNeeded value through to the applicationCacheQuotaExceeded signal.
     14
    1152011-07-11  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r89617 r90856  
    556556}
    557557
    558 void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin)
     558void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalSpaceNeeded)
    559559{
    560560    int64_t quota;
     
    567567       WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
    568568
    569     emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota);
     569    emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded));
    570570}
    571571#endif
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r89617 r90856  
    141141#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    142142    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    143     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
     143    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
    144144#endif
    145145#if ENABLE(CONTEXT_MENUS)
  • trunk/Source/WebKit/win/ChangeLog

    r90806 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/WebChromeClient.cpp:
     9        (WebChromeClient::reachedApplicationCacheOriginQuota):
     10        * WebCoreSupport/WebChromeClient.h:
     11
    1122011-07-11  Hironori Bono  <hbono@chromium.org>
    213
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r89430 r90856  
    629629}
    630630
    631 void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     631void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    632632{
    633633    notImplemented();
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h

    r89216 r90856  
    122122#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    123123    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    124     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     124    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
    125125#endif
    126126
  • trunk/Source/WebKit/wince/ChangeLog

    r90101 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/ChromeClientWinCE.cpp:
     9        (WebKit::ChromeClientWinCE::reachedApplicationCacheOriginQuota):
     10        * WebCoreSupport/ChromeClientWinCE.h:
     11
    1122011-06-30  Kentaro Hara  <haraken@google.com>
    213
  • trunk/Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.cpp

    r89216 r90856  
    317317}
    318318
    319 void ChromeClientWinCE::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     319void ChromeClientWinCE::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    320320{
    321321    notImplemented();
  • trunk/Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h

    r89216 r90856  
    132132    // to take action, such as prompting the user to ask to increase the quota
    133133    // for this origin.
    134     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     134    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
    135135#endif
    136136
  • trunk/Source/WebKit/wx/ChangeLog

    r90685 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebKitSupport/ChromeClientWx.cpp:
     9        (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota):
     10        * WebKitSupport/ChromeClientWx.h:
     11
    1122011-07-09  Robin Dunn  <robin@alldunn.com>
    213
  • trunk/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp

    r89284 r90856  
    446446}
    447447
    448 void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     448void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    449449{
    450450    notImplemented();
  • trunk/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h

    r89216 r90856  
    129129#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    130130    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    131     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
     131    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
    132132#endif
    133133
  • trunk/Source/WebKit2/ChangeLog

    r90851 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     9        (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
     10        * WebProcess/WebCoreSupport/WebChromeClient.h:
     11
    1122011-06-22  Jer Noble  <jer.noble@apple.com>
    213
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r90629 r90856  
    543543}
    544544
    545 void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
     545void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
    546546{
    547547    notImplemented();
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r89216 r90856  
    141141#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    142142    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    143     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
     143    virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t spaceNeeded);
    144144#endif
    145145
  • trunk/Tools/ChangeLog

    r90852 r90856  
     12011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        ApplicationCache update should not immediately fail when reaching per-origin quota
     4        https://bugs.webkit.org/show_bug.cgi?id=64177
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Add layoutTestController.disallowIncreaseForApplicationCacheQuota()
     9        to disable the default behavior of raising the default per-origin
     10        quota to 5MB when reached. This allows us to test what happens
     11        when the quota is reached and not increased.
     12
     13        * DumpRenderTree/LayoutTestController.cpp:
     14        (LayoutTestController::LayoutTestController):
     15        (disallowIncreaseForApplicationCacheQuotaCallback):
     16        (LayoutTestController::staticFunctions):
     17        * DumpRenderTree/LayoutTestController.h:
     18        (LayoutTestController::disallowIncreaseForApplicationCacheQuota):
     19        (LayoutTestController::setDisallowIncreaseForApplicationCacheQuota):
     20        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     21        (LayoutTestController::reset):
     22        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     23        (LayoutTestController::disallowIncreaseForApplicationCacheQuota):
     24        (LayoutTestController::dumpApplicationCacheDelegateCallbacks):
     25        Expose a function to prevent automatically increasing the per-origin
     26        quota when the quota is reached. This allows us to test what happens
     27        when a user would "disallow" a quota increase.
     28
     29        * DumpRenderTree/mac/UIDelegate.mm:
     30        (-[UIDelegate webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:spaceNeeded:]):
     31        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     32        (WebCore::DumpRenderTree::dumpApplicationCacheQuota):
     33        Respect the new disallowIncrease flag and dump the spaceNeeded values
     34        for ports that implement application cache quotas.
     35
    1362011-07-12  Ojan Vafai  <ojan@chromium.org>
    237
  • trunk/Tools/DumpRenderTree/LayoutTestController.cpp

    r89733 r90856  
    4444
    4545LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash)
    46     : m_dumpApplicationCacheDelegateCallbacks(false)
     46    : m_disallowIncreaseForApplicationCacheQuota(false)
     47    , m_dumpApplicationCacheDelegateCallbacks(false)
    4748    , m_dumpAsAudio(false)
    4849    , m_dumpAsPDF(false)
     
    99100// Static Functions
    100101
     102static JSValueRef disallowIncreaseForApplicationCacheQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     103{
     104    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     105    controller->setDisallowIncreaseForApplicationCacheQuota(true);
     106    return JSValueMakeUndefined(context);
     107}
     108
    101109static JSValueRef dumpApplicationCacheDelegateCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    102110{
     
    22642272        { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22652273        { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2274        { "disallowIncreaseForApplicationCacheQuota", disallowIncreaseForApplicationCacheQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22662275        { "dispatchPendingLoadRequests", dispatchPendingLoadRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22672276        { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/LayoutTestController.h

    r89733 r90856  
    156156    void setGeneratePixelResults(bool generatePixelResults) { m_generatePixelResults = generatePixelResults; }
    157157
     158    bool disallowIncreaseForApplicationCacheQuota() const { return m_disallowIncreaseForApplicationCacheQuota; }
     159    void setDisallowIncreaseForApplicationCacheQuota(bool disallowIncrease) { m_disallowIncreaseForApplicationCacheQuota = disallowIncrease; }
     160
    158161    bool dumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
    159162    void setDumpApplicationCacheDelegateCallbacks(bool dumpCallbacks) { m_dumpApplicationCacheDelegateCallbacks = dumpCallbacks; }
     
    352355    void setGeolocationPermissionCommon(bool allow);
    353356
     357    bool m_disallowIncreaseForApplicationCacheQuota;
    354358    bool m_dumpApplicationCacheDelegateCallbacks;
    355359    bool m_dumpAsAudio;
  • trunk/Tools/DumpRenderTree/mac/UIDelegate.mm

    r82084 r90856  
    167167}
    168168
    169 - (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin
     169- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded
    170170{
    171171    if (!done && gLayoutTestController->dumpApplicationCacheDelegateCallbacks()) {
    172         printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i}\n",
    173             [[origin protocol] UTF8String], [[origin host] UTF8String], [origin port]);
    174     }
     172        printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:%lu\n",
     173            [[origin protocol] UTF8String], [[origin host] UTF8String], [origin port], totalSpaceNeeded);
     174    }
     175
     176    if (gLayoutTestController->disallowIncreaseForApplicationCacheQuota())
     177        return;
    175178
    176179    static const unsigned long long defaultOriginQuota = [WebApplicationCache defaultOriginQuota];
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r90178 r90856  
    460460    connect(m_page, SIGNAL(databaseQuotaExceeded(QWebFrame*,QString)),
    461461            this, SLOT(dumpDatabaseQuota(QWebFrame*,QString)));
    462     connect(m_page, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin *, quint64)),
    463             this, SLOT(dumpApplicationCacheQuota(QWebSecurityOrigin *, quint64)));
     462    connect(m_page, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin *, quint64, quint64)),
     463            this, SLOT(dumpApplicationCacheQuota(QWebSecurityOrigin *, quint64, quint64)));
    464464    connect(m_page, SIGNAL(statusBarMessage(const QString&)),
    465465            this, SLOT(statusBarMessage(const QString&)));
     
    10401040}
    10411041
    1042 void DumpRenderTree::dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint64 defaultOriginQuota)
     1042void DumpRenderTree::dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded)
    10431043{
    10441044    if (!m_controller->shouldDumpApplicationCacheDelegateCallbacks())
    10451045        return;
    10461046
    1047     printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i}\n",
     1047    printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i}\n totalSpaceNeeded:%llu",
    10481048           origin->scheme().toUtf8().data(),
    10491049           origin->host().toUtf8().data(),
    1050            origin->port()
     1050           origin->port(),
     1051           totalSpaceNeeded
    10511052           );
     1053
     1054    if (m_controller->shouldDisallowIncreaseForApplicationCacheQuota())
     1055        return;
     1056
    10521057    origin->setApplicationCacheQuota(defaultOriginQuota);
    10531058}
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h

    r86505 r90856  
    120120    void connectFrame(QWebFrame *frame);
    121121    void dumpDatabaseQuota(QWebFrame* frame, const QString& dbName);
    122     void dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint64 defaultOriginQuota);
     122    void dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded);
    123123    void statusBarMessage(const QString& message);
    124124    void windowCloseRequested();
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r90341 r90856  
    5757    m_canOpenWindows = false;
    5858    m_waitForDone = false;
     59    m_disallowIncreaseForApplicationCacheQuota = false;
    5960    m_dumpTitleChanges = false;
    6061    m_dumpDatabaseCallbacks = false;
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r90341 r90856  
    6060    LayoutTestController(WebCore::DumpRenderTree* drt);
    6161
     62    bool shouldDisallowIncreaseForApplicationCacheQuota() const { return m_disallowIncreaseForApplicationCacheQuota; }
    6263    bool shouldDumpAsText() const { return m_textDump; }
    6364    bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; }
     
    9293public slots:
    9394    void maybeDump(bool ok);
     95    void disallowIncreaseForApplicationCacheQuota() { m_disallowIncreaseForApplicationCacheQuota = true; }
    9496    void dumpAsText() { m_textDump = true; }
    9597    void dumpChildFramesAsText() { m_dumpChildrenAsText = true; }
    9698    void dumpChildFrameScrollPositions() { m_dumpChildFrameScrollPositions = true; }
    9799    void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
    98     void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true;}
     100    void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
    99101    void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
    100102    void setCanOpenWindows() { m_canOpenWindows = true; }
     
    286288    bool m_hasDumped;
    287289    bool m_textDump;
     290    bool m_disallowIncreaseForApplicationCacheQuota;
    288291    bool m_dumpBackForwardList;
    289292    bool m_dumpChildrenAsText;
Note: See TracChangeset for help on using the changeset viewer.