diff options
-rw-r--r-- | CyteKit/WebView.h | 1 | ||||
-rw-r--r-- | CyteKit/WebView.mm | 16 | ||||
-rw-r--r-- | CyteKit/WebViewController.mm | 9 | ||||
-rw-r--r-- | iPhonePrivate.h | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/CyteKit/WebView.h b/CyteKit/WebView.h index 0c96f6f..ba2043b 100644 --- a/CyteKit/WebView.h +++ b/CyteKit/WebView.h @@ -62,6 +62,7 @@ enum CYWebPolicyDecision { - (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didDecidePolicy:(CYWebPolicyDecision)decision forNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm index dbd9129..1329d4f 100644 --- a/CyteKit/WebView.mm +++ b/CyteKit/WebView.mm @@ -198,6 +198,21 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW [super webView:view didClearWindowObject:window forFrame:frame]; } // }}} +// webView:didCommitLoadForFrame: (3.0+) {{{ +static void $UIWebViewWebViewDelegate$webView$didCommitLoadForFrame$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, WebFrame *frame) { + UIWebView *uiWebView(MSHookIvar<UIWebView *>(self, "uiWebView")); + if ([uiWebView respondsToSelector:@selector(webView:didCommitLoadForFrame:)]) + [uiWebView webView:view didCommitLoadForFrame:frame]; +} + +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame { + id<CyteWebViewDelegate> delegate([self delegate]); + if ([delegate respondsToSelector:@selector(webView:didCommitLoadForFrame:)]) + [delegate webView:view didCommitLoadForFrame:frame]; + if ([UIWebView instancesRespondToSelector:@selector(webView:didCommitLoadForFrame:)]) + [super webView:view didCommitLoadForFrame:frame]; +} +// }}} // webView:didFailLoadWithError:forFrame: (2.0+) {{{ - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { id<CyteWebViewDelegate> delegate([self delegate]); @@ -343,6 +358,7 @@ __attribute__((__constructor__)) static void $() { class_addMethod($UIWebViewWebViewDelegate, @selector(webView:addMessageToConsole:), (IMP) &$UIWebViewWebViewDelegate$webView$addMessageToConsole$, "v16@0:4@8@12"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:), (IMP) &$UIWebViewWebViewDelegate$webView$decidePolicyForNewWindowAction$request$newFrameName$decisionListener$, "v28@0:4@8@12@16@20@24"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didClearWindowObject:forFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$, "v20@0:4@8@12@16"); + class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didCommitLoadForFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didCommitLoadForFrame$, "v16@0:4@8@12"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didReceiveTitle:forFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didReceiveTitle$forFrame$, "v20@0:4@8@12@16"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), (IMP) &$UIWebViewWebViewDelegate$webView$resource$willSendRequest$redirectResponse$fromDataSource$, "@28@0:4@8@12@16@20@24"); class_addMethod($UIWebViewWebViewDelegate, @selector(webViewClose:), (IMP) &$UIWebViewWebViewDelegate$webViewClose$, "v12@0:4@8"); diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 444e821..c36614c 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -464,6 +464,15 @@ float CYScrollViewDecelerationRateNormal; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame { } +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame { +#if LogBrowser + NSLog(@"didCommitLoadForFrame:%@", frame); +#endif + + if ([frame parentFrame] == nil) { + } +} + - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { #if LogBrowser NSLog(@"didFailLoadWithError:%@ forFrame:%@", error, frame); diff --git a/iPhonePrivate.h b/iPhonePrivate.h index b5a5959..ed8a91f 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -313,6 +313,7 @@ typedef enum { - (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; - (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame; |