summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {