[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
joepeck at webkit.org
joepeck at webkit.org
Wed Dec 22 11:37:08 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 4112f8b9c5b0491c1f0d252d803f7b2b407d8a79
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jul 31 02:22:05 2010 +0000
2010-07-30 Joseph Pecoraro <joepeck at webkit.org>
Reviewed by David Kilzer.
Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
https://bugs.webkit.org/show_bug.cgi?id=40627
Part 1 - Add Total and Per-Origin Quota Preferences.
Allow the application cache total size to be a preference, and
add a new preference for the default per-origin quota.
WebCore:
2010-07-30 Joseph Pecoraro <joepeck at webkit.org>
Allow the application cache total size to be a preference, and
add a new preference for the default per-origin quota.
Handle the per-origin quota in the global cacheStorage() object.
The per-origin quota will be used in a later part, this just
handles interaction with it from a client.
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::setDefaultOriginQuota): setter
(WebCore::ApplicationCacheStorage::ApplicationCacheStorage): default to "noQuota" on construction
* loader/appcache/ApplicationCacheStorage.h:
(WebCore::ApplicationCacheStorage::noQuota): constant to mean unlimited storage
(WebCore::ApplicationCacheStorage::defaultOriginQuota): accessor
Move around some exports around for Offline Web Applications.
* WebCore.exp.in: Added OFFLINE_WEB_APPLICATIONS exports.
WebKit/mac:
2010-07-30 Joseph Pecoraro <joepeck at webkit.org>
Storage quotas were int64_t (long long). Boilerplate for
these types added for consistency.
* Misc/WebNSDictionaryExtras.h:
* Misc/WebNSDictionaryExtras.m:
(-[NSMutableDictionary _webkit_setLongLong:forKey:]):
* WebCoreSupport/WebApplicationCache.h: setters and accessors for WebCore's cacheStorage.
* WebCoreSupport/WebApplicationCache.mm:
(+[WebApplicationCache maximumSize:]):
(+[WebApplicationCache setMaximumSize:]):
(+[WebApplicationCache defaultOriginQuota]):
(+[WebApplicationCache setDefaultOriginQuota:]):
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): defaults to noQuota for both preferences.
(-[WebPreferences _longLongValueForKey:]):
(-[WebPreferences _setLongLongValue:forKey:]):
(-[WebPreferences applicationCacheTotalQuota]):
(-[WebPreferences setApplicationCacheTotalQuota:]):
(-[WebPreferences applicationCacheDefaultOriginQuota]):
(-[WebPreferences setApplicationCacheDefaultOriginQuota:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]): respect updates to the preferences.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2ec88f2..5c0a0b7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-07-30 Joseph Pecoraro <joepeck at webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+ https://bugs.webkit.org/show_bug.cgi?id=40627
+
+ Part 1 - Add Total and Per-Origin Quota Preferences.
+
+ Allow the application cache total size to be a preference, and
+ add a new preference for the default per-origin quota.
+
+ Handle the per-origin quota in the global cacheStorage() object.
+ The per-origin quota will be used in a later part, this just
+ handles interaction with it from a client.
+
+ * loader/appcache/ApplicationCacheStorage.cpp:
+ (WebCore::ApplicationCacheStorage::setDefaultOriginQuota): setter
+ (WebCore::ApplicationCacheStorage::ApplicationCacheStorage): default to "noQuota" on construction
+ * loader/appcache/ApplicationCacheStorage.h:
+ (WebCore::ApplicationCacheStorage::noQuota): constant to mean unlimited storage
+ (WebCore::ApplicationCacheStorage::defaultOriginQuota): accessor
+
+ Move around some exports around for Offline Web Applications.
+
+ * WebCore.exp.in: Added OFFLINE_WEB_APPLICATIONS exports.
+
2010-07-30 Andy Estes <aestes at apple.com>
Reviewed by David Kilzer.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 4262d81..07824dc 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -459,11 +459,6 @@ __ZN7WebCore22contextMenuItemTagBoldEv
__ZN7WebCore22counterValueForElementEPNS_7ElementE
__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE
__ZN7WebCore22externalRepresentationEPNS_5FrameEj
-__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
-__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE
-__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
-__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv
-__ZN7WebCore23ApplicationCacheStorage5emptyEv
__ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
__ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
@@ -1468,3 +1463,13 @@ __ZN7WebCore16HTMLMediaElement19setMediaPlayerProxyEP19WebMediaPlayerProxy
__ZN7WebCore9HTMLNames8audioTagE
__ZN7WebCore9HTMLNames8videoTagE
#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
+__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE
+__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
+__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv
+__ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx
+__ZN7WebCore23ApplicationCacheStorage5emptyEv
+__ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv
+#endif
diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp
index 9a11307..5557d40 100644
--- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp
@@ -414,6 +414,11 @@ int64_t ApplicationCacheStorage::spaceNeeded(int64_t cacheToSave)
return spaceNeeded;
}
+void ApplicationCacheStorage::setDefaultOriginQuota(int64_t quota)
+{
+ m_defaultOriginQuota = quota;
+}
+
bool ApplicationCacheStorage::executeSQLCommand(const String& sql)
{
ASSERT(m_database.isOpen());
@@ -1120,8 +1125,9 @@ void ApplicationCacheStorage::checkForMaxSizeReached()
}
ApplicationCacheStorage::ApplicationCacheStorage()
- : m_maximumSize(INT_MAX)
+ : m_maximumSize(ApplicationCacheStorage::noQuota())
, m_isMaximumSizeReached(false)
+ , m_defaultOriginQuota(ApplicationCacheStorage::noQuota())
{
}
diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.h b/WebCore/loader/appcache/ApplicationCacheStorage.h
index aaa5c9c..342f6a9 100644
--- a/WebCore/loader/appcache/ApplicationCacheStorage.h
+++ b/WebCore/loader/appcache/ApplicationCacheStorage.h
@@ -54,6 +54,9 @@ public:
bool isMaximumSizeReached() const;
int64_t spaceNeeded(int64_t cacheToSave);
+ int64_t defaultOriginQuota() const { return m_defaultOriginQuota; }
+ void setDefaultOriginQuota(int64_t quota);
+
ApplicationCacheGroup* cacheGroupForURL(const KURL&); // Cache to load a main resource from.
ApplicationCacheGroup* fallbackCacheGroupForURL(const KURL&); // Cache that has a fallback entry to load a main resource from if normal loading fails.
@@ -76,6 +79,8 @@ public:
bool cacheGroupSize(const String& manifestURL, int64_t* size);
bool deleteCacheGroup(const String& manifestURL);
void vacuumDatabaseFile();
+
+ static int64_t noQuota() { return std::numeric_limits<int64_t>::max(); }
private:
ApplicationCacheStorage();
PassRefPtr<ApplicationCache> loadCache(unsigned storageID);
@@ -105,6 +110,8 @@ private:
int64_t m_maximumSize;
bool m_isMaximumSizeReached;
+ int64_t m_defaultOriginQuota;
+
SQLiteDatabase m_database;
// In order to quickly determine if a given resource exists in an application cache,
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index e18db17..13ec1a1 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,40 @@
+2010-07-30 Joseph Pecoraro <joepeck at webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+ https://bugs.webkit.org/show_bug.cgi?id=40627
+
+ Part 1 - Add Total and Per-Origin Quota Preferences.
+
+ Allow the application cache total size to be a preference, and
+ add a new preference for the default per-origin quota.
+
+ Storage quotas were int64_t (long long). Boilerplate for
+ these types added for consistency.
+
+ * Misc/WebNSDictionaryExtras.h:
+ * Misc/WebNSDictionaryExtras.m:
+ (-[NSMutableDictionary _webkit_setLongLong:forKey:]):
+ * WebCoreSupport/WebApplicationCache.h: setters and accessors for WebCore's cacheStorage.
+ * WebCoreSupport/WebApplicationCache.mm:
+ (+[WebApplicationCache maximumSize:]):
+ (+[WebApplicationCache setMaximumSize:]):
+ (+[WebApplicationCache defaultOriginQuota]):
+ (+[WebApplicationCache setDefaultOriginQuota:]):
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]): defaults to noQuota for both preferences.
+ (-[WebPreferences _longLongValueForKey:]):
+ (-[WebPreferences _setLongLongValue:forKey:]):
+ (-[WebPreferences applicationCacheTotalQuota]):
+ (-[WebPreferences setApplicationCacheTotalQuota:]):
+ (-[WebPreferences applicationCacheDefaultOriginQuota]):
+ (-[WebPreferences setApplicationCacheDefaultOriginQuota:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]): respect updates to the preferences.
+
2010-07-30 Andy Estes <aestes at apple.com>
Reviewed by David Kilzer.
diff --git a/WebKit/mac/Misc/WebNSDictionaryExtras.h b/WebKit/mac/Misc/WebNSDictionaryExtras.h
index 95445f8..0bbc5d5 100644
--- a/WebKit/mac/Misc/WebNSDictionaryExtras.h
+++ b/WebKit/mac/Misc/WebNSDictionaryExtras.h
@@ -43,5 +43,6 @@
- (void)_webkit_setInt:(int)value forKey:(id)key;
- (void)_webkit_setFloat:(float)value forKey:(id)key;
- (void)_webkit_setBool:(BOOL)value forKey:(id)key;
+- (void)_webkit_setLongLong:(long long)value forKey:(id)key;
- (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key;
@end
diff --git a/WebKit/mac/Misc/WebNSDictionaryExtras.m b/WebKit/mac/Misc/WebNSDictionaryExtras.m
index a47fd0b..366f361 100644
--- a/WebKit/mac/Misc/WebNSDictionaryExtras.m
+++ b/WebKit/mac/Misc/WebNSDictionaryExtras.m
@@ -108,6 +108,13 @@
[object release];
}
+- (void)_webkit_setLongLong:(long long)value forKey:(id)key
+{
+ NSNumber *object = [[NSNumber alloc] initWithLongLong:value];
+ [self setObject:object forKey:key];
+ [object release];
+}
+
- (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key
{
NSNumber *object = [[NSNumber alloc] initWithUnsignedLongLong:value];
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/WebKit/mac/WebCoreSupport/WebApplicationCache.h
index 282157f..e0fb523 100644
--- a/WebKit/mac/WebCoreSupport/WebApplicationCache.h
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.h
@@ -28,5 +28,10 @@
@interface WebApplicationCache: NSObject {
}
-+ (void)setMaximumSize:(unsigned long long)size;
++ (long long)maximumSize;
++ (void)setMaximumSize:(long long)size;
+
++ (long long)defaultOriginQuota;
++ (void)setDefaultOriginQuota:(long long)size;
+
@end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
index 4ca749c..5c2a208 100644
--- a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
@@ -32,13 +32,28 @@ using namespace WebCore;
@implementation WebApplicationCache
-+ (void)setMaximumSize:(unsigned long long)size
++ (long long)maximumSize
+{
+ return cacheStorage().maximumSize();
+}
+
++ (void)setMaximumSize:(long long)size
{
cacheStorage().empty();
cacheStorage().vacuumDatabaseFile();
cacheStorage().setMaximumSize(size);
}
++ (long long)defaultOriginQuota
+{
+ return cacheStorage().defaultOriginQuota();
+}
+
++ (void)setDefaultOriginQuota:(long long)size
+{
+ cacheStorage().setDefaultOriginQuota(size);
+}
+
@end
#endif
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 4175a5d..a8ebdca 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -83,6 +83,8 @@
#define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey"
#define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown"
#define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled"
+#define WebKitApplicationCacheTotalQuota @"WebKitApplicationCacheTotalQuota"
+#define WebKitApplicationCacheDefaultOriginQuota @"WebKitApplicationCacheDefaultOriginQuota"
#define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly"
#define WebKitJavaScriptCanAccessClipboardPreferenceKey @"WebKitJavaScriptCanAccessClipboard"
#define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled"
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 63915dc..7ec2439 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -30,6 +30,7 @@
#import "WebPreferencesPrivate.h"
#import "WebPreferenceKeysPrivate.h"
+#import "WebApplicationCache.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
#import "WebKitSystemBits.h"
@@ -37,6 +38,7 @@
#import "WebKitVersionChecks.h"
#import "WebNSDictionaryExtras.h"
#import "WebNSURLExtras.h"
+#import <WebCore/ApplicationCacheStorage.h>
NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
@@ -170,6 +172,8 @@ static WebCacheModel cacheModelForMainBundle(void)
- (void)_setIntegerValue:(int)value forKey:(NSString *)key;
- (float)_floatValueForKey:(NSString *)key;
- (void)_setFloatValue:(float)value forKey:(NSString *)key;
+- (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
+- (long long)_longLongValueForKey:(NSString *)key;
- (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
@end
@@ -364,6 +368,8 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:NO], WebKitHTML5TreeBuilderEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey,
+ [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
+ [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
@@ -461,6 +467,23 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _postPreferencesChangesNotification];
}
+- (long long)_longLongValueForKey:(NSString *)key
+{
+ id o = [self _valueForKey:key];
+ return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
+}
+
+- (void)_setLongLongValue:(long long)value forKey:(NSString *)key
+{
+ if ([self _longLongValueForKey:key] == value)
+ return;
+ NSString *_key = KEY(key);
+ [_private->values _webkit_setLongLong:value forKey:_key];
+ if (_private->autosaves)
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
+ [self _postPreferencesChangesNotification];
+}
+
- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
{
id o = [self _valueForKey:key];
@@ -973,6 +996,31 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
}
+- (int64_t)applicationCacheTotalQuota
+{
+ ASSERT([self _longLongValueForKey:WebKitApplicationCacheTotalQuota] == [WebApplicationCache maximumSize]);
+ return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
+}
+
+- (void)setApplicationCacheTotalQuota:(int64_t)quota
+{
+ [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
+
+ // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
+ [WebApplicationCache setMaximumSize:quota];
+}
+
+- (int64_t)applicationCacheDefaultOriginQuota
+{
+ ASSERT([self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota] == [WebApplicationCache defaultOriginQuota]);
+ return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
+}
+
+- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
+{
+ [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
+}
+
- (PDFDisplayMode)PDFDisplayMode
{
PDFDisplayMode value = [self _integerValueForKey:WebKitPDFDisplayModePreferenceKey];
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 073b364..01f2aa8 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -134,6 +134,12 @@ extern NSString *WebPreferencesRemovedNotification;
- (float)PDFScaleFactor;
- (void)setPDFScaleFactor:(float)scale;
+- (int64_t)applicationCacheTotalQuota;
+- (void)setApplicationCacheTotalQuota:(int64_t)quota;
+
+- (int64_t)applicationCacheDefaultOriginQuota;
+- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota;
+
- (WebKitEditableLinkBehavior)editableLinkBehavior;
- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 3d878bc..aefd56b 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -34,6 +34,7 @@
#import "DOMCSSStyleDeclarationInternal.h"
#import "DOMNodeInternal.h"
#import "DOMRangeInternal.h"
+#import "WebApplicationCache.h"
#import "WebBackForwardListInternal.h"
#import "WebBaseNetscapePluginView.h"
#import "WebCache.h"
@@ -1440,6 +1441,9 @@ static bool fastDocumentTeardownEnabled()
settings->setHTML5TreeBuilderEnabled_DO_NOT_USE([preferences html5TreeBuilderEnabled]);
settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]);
settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]);
+
+ // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
+ [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]];
}
static inline IMP getMethod(id o, SEL s)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list