diff options
Diffstat (limited to 'UICaboodle/BrowserView.m')
-rw-r--r-- | UICaboodle/BrowserView.m | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/UICaboodle/BrowserView.m b/UICaboodle/BrowserView.m index 0816523..8c48425 100644 --- a/UICaboodle/BrowserView.m +++ b/UICaboodle/BrowserView.m @@ -303,7 +303,19 @@ [book_ pushPage:page]; } +- (void) _pushPage { + if (pushed_) + return; + [self autorelease]; + pushed_ = true; + [book_ pushPage:self]; +} + - (BOOL) getSpecial:(NSURL *)url { +#if ForSaurik + NSLog(@"getSpecial:%@", url); +#endif + NSString *href([url absoluteString]); NSString *scheme([[url scheme] lowercaseString]); @@ -471,6 +483,8 @@ } [listener use]; + /* XXX: maybe only the main frame? */ + [self _pushPage]; return; } #if ForSaurik @@ -526,13 +540,6 @@ //lprintf("Status:%s\n", [text UTF8String]); } -- (void) _pushPage { - if (pushed_) - return; - pushed_ = true; - [book_ pushPage:self]; -} - - (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button { NSString *context([sheet context]); @@ -636,10 +643,6 @@ } - (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)source { - NSURL *url = [request URL]; - if ([self getSpecial:url]) - return nil; - [self _pushPage]; return [self _addHeadersToRequest:request]; } @@ -649,8 +652,16 @@ #endif BrowserView *browser = [[[BrowserView alloc] initWithBook:book_] autorelease]; - [self pushPage:browser]; - [browser loadRequest:request]; + + if (request == nil) { + [self setBackButtonTitle:title_]; + [browser setDelegate:delegate_]; + [browser retain]; + } else { + [self pushPage:browser]; + [browser loadRequest:request]; + } + return [browser webView]; } |