Changeset 158447 in webkit


Ignore:
Timestamp:
Nov 1, 2013, 12:18:27 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

REGRESSION: Crashes in -[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:].
https://bugs.webkit.org/show_bug.cgi?id=123383.

Reviewed by Geoffrey Garen.

Tools:

Removed an inappropriate assertion in DumpRenderTree/mac/UIDelegate.mm and
added 2 attributes (databaseDefaultQuota and databaseMaxQuota) to allow
tests to set appropriate quota settings to exercise quota expansion tests
when needed.

  • DumpRenderTree/TestRunner.cpp:

(TestRunner::TestRunner):
(getDatabaseDefaultQuotaCallback):
(getDatabaseMaxQuotaCallback):
(setDatabaseDefaultQuotaCallback):
(setDatabaseMaxQuotaCallback):
(TestRunner::staticValues):

  • DumpRenderTree/TestRunner.h:

(TestRunner::databaseDefaultQuota):
(TestRunner::setDatabaseDefaultQuota):
(TestRunner::databaseMaxQuota):
(TestRunner::setDatabaseMaxQuota):

  • DumpRenderTree/blackberry/DumpRenderTree.cpp:

(BlackBerry::WebKit::DumpRenderTree::exceededDatabaseQuota):

  • DumpRenderTree/efl/DumpRenderTreeView.cpp:

(onExceededDatabaseQuota):

  • DumpRenderTree/mac/UIDelegate.mm:

(-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]):

  • DumpRenderTree/win/UIDelegate.cpp:

(UIDelegate::exceededDatabaseQuota):

  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::didExceedDatabaseQuota):

  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::TestRunner):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:

(WTR::TestRunner::databaseDefaultQuota):
(WTR::TestRunner::setDatabaseDefaultQuota):
(WTR::TestRunner::databaseMaxQuota):
(WTR::TestRunner::setDatabaseMaxQuota):

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):

LayoutTests:

Removed an inappropriate assertion in DumpRenderTree/mac/UIDelegate.mm and
added 2 attributes (databaseDefaultQuota and databaseMaxQuota) to allow
tests to set appropriate quota settings to exercise quota expansion tests
when needed.

  • storage/websql/open-database-expand-quota.html:
  • Set databaseDefaultQuota and databaseMaxQuota as needed for this test.
  • storage/websql/open-database-over-quota-expected.txt:
  • storage/websql/open-database-over-quota.html:
  • Revert the change from r157874 which is no longer needed for this test.
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r158441 r158447  
     12013-10-31  Mark Lam  <mark.lam@apple.com>
     2
     3        REGRESSION: Crashes in -[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:].
     4        https://bugs.webkit.org/show_bug.cgi?id=123383.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Removed an inappropriate assertion in DumpRenderTree/mac/UIDelegate.mm and
     9        added 2 attributes (databaseDefaultQuota and databaseMaxQuota) to allow
     10        tests to set appropriate quota settings to exercise quota expansion tests
     11        when needed.
     12       
     13        * storage/websql/open-database-expand-quota.html:
     14        - Set databaseDefaultQuota and databaseMaxQuota as needed for this test.
     15        * storage/websql/open-database-over-quota-expected.txt:
     16        * storage/websql/open-database-over-quota.html:
     17        - Revert the change from r157874 which is no longer needed for this test.
     18
    1192013-11-01  Bem Jones-Bey  <bjonesbe@adobe.com>
    220
  • trunk/LayoutTests/storage/websql/open-database-expand-quota.html

    r157874 r158447  
    66        testRunner.dumpAsText();
    77        testRunner.clearAllDatabases();
     8        testRunner.databaseDefaultQuota = 5 * 1024 * 1024;
     9        testRunner.databaseMaxQuota = 10 * 1024 * 1024;
    810    }
    911
  • trunk/LayoutTests/storage/websql/open-database-over-quota-expected.txt

    r157874 r158447  
    1 This tests that calling openDatabase with a size greater or equal to the test max quota limit of 10MB doesn't assert on debug builds.
     1This tests that calling openDatabase with a size greater or equal to the test max quota limit of 5MB doesn't assert on debug builds.
    22PASS
  • trunk/LayoutTests/storage/websql/open-database-over-quota.html

    r157874 r158447  
    99
    1010    try {
    11         var db = openDatabase('OverQuotaOpen', '', 'Test for bug 36473: missing lock in call to doneCreatingDatabase', 20000000);
     11        var db = openDatabase('OverQuotaOpen', '', 'Test for bug 36473: missing lock in call to doneCreatingDatabase', 10000000);
    1212    } catch (err) {
    1313        document.getElementById('result').innerHTML = 'PASS'
     
    1717</head>
    1818<body onload="runTest()">
    19 <div>This tests that calling openDatabase with a size greater or equal to the test max quota limit of 10MB
     19<div>This tests that calling openDatabase with a size greater or equal to the test max quota limit of 5MB
    2020doesn't assert on debug builds.
    2121<div id="result">
  • trunk/Tools/ChangeLog

    r158407 r158447  
     12013-10-31  Mark Lam  <mark.lam@apple.com>
     2
     3        REGRESSION: Crashes in -[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:].
     4        https://bugs.webkit.org/show_bug.cgi?id=123383.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Removed an inappropriate assertion in DumpRenderTree/mac/UIDelegate.mm and
     9        added 2 attributes (databaseDefaultQuota and databaseMaxQuota) to allow
     10        tests to set appropriate quota settings to exercise quota expansion tests
     11        when needed.
     12
     13        * DumpRenderTree/TestRunner.cpp:
     14        (TestRunner::TestRunner):
     15        (getDatabaseDefaultQuotaCallback):
     16        (getDatabaseMaxQuotaCallback):
     17        (setDatabaseDefaultQuotaCallback):
     18        (setDatabaseMaxQuotaCallback):
     19        (TestRunner::staticValues):
     20        * DumpRenderTree/TestRunner.h:
     21        (TestRunner::databaseDefaultQuota):
     22        (TestRunner::setDatabaseDefaultQuota):
     23        (TestRunner::databaseMaxQuota):
     24        (TestRunner::setDatabaseMaxQuota):
     25        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
     26        (BlackBerry::WebKit::DumpRenderTree::exceededDatabaseQuota):
     27        * DumpRenderTree/efl/DumpRenderTreeView.cpp:
     28        (onExceededDatabaseQuota):
     29        * DumpRenderTree/mac/UIDelegate.mm:
     30        (-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]):
     31        * DumpRenderTree/win/UIDelegate.cpp:
     32        (UIDelegate::exceededDatabaseQuota):
     33        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     34        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     35        (WTR::InjectedBundlePage::didExceedDatabaseQuota):
     36        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     37        (WTR::TestRunner::TestRunner):
     38        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     39        (WTR::TestRunner::databaseDefaultQuota):
     40        (WTR::TestRunner::setDatabaseDefaultQuota):
     41        (WTR::TestRunner::databaseMaxQuota):
     42        (WTR::TestRunner::setDatabaseMaxQuota):
     43        * WebKitTestRunner/TestController.cpp:
     44        (WTR::TestController::createOtherPage):
     45        (WTR::TestController::createWebViewWithOptions):
     46
    1472013-10-31  Anders Carlsson  <andersca@apple.com>
    248
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r157691 r158447  
    111111    , m_customFullScreenBehavior(false)
    112112    , m_hasPendingWebNotificationClick(false)
     113    , m_databaseDefaultQuota(-1)
     114    , m_databaseMaxQuota(-1)
    113115    , m_testPathOrURL(testPathOrURL)
    114116    , m_expectedPixelHash(expectedPixelHash)
     
    18401842}
    18411843
     1844static JSValueRef getDatabaseDefaultQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
     1845{
     1846    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1847    return JSValueMakeNumber(context, controller->databaseDefaultQuota());
     1848}
     1849
     1850static JSValueRef getDatabaseMaxQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
     1851{
     1852    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1853    return JSValueMakeNumber(context, controller->databaseMaxQuota());
     1854}
     1855
    18421856static JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
    18431857{
     
    18771891    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
    18781892    controller->setGlobalFlag(JSValueToBoolean(context, value));
     1893    return true;
     1894}
     1895
     1896static bool setDatabaseDefaultQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
     1897{
     1898    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1899    controller->setDatabaseDefaultQuota(JSValueToNumber(context, value, exception));
     1900    ASSERT(!*exception);
     1901    return true;
     1902}
     1903
     1904static bool setDatabaseMaxQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
     1905{
     1906    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1907    controller->setDatabaseMaxQuota(JSValueToNumber(context, value, exception));
     1908    ASSERT(!*exception);
    18791909    return true;
    18801910}
     
    20512081        { "secureEventInputIsEnabled", getSecureEventInputIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    20522082        { "titleTextDirection", getTitleTextDirectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2083        { "databaseDefaultQuota", getDatabaseDefaultQuotaCallback, setDatabaseDefaultQuotaCallback, kJSPropertyAttributeNone },
     2084        { "databaseMaxQuota", getDatabaseMaxQuotaCallback, setDatabaseMaxQuotaCallback, kJSPropertyAttributeNone },
    20532085        { 0, 0, 0, 0 }
    20542086    };
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r157691 r158447  
    278278    void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
    279279   
     280    double databaseDefaultQuota() const { return m_databaseDefaultQuota; }
     281    void setDatabaseDefaultQuota(double quota) { m_databaseDefaultQuota = quota; }
     282
     283    double databaseMaxQuota() const { return m_databaseMaxQuota; }
     284    void setDatabaseMaxQuota(double quota) { m_databaseMaxQuota = quota; }
     285
    280286    bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
    281287    void setDeferMainResourceDataLoad(bool flag) { m_deferMainResourceDataLoad = flag; }
     
    412418    bool m_hasPendingWebNotificationClick;
    413419
     420    double m_databaseDefaultQuota;
     421    double m_databaseMaxQuota;
     422
    414423    std::string m_authenticationUsername;
    415424    std::string m_authenticationPassword;
  • trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp

    r157874 r158447  
    786786    WebCore::DatabaseManager& manager = WebCore::DatabaseManager::manager();
    787787    WebCore::DatabaseDetails details = detailsForNameAndOrigin(name, origin);
    788     static const unsigned long long defaultQuota = 5 * 1024 * 1024;
    789     static const unsigned long long maxQuota = 10 * 1024 * 1024;
     788    unsigned long long defaultQuota = 5 * 1024 * 1024;
     789    double testDefaultQuota = gTestRunner->databaseDefaultQuota();
     790    if (testDefaultQuota >= 0)
     791        defaultQuota = testDefaultQuota;
     792
    790793    unsigned long long newQuota = defaultQuota;
    791     if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
    792         newQuota = expectedSize;
    793         printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     794
     795    double maxQuota = gTestRunner->databaseMaxQuota();
     796    if (maxQuota >= 0) {
     797        if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
     798            newQuota = expectedSize;
     799            printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     800        }
    794801    }
    795802    manager.setQuota(origin, newQuota);
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp

    r157922 r158447  
    135135    ewk_security_origin_free(origin);
    136136
    137     static const uint64_t defaultQuota = 5 * 1024 * 1024;
    138     static const uint64_t maxQuota = 10 * 1024 * 1024;
    139     if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
    140         printf("UI DELEGATE DATABASE CALLBACK: increased quota to %" PRIu64 "\n", expectedSize);
    141         return expectedSize;
    142     }
    143     return defaultQuota;
     137    uint64_t defaultQuota = 5 * 1024 * 1024;
     138    double testDefaultQuota = gTestRunner->databaseDefaultQuota();
     139    if (testDefaultQuota >= 0)
     140        defaultQuota = testDefaultQuota;
     141
     142    uint64_t newQuota = defaultQuota;
     143
     144    double maxQuota = gTestRunner->databaseMaxQuota();
     145    if (maxQuota >= 0) {
     146        if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
     147            newQuota = expectedSize;
     148            printf("UI DELEGATE DATABASE CALLBACK: increased quota to %" PRIu64 "\n", expectedSize);
     149        }
     150    }
     151    return newQuota;
    144152}
    145153
  • trunk/Tools/DumpRenderTree/mac/UIDelegate.mm

    r157874 r158447  
    176176
    177177    NSDictionary *databaseDetails = [[WebDatabaseManager sharedWebDatabaseManager] detailsForDatabase:databaseIdentifier withOrigin:origin];
    178     ASSERT(databaseDetails);
    179178    unsigned long long expectedSize = [[databaseDetails objectForKey:WebDatabaseExpectedSizeKey] unsignedLongLongValue];
    180     static const unsigned long long defaultQuota = 5 * 1024 * 1024;
    181     static const unsigned long long maxQuota = 10 * 1024 * 1024;
     179    unsigned long long defaultQuota = 5 * 1024 * 1024;
     180    double testDefaultQuota = gTestRunner->databaseDefaultQuota();
     181    if (testDefaultQuota >= 0)
     182        defaultQuota = testDefaultQuota;
     183
    182184    unsigned long long newQuota = defaultQuota;
    183     if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
    184         newQuota = expectedSize;
    185         printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     185
     186    double maxQuota = gTestRunner->databaseMaxQuota();
     187    if (maxQuota >= 0) {
     188        if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
     189            newQuota = expectedSize;
     190            printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     191        }
    186192    }
    187193    [[origin databaseQuotaManager] setQuota:newQuota];
  • trunk/Tools/DumpRenderTree/win/UIDelegate.cpp

    r157874 r158447  
    596596    SysFreeString(host);
    597597
    598     static const unsigned long long defaultQuota = 5 * 1024 * 1024;
    599     static const unsigned long long maxQuota = 10 * 1024 * 1024;
     598    unsigned long long defaultQuota = 5 * 1024 * 1024;
     599    double testDefaultQuota = gTestRunner->databaseDefaultQuota();
     600    if (testDefaultQuota >= 0)
     601        defaultQuota = testDefaultQuota;
    600602
    601603    COMPtr<IWebDatabaseManager> databaseManager;
     
    619621    unsigned long long expectedSize = V_UI8(&var);
    620622    unsigned long long newQuota = defaultQuota;
    621     if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
    622         newQuota = expectedSize;
    623         printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     623
     624    double maxQuota = gTestRunner->databaseMaxQuota();
     625    if (maxQuota >= 0) {
     626        if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
     627            newQuota = expectedSize;
     628            printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
     629        }
    624630    }
    625631    origin->setQuota(newQuota);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r153376 r158447  
    104104    DOMString pathToLocalResource(DOMString url);
    105105
     106    attribute double databaseDefaultQuota;
     107    attribute double databaseMaxQuota;
     108
    106109    // Application Cache API
    107110    void clearAllApplicationCaches();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r157874 r158447  
    14491449    }
    14501450
    1451     static const uint64_t defaultQuota = 5 * 1024 * 1024;
    1452     static const uint64_t maxQuota = 10 * 1024 * 1024;
    1453     uint64_t newQuota = defaultQuota;
    1454     if (defaultQuota < expectedUsageBytes && expectedUsageBytes <= maxQuota) {
    1455         newQuota = expectedUsageBytes;
    1456 
    1457         StringBuilder stringBuilder;
    1458         stringBuilder.appendLiteral("UI DELEGATE DATABASE CALLBACK: increased quota to ");
    1459         stringBuilder.appendNumber(newQuota);
    1460         stringBuilder.append('\n');
    1461         InjectedBundle::shared().outputText(stringBuilder.toString());
     1451    uint64_t defaultQuota = 5 * 1024 * 1024;
     1452    double testDefaultQuota = InjectedBundle::shared().testRunner()->databaseDefaultQuota();
     1453    if (testDefaultQuota >= 0)
     1454        defaultQuota = testDefaultQuota;
     1455
     1456    unsigned long long newQuota = defaultQuota;
     1457
     1458    double maxQuota = InjectedBundle::shared().testRunner()->databaseMaxQuota();
     1459    if (maxQuota >= 0) {
     1460        if (defaultQuota < expectedUsageBytes && expectedUsageBytes <= maxQuota) {
     1461            newQuota = expectedUsageBytes;
     1462
     1463            StringBuilder stringBuilder;
     1464            stringBuilder.appendLiteral("UI DELEGATE DATABASE CALLBACK: increased quota to ");
     1465            stringBuilder.appendNumber(newQuota);
     1466            stringBuilder.append('\n');
     1467            InjectedBundle::shared().outputText(stringBuilder.toString());
     1468        }
    14621469    }
    14631470    return newQuota;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r157691 r158447  
    9494    , m_globalFlag(false)
    9595    , m_customFullScreenBehavior(false)
     96    , m_databaseDefaultQuota(-1)
     97    , m_databaseMaxQuota(-1)
    9698    , m_userStyleSheetEnabled(false)
    9799    , m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString("")))
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r158266 r158447  
    221221    void setGlobalFlag(bool value) { m_globalFlag = value; }
    222222
     223    double databaseDefaultQuota() const { return m_databaseDefaultQuota; }
     224    void setDatabaseDefaultQuota(double quota) { m_databaseDefaultQuota = quota; }
     225
     226    double databaseMaxQuota() const { return m_databaseMaxQuota; }
     227    void setDatabaseMaxQuota(double quota) { m_databaseMaxQuota = quota; }
     228
    223229    void addChromeInputField(JSValueRef);
    224230    void removeChromeInputField(JSValueRef);
     
    322328    int m_timeout;
    323329
     330    double m_databaseDefaultQuota;
     331    double m_databaseMaxQuota;
     332
    324333    bool m_userStyleSheetEnabled;
    325334    WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r158326 r158447  
    143143    return TestController::shared().beforeUnloadReturnValue();
    144144}
    145 
    146 static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef, WKStringRef, unsigned long long, unsigned long long, unsigned long long, unsigned long long expectedUsage, const void*)
    147 {
    148     static const unsigned long long defaultQuota = 5 * 1024 * 1024;
    149     static const unsigned long long maxQuota = 10 * 1024 * 1024;
    150     unsigned long long newQuota = defaultQuota;
    151     if (defaultQuota < expectedUsage && expectedUsage <= maxQuota) {
    152         newQuota = expectedUsage;
    153         printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
    154     }
    155     return newQuota;
    156 }
    157 
    158145
    159146void TestController::runModal(WKPageRef page, const void* clientInfo)
     
    234221        0, // didDraw
    235222        0, // pageDidScroll
    236         exceededDatabaseQuota,
     223        0, // exceededDatabaseQuota
    237224        0, // runOpenPanel
    238225        decidePolicyForGeolocationPermissionRequest,
     
    435422        0, // didDraw
    436423        0, // pageDidScroll
    437         exceededDatabaseQuota,
     424        0, // exceededDatabaseQuota,
    438425        0, // runOpenPanel
    439426        decidePolicyForGeolocationPermissionRequest,
Note: See TracChangeset for help on using the changeset viewer.