diff options
author | Andrei Popescu <andreip@google.com> | 2009-07-21 13:10:06 +0100 |
---|---|---|
committer | Andrei Popescu <andreip@google.com> | 2009-07-21 13:31:30 +0100 |
commit | c60802dd50f86c37e0596d41c3ef6fc2c8804da4 (patch) | |
tree | ef54137cbf064976e5f146c125691c40fb1136d3 /WebKitTools | |
parent | ce39e03a248f9bee3e746c15e7961b3e40a871ed (diff) | |
download | external_webkit-c60802dd50f86c37e0596d41c3ef6fc2c8804da4.zip external_webkit-c60802dd50f86c37e0596d41c3ef6fc2c8804da4.tar.gz external_webkit-c60802dd50f86c37e0596d41c3ef6fc2c8804da4.tar.bz2 |
Implements a mechanism that limit the growth of the application cache
Diffstat (limited to 'WebKitTools')
5 files changed, 34 insertions, 0 deletions
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index a78d115..2a06c4f 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -460,6 +460,22 @@ static JSValueRef setAcceptsEditingCallback(JSContextRef context, JSObjectRef fu return JSValueMakeUndefined(context); } +static JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + // Has mac implementation + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + + double size = JSValueToNumber(context, arguments[0], NULL); + if (!isnan(size)) + controller->setAppCacheMaximumSize(static_cast<unsigned long long>(size)); + + return JSValueMakeUndefined(context); + +} + static JSValueRef setAuthorAndUserStylesEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -840,6 +856,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 2de7f72..0f41923 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -58,6 +58,7 @@ public: void queueReload(); void queueScript(JSStringRef url); void setAcceptsEditing(bool acceptsEditing); + void setAppCacheMaximumSize(unsigned long long quota); void setAuthorAndUserStylesEnabled(bool); void setCustomPolicyDelegate(bool setDelegate, bool permissive); void setDatabaseQuota(unsigned long long quota); diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index ca3bc36..5c2bae7 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -303,6 +303,11 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota) // FIXME: implement } +void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) +{ + // FIXME: implement +} + bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) { gchar* name = JSStringCopyUTF8CString(animationName); diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index c80c78f..3aa1f2c 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -39,6 +39,7 @@ #import <JavaScriptCore/JSStringRefCF.h> #import <WebKit/DOMDocument.h> #import <WebKit/DOMElement.h> +#import <WebKit/WebApplicationCache.h> #import <WebKit/WebBackForwardList.h> #import <WebKit/WebDatabaseManagerPrivate.h> #import <WebKit/WebDataSource.h> @@ -210,6 +211,11 @@ void LayoutTestController::setAcceptsEditing(bool newAcceptsEditing) [(EditingDelegate *)[[mainFrame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing]; } +void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) +{ + [WebApplicationCache setMaximumSize:size]; +} + void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) { [[[mainFrame webView] preferences] setAuthorAndUserStylesEnabled:flag]; diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index ec5139b..56d0a80 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -681,6 +681,11 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota) printf("ERROR: LayoutTestController::setDatabaseQuota() not implemented\n"); } +void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) +{ + printf("ERROR: LayoutTestController::setAppCacheMaximumSize() not implemented\n"); +} + bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) { COMPtr<IDOMDocument> document; |