WebView Database Quota Delegate Implementation

How to implement this method (see below)? I am new to Objective-C and I just don't get it.

From: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html

By default, databases have a quota of 0; this quota must be increased before any database is saved to disk.

WebKit clients must implement the WebUIDelegate method - webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: and increase the quota as necessary when calling this method. This method is defined in WebUIDelegatePrivate.h. This was added too late in the previous release cycle to turn it into a non-private header. It would be helpful to write down the error in moving this call to WebUIDelegate.h so that it is part of the official API.

John

+3
source share
4 answers

In any class that you define as a delegate for your WebView, you need to implement this method, something like this:

 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier { unsigned long long newQuotaBytes = 10 * 1024 * 1024; [origin setQuota:newQuotaBytes]; // origin also responds to -usage method to return current size for all databases in this origin } 
+3
source

Get some help on the bulletin board:

It seems that an implementation of this method is included in WebKit's WebKitTools in its open SVN. (The class is called UIDelegate). http://trac.webkit.org/browser/trunk/WebKitTools/DumpRenderTree/mac/U ...

I assume that you have created a delegate for your WebKit view. In this delegate class, create a method with a signature:

 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier; 

You can probably use a modified version of the UIDelegate implementation:

 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier { static const unsigned long long defaultQuota = 5 * 1024 * 1024; [origin setQuota:defaultQuota]; } 

I have not tried this, therefore YMMV.

John

+1
source

Here is the final answer.

I used the sample MiniBrowser application.

In MyDocument.m, I added this function:

 - (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(id)origin database:(NSString *)databaseIdentifier { static const unsigned long long defaultQuota = 5 * 1024 * 1024; if ([origin respondsToSelector: @selector(setQuota:)]) { [origin setQuota: defaultQuota]; } else { NSLog(@"could not increase quota for %@", defaultQuota); } } 
0
source

This worked for me: fooobar.com/questions/1700496 / ... is a small variation on Jeff Answer.

0
source

All Articles