]> git.saurik.com Git - cydia.git/commitdiff
Make the navigation action blocker actually useful.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 24 Feb 2011 17:44:27 +0000 (09:44 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:16 +0000 (02:41 -0800)
MobileCydia.mm
UICaboodle/BrowserView.h
UICaboodle/BrowserView.mm

index c9114ef1335300f573eee8fca992b88019baf1a1..c0c970524f7cfcb746b3086e2175dd79e215a662 100644 (file)
@@ -4101,6 +4101,8 @@ static NSString *Warning_;
         return @"substitutePackageNames";
     else if (selector == @selector(scrollToBottom:))
         return @"scrollToBottom";
+    else if (selector == @selector(setAllowsNavigationAction:))
+        return @"setAllowsNavigationAction";
     else if (selector == @selector(setButtonImage:withStyle:toFunction:))
         return @"setButtonImage";
     else if (selector == @selector(setButtonTitle:withStyle:toFunction:))
@@ -4288,6 +4290,10 @@ static NSString *Warning_;
     [indirect_ setButtonTitle:button withStyle:style toFunction:function];
 }
 
+- (void) setAllowsNavigationAction:(NSString *)value {
+    [indirect_ performSelectorOnMainThread:@selector(setAllowsNavigationActionByNumber:) withObject:value waitUntilDone:NO];
+}
+
 - (void) setHidesBackButton:(NSString *)value {
     [indirect_ performSelectorOnMainThread:@selector(setHidesBackButtonByNumber:) withObject:value waitUntilDone:NO];
 }
@@ -5889,11 +5895,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://package/%@", (id) name_]];
 }
 
-- (bool) _allowNavigationAction {
-    // XXX: damn it... I really want this.
-    return true;
-}
-
 /* XXX: this is not safe at all... localization of /fail/ */
 - (void) _clickButtonWithName:(NSString *)name {
     if ([name isEqualToString:UCLocalize("CLEAR")])
index 41b3d9d29a2058c4ab5396c303a65fc49d1d2f68..03355c2d813b82b59c6326b3c8ae6f3d58ec849c 100644 (file)
@@ -93,6 +93,7 @@
 
     bool visible_;
     bool hidesNavigationBar_;
+    bool allowsNavigationAction_;
 }
 
 + (void) _initialize;
index 29fbde667bb75bc4208bac8d033571c74addbf43..cb16f00e233b3c23566d68132e0c6230922f6538 100644 (file)
@@ -637,8 +637,16 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     return true;
 }
 
-- (bool) _allowNavigationAction {
-    return true;
+- (bool) allowsNavigationAction {
+    return allowsNavigationAction_;
+}
+
+- (void) setAllowsNavigationAction:(bool)value {
+    allowsNavigationAction_ = value;
+}
+
+- (void) setAllowsNavigationActionByNumber:(NSNumber *)value {
+    [self setAllowsNavigationAction:[value boolValue]];
 }
 
 - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
@@ -707,10 +715,12 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 
     if ([frame parentFrame] == nil) {
         if (!error_) {
-            if ([self _allowNavigationAction])
+            NSURL *url(request == nil ? nil : [request URL]);
+
+            if (request_ == nil || [self allowsNavigationAction] || [[request_ URL] isEqual:url])
                 request_ = request;
             else {
-                if ([request URL] != nil)
+                if (url != nil)
                     [self pushRequest:request asPop:NO];
                 [listener ignore];
             }