summaryrefslogtreecommitdiff
path: root/CyteKit
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-06-24 10:09:30 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-06-24 10:09:30 -0700
commit92de61aabba908e254b8d4f1498798043fdabbe7 (patch)
treedc4b65d814403a8fc24e9e84a38018b5047cb45d /CyteKit
parent202bf8406ce550a612cce583115dc6e1f07bb031 (diff)
Now on iOS 8.3, webView: can be webThreadWebView:.
Diffstat (limited to 'CyteKit')
-rw-r--r--CyteKit/WebView.h1
-rw-r--r--CyteKit/WebView.mm10
-rw-r--r--CyteKit/WebViewController.h2
-rw-r--r--CyteKit/WebViewController.mm8
4 files changed, 21 insertions, 0 deletions
diff --git a/CyteKit/WebView.h b/CyteKit/WebView.h
index 804c037..7314da6 100644
--- a/CyteKit/WebView.h
+++ b/CyteKit/WebView.h
@@ -55,6 +55,7 @@ enum CYWebPolicyDecision {
- (void) webView:(WebView *)view resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source;
- (void) webView:(WebView *)view resource:(id)identifier didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source;
- (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
+- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
- (void) webViewClose:(WebView *)view;
- (bool) webView:(WebView *)view shouldRunJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
- (bool) webView:(WebView *)view shouldRunJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm
index 6630463..df37711 100644
--- a/CyteKit/WebView.mm
+++ b/CyteKit/WebView.mm
@@ -295,6 +295,16 @@ static NSURLRequest *$UIWebViewWebViewDelegate$webView$resource$willSendRequest$
return request;
}
// }}}
+// webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource: {{{
+- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
+ id<CyteWebViewDelegate> delegate([self delegate]);
+ if ([UIWebView instancesRespondToSelector:@selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:)])
+ request = [super webThreadWebView:view resource:identifier willSendRequest:request redirectResponse:response fromDataSource:source];
+ if ([delegate respondsToSelector:@selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:)])
+ request = [delegate webThreadWebView:view resource:identifier willSendRequest:request redirectResponse:response fromDataSource:source];
+ return request;
+}
+// }}}
// webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame: (2.1+) {{{
- (void) webView:(WebView *)view runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
[[self retain] autorelease];
diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h
index 2483224..8410432 100644
--- a/CyteKit/WebViewController.h
+++ b/CyteKit/WebViewController.h
@@ -107,7 +107,9 @@
- (void) reloadURLWithCache:(BOOL)cache;
- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
+
- (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
+- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
+ (float) defaultWidth;
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm
index 33524f3..a7ff586 100644
--- a/CyteKit/WebViewController.mm
+++ b/CyteKit/WebViewController.mm
@@ -711,6 +711,14 @@ float CYScrollViewDecelerationRateNormal;
return request;
}
+- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
+#if LogBrowser
+ NSLog(@"resource:%@ willSendRequest:%@ redirectResponse:%@ fromDataSource:%@", identifier, request, response, source);
+#endif
+
+ return request;
+}
+
- (bool) webView:(WebView *)view shouldRunJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
return [self _allowJavaScriptPanel];
}