Support for localstorage in NativeHost

This commit is contained in:
Antoine Mercadal
2010-09-27 16:27:04 -04:00
committed by Randall Luecke
parent 65c48004ba
commit e55cbbdc0e
2 changed files with 17 additions and 1 deletions
+1
View File
@@ -31,6 +31,7 @@ extern NSString *SERVER_USER;
NSURL * baseURL;
}
- (void)configureLocalStorage;
- (NSURL *)baseURL;
- (void)startServer;
+16 -1
View File
@@ -176,6 +176,19 @@ NSString *SERVER_USER = nil;
[server stop];
}
- (void)configureLocalStorage
{
WebPreferences *webConfiguration = [WebPreferences standardPreferences];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *saveFolder = [mainBundle objectForInfoDictionaryKey:@"CPBundleName"];
NSString *applicationSupportFile = [@"~/Library/Application Support/" stringByExpandingTildeInPath];
NSString *savePath = [NSString pathWithComponents:[NSArray arrayWithObjects:applicationSupportFile, saveFolder, nil]];
NSLog(savePath);
[webConfiguration _setLocalStorageDatabasePath:savePath];
[webView setPreferences:webConfiguration];
}
- (void)awakeFromNib
{
webView = [[WebView alloc] init];
@@ -184,7 +197,9 @@ NSString *SERVER_USER = nil;
[webView setFrameLoadDelegate:self];
[webView setResourceLoadDelegate:self];
[webView setPolicyDelegate:self];
[self configureLocalStorage];
webViewWindow = [[NSWindow alloc] init];
[webViewWindow setContentView:webView];