From: Jay Freeman (saurik) Date: Fri, 23 Jan 2009 12:15:00 +0000 (+0000) Subject: Fixing more bugs in window opening. X-Git-Tag: v1.0.3366~313 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/bf26e5f3b9ed53ac0b29bca2302ca586b6154c15 Fixing more bugs in window opening. --- diff --git a/UICaboodle/BrowserView.m b/UICaboodle/BrowserView.m index 08165235..8c484253 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]; }