Changeset 157874 in webkit
- Timestamp:
- Oct 23, 2013 11:33:20 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r157860 r157874 1 2013-10-23 Mark Lam <mark.lam@apple.com> 2 3 Re-instate ProposedDatabases needed by detailsForNameAndOrigin(). 4 https://bugs.webkit.org/show_bug.cgi?id=123131. 5 6 Reviewed by Geoffrey Garen. 7 8 Added a test to exercise growing the database quota within limit. 9 10 * platform/gtk/TestExpectations: 11 * storage/websql/open-database-expand-quota-expected.txt: Added. 12 * storage/websql/open-database-expand-quota.html: Added. 13 * storage/websql/open-database-over-quota-expected.txt: 14 * storage/websql/open-database-over-quota.html: 15 1 16 2013-10-23 Mihai Maerean <mmaerean@adobe.com> 2 17 -
trunk/LayoutTests/platform/gtk/TestExpectations
r157857 r157874 447 447 webkit.org/b/107194 http/tests/security/cross-origin-worker-indexeddb.html [ Skip ] 448 448 webkit.org/b/107194 http/tests/security/no-indexeddb-from-sandbox.html [ Skip ] 449 450 # Needs to update the gtk databaseQuotaExceeded() test function to handle quota expansion requests. 451 storage/websql/open-database-expand-quota.html [ Failure ] 449 452 450 453 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/storage/websql/open-database-over-quota-expected.txt
r117816 r157874 1 This tests that calling openDatabase with a size over 5MB doesn't assert on debug builds.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. 2 2 PASS -
trunk/LayoutTests/storage/websql/open-database-over-quota.html
r120516 r157874 9 9 10 10 try { 11 var db = openDatabase('OverQuotaOpen', '', 'Test for bug 36473: missing lock in call to doneCreatingDatabase', 10000000);11 var db = openDatabase('OverQuotaOpen', '', 'Test for bug 36473: missing lock in call to doneCreatingDatabase', 20000000); 12 12 } catch (err) { 13 13 document.getElementById('result').innerHTML = 'PASS' … … 17 17 </head> 18 18 <body onload="runTest()"> 19 <div>This tests that calling openDatabase with a size over 5MB doesn't assert on debug builds. 19 <div>This tests that calling openDatabase with a size greater or equal to the test max quota limit of 10MB 20 doesn't assert on debug builds. 20 21 <div id="result"> 21 22 FAIL: We shouldn't have been able to open the database. -
trunk/Source/WebCore/ChangeLog
r157870 r157874 1 2013-10-23 Mark Lam <mark.lam@apple.com> 2 3 Re-instate ProposedDatabases needed by detailsForNameAndOrigin(). 4 https://bugs.webkit.org/show_bug.cgi?id=123131. 5 6 Reviewed by Geoffrey Garen. 7 8 Test: storage/websql/open-database-expand-quota.html 9 10 If a webpage tries to create a database that exceeds the database size 11 quota for that security origin, the WebKit1 quota request mechanism 12 uses detailsForNameAndOrigin() to get the requested size of the database 13 (that the webpage is attempting to open) in order to determine whether 14 to increase the quota or not. 15 16 Previously, detailsForNameAndOrigin() relies on the ProposedDatabase 17 mechanism to provide this size information. This change re-instates the 18 ProposedDatabase mechanism so that WebKit1 client code that relies on 19 this behavior will continue to work. 20 21 * Modules/webdatabase/DatabaseManager.cpp: 22 (WebCore::DatabaseManager::ProposedDatabase::ProposedDatabase): 23 (WebCore::DatabaseManager::ProposedDatabase::~ProposedDatabase): 24 (WebCore::DatabaseManager::DatabaseManager): 25 (WebCore::DatabaseManager::openDatabaseBackend): 26 (WebCore::DatabaseManager::fullPathForDatabase): 27 (WebCore::DatabaseManager::detailsForNameAndOrigin): 28 * Modules/webdatabase/DatabaseManager.h: 29 (WebCore::DatabaseManager::ProposedDatabase::origin): 30 (WebCore::DatabaseManager::ProposedDatabase::details): 31 1 32 2013-10-23 Tim Horton <timothy_horton@apple.com> 2 33 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
r157653 r157874 50 50 namespace WebCore { 51 51 52 DatabaseManager::ProposedDatabase::ProposedDatabase(DatabaseManager& manager, 53 SecurityOrigin* origin, const String& name, const String& displayName, unsigned long estimatedSize) 54 : m_manager(manager) 55 , m_origin(origin->isolatedCopy()) 56 , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0) 57 { 58 ASSERT(!m_manager.m_proposedDatabase); 59 m_manager.m_proposedDatabase = this; 60 } 61 62 DatabaseManager::ProposedDatabase::~ProposedDatabase() 63 { 64 m_manager.m_proposedDatabase = 0; 65 } 66 52 67 DatabaseManager& DatabaseManager::manager() 53 68 { … … 69 84 , m_databaseContextInstanceCount(0) 70 85 #endif 86 , m_proposedDatabase(0) 71 87 { 72 88 ASSERT(m_server); // We should always have a server to work with. … … 249 265 // The client may want to increase the quota, and we'll give it 250 266 // one more try after if that is the case. 251 databaseContext->databaseExceededQuota(name, 252 DatabaseDetails(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0)); 253 267 { 268 ProposedDatabase proposedDb(*this, context->securityOrigin(), name, displayName, estimatedSize); 269 databaseContext->databaseExceededQuota(name, 270 DatabaseDetails(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0)); 271 } 254 272 error = DatabaseError::None; 255 273 … … 352 370 String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfDoesNotExist) 353 371 { 372 ProposedDatabase* db = m_proposedDatabase; 373 if (db && db->details().name() == name && db->origin()->equal(origin)) 374 return String(); 354 375 return m_server->fullPathForDatabase(origin, name, createIfDoesNotExist); 355 376 } … … 372 393 DatabaseDetails DatabaseManager::detailsForNameAndOrigin(const String& name, SecurityOrigin* origin) 373 394 { 395 ProposedDatabase* db = m_proposedDatabase; 396 if (db && db->details().name() == name && db->origin()->equal(origin)) { 397 ASSERT(db->details().thread() == currentThread()); 398 return db->details(); 399 } 374 400 return m_server->detailsForNameAndOrigin(name, origin); 375 401 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h
r157653 r157874 107 107 108 108 private: 109 class ProposedDatabase { 110 public: 111 ProposedDatabase(DatabaseManager&, SecurityOrigin*, 112 const String& name, const String& displayName, unsigned long estimatedSize); 113 ~ProposedDatabase(); 114 115 SecurityOrigin* origin() { return m_origin.get(); } 116 DatabaseDetails& details() { return m_details; } 117 118 private: 119 DatabaseManager& m_manager; 120 RefPtr<SecurityOrigin> m_origin; 121 DatabaseDetails m_details; 122 }; 123 109 124 DatabaseManager(); 110 125 ~DatabaseManager() { } … … 132 147 #endif 133 148 Mutex m_contextMapLock; 149 150 ProposedDatabase* m_proposedDatabase; 134 151 }; 135 152 -
trunk/Tools/ChangeLog
r157873 r157874 1 2013-10-23 Mark Lam <mark.lam@apple.com> 2 3 Re-instate ProposedDatabases needed by detailsForNameAndOrigin(). 4 https://bugs.webkit.org/show_bug.cgi?id=123131. 5 6 Reviewed by Geoffrey Garen. 7 8 Updated these files to allow database quotas to grow within a limit for 9 testing purposes. 10 11 * DumpRenderTree/blackberry/DumpRenderTree.cpp: 12 (BlackBerry::WebKit::DumpRenderTree::exceededDatabaseQuota): 13 * DumpRenderTree/efl/DumpRenderTreeView.cpp: 14 (onExceededDatabaseQuota): 15 * DumpRenderTree/mac/UIDelegate.mm: 16 (-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]): 17 * DumpRenderTree/win/UIDelegate.cpp: 18 (UIDelegate::exceededDatabaseQuota): 19 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 20 (WTR::InjectedBundlePage::didExceedDatabaseQuota): 21 * WebKitTestRunner/TestController.cpp: 22 (WTR::exceededDatabaseQuota): 23 1 24 2013-10-23 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
r155452 r157874 25 25 #include "BackForwardListBlackBerry.h" 26 26 #include "Credential.h" 27 #include "Database Tracker.h"27 #include "DatabaseManager.h" 28 28 #include "DocumentLoader.h" 29 29 #include "DumpRenderTree/GCController.h" … … 784 784 printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", origin->protocol().utf8().data(), origin->host().utf8().data(), origin->port(), name.utf8().data()); 785 785 786 WebCore::DatabaseTracker::tracker().setQuota(mainFrame->document()->securityOrigin(), 5 * 1024 * 1024); 786 WebCore::DatabaseManager& manager = WebCore::DatabaseManager::manager(); 787 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; 790 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 manager.setQuota(origin, newQuota); 787 796 } 788 797 -
trunk/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp
r155308 r157874 135 135 ewk_security_origin_free(origin); 136 136 137 return 5 * 1024 * 1024; 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 %llu\n", expectedSize); 141 return expectedSize; 142 } 143 return defaultQuota; 138 144 } 139 145 -
trunk/Tools/DumpRenderTree/mac/UIDelegate.mm
r156522 r157874 35 35 #import "MockWebNotificationProvider.h" 36 36 #import "TestRunner.h" 37 37 38 #import <WebKit/WebApplicationCache.h> 38 39 #import <WebKit/WebFramePrivate.h> 39 40 #import <WebKit/WebHTMLViewPrivate.h> 41 #import <WebKit/WebDatabaseManagerPrivate.h> 40 42 #import <WebKit/WebQuotaManager.h> 41 43 #import <WebKit/WebSecurityOriginPrivate.h> … … 173 175 } 174 176 175 static const unsigned long long defaultQuota = 5 * 1024 * 1024; 176 [[origin databaseQuotaManager] setQuota:defaultQuota]; 177 NSDictionary *databaseDetails = [[WebDatabaseManager sharedWebDatabaseManager] detailsForDatabase:databaseIdentifier withOrigin:origin]; 178 ASSERT(databaseDetails); 179 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; 182 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); 186 } 187 [[origin databaseQuotaManager] setQuota:newQuota]; 177 188 } 178 189 -
trunk/Tools/DumpRenderTree/win/UIDelegate.cpp
r157387 r157874 42 42 #include <JavaScriptCore/JavaScriptCore.h> 43 43 #include <WebKit/WebKit.h> 44 #include <WebKit/WebKitCOMAPI.h> 44 45 #include <stdio.h> 45 46 … … 596 597 597 598 static const unsigned long long defaultQuota = 5 * 1024 * 1024; 598 origin->setQuota(defaultQuota); 599 static const unsigned long long maxQuota = 10 * 1024 * 1024; 600 601 COMPtr<IWebDatabaseManager> databaseManager; 602 COMPtr<IWebDatabaseManager> tmpDatabaseManager; 603 604 if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) { 605 origin->setQuota(defaultQuota); 606 return S_OK; 607 } 608 if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) { 609 origin->setQuota(defaultQuota); 610 return S_OK; 611 } 612 IPropertyBag* detailsBag; 613 if (FAILED(databaseManager->detailsForDatabase(databaseIdentifier, origin, &detailsBag))) { 614 origin->setQuota(defaultQuota); 615 return S_OK; 616 } 617 VARIANT var; 618 detailsBag->Read(WebDatabaseUsageKey, &var, 0); 619 unsigned long long expectedSize = V_UI8(&var); 620 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); 624 } 625 origin->setQuota(newQuota); 599 626 600 627 return S_OK; -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r156797 r157874 1450 1450 1451 1451 static const uint64_t defaultQuota = 5 * 1024 * 1024; 1452 return defaultQuota; 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()); 1462 } 1463 return newQuota; 1453 1464 } 1454 1465 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r157323 r157874 144 144 } 145 145 146 static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef, WKStringRef, unsigned long long, unsigned long long, unsigned long long, unsigned long long , const void*)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 147 { 148 148 static const unsigned long long defaultQuota = 5 * 1024 * 1024; 149 return defaultQuota; 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; 150 156 } 151 157
Note: See TracChangeset
for help on using the changeset viewer.