cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tony-- <...@git.apache.org>
Subject [GitHub] cordova-ios pull request #232: CB-11270 - Handle JavaScript onclick handler ...
Date Wed, 03 Aug 2016 15:09:34 GMT
Github user tony-- commented on a diff in the pull request:

    https://github.com/apache/cordova-ios/pull/232#discussion_r73356143
  
    --- Diff: CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m
---
    @@ -95,23 +95,33 @@ - (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url
         return [[self class] filterUrl:url intentsWhitelist:self.allowIntentsWhitelist navigationsWhitelist:self.allowNavigationsWhitelist];
     }
     
    -- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
    ++ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
    +{
    +    return (UIWebViewNavigationTypeLinkClicked == navigationType ||
    +        (UIWebViewNavigationTypeOther == navigationType &&
    +         [[request.mainDocumentURL absoluteString] isEqualToString:[request.URL absoluteString]]
    +         )
    +        );
    +}
    +
    ++ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
filterValue:(CDVIntentAndNavigationFilterValue)filterValue
     {
         NSString* allowIntents_whitelistRejectionFormatString = @"ERROR External navigation
rejected - <allow-intent> not set for url='%@'";
         NSString* allowNavigations_whitelistRejectionFormatString = @"ERROR Internal navigation
rejected - <allow-navigation> not set for url='%@'";
         
         NSURL* url = [request URL];
    -    CDVIntentAndNavigationFilterValue filterValue = [self filterUrl:url];
         
         switch (filterValue) {
             case CDVIntentAndNavigationFilterValueNavigationAllowed:
                 return YES;
             case CDVIntentAndNavigationFilterValueIntentAllowed:
    -            // only allow-intent if it's a UIWebViewNavigationTypeLinkClicked (anchor
tag)
    -            if (UIWebViewNavigationTypeLinkClicked == navigationType) {
    +            // only allow-intent if it's a UIWebViewNavigationTypeLinkClicked (anchor
tag) OR
    +            // it's a UIWebViewNavigationTypeOther, and it's an internal link
    +            if ([[self class] shouldOpenURLRequest:request navigationType:navigationType]){
                     [[UIApplication sharedApplication] openURL:url];
    --- End diff --
    
    Currently if we make it in to openURL, we'll still fall through to return NO.
    Since we handled it (by sending it to openURL), should we return YES from inside the if
clause?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message