summaryrefslogtreecommitdiff
path: root/CyteKit
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-26 07:37:25 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-26 07:40:42 -0700
commit77d4e15b55ce321bc3aff3641889f4cf5043c367 (patch)
tree6dd57a2ddb6d77213c14995bb7bad9981488b8a1 /CyteKit
parentd69dbfc52fb69ef3e891052c92b2a0dd6bc9f35f (diff)
Improve state machine that protects against automatic fail-directs.
Diffstat (limited to 'CyteKit')
-rw-r--r--CyteKit/WebViewController.mm24
1 files changed, 20 insertions, 4 deletions
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm
index 580a9ca..2d489b3 100644
--- a/CyteKit/WebViewController.mm
+++ b/CyteKit/WebViewController.mm
@@ -453,10 +453,26 @@ float CYScrollViewDecelerationRateNormal;
}
- (void) webView:(WebView *)view didDecidePolicy:(CYWebPolicyDecision)decision forNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame {
- if ([frame parentFrame] == nil)
- if (decision == CYWebPolicyDecisionUse)
- if (!error_)
- request_ = request;
+#if LogBrowser
+ NSLog(@"didDecidePolicy:%u forNavigationAction:%@ request:%@ frame:%@", decision, action, request, [request allHTTPHeaderFields], frame);
+#endif
+
+ if ([frame parentFrame] == nil) {
+ switch (decision) {
+ case CYWebPolicyDecisionIgnore:
+ if ([[request_ URL] isEqual:[request URL]])
+ request_ = nil;
+ break;
+
+ case CYWebPolicyDecisionUse:
+ if (!error_)
+ request_ = request;
+ break;
+
+ default:
+ break;
+ }
+ }
}
- (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener {