Github user shazron commented on a diff in the pull request:
https://github.com/apache/cordova-ios/pull/232#discussion_r73437041
--- Diff: tests/CordovaLibTests/CDVWhitelistTests.m ---
@@ -295,6 +295,37 @@ - (void)testAllowIntentsAndNavigations
XCTAssertEqual([CDVIntentAndNavigationFilter filterUrl:[NSURL
URLWithString:@"https://google.com"] intentsWhitelist:intentsWhitelist
navigationsWhitelist:navigationsWhitelist],
CDVIntentAndNavigationFilterValueIntentAllowed);
// Test http (not allowed in either)
XCTAssertEqual([CDVIntentAndNavigationFilter filterUrl:[NSURL
URLWithString:@"http://google.com"] intentsWhitelist:intentsWhitelist
navigationsWhitelist:navigationsWhitelist],
CDVIntentAndNavigationFilterValueNoneAllowed);
+
+
+ NSURL* telUrl = [NSURL URLWithString:@"tel:5555555"];
+ NSMutableURLRequest* telRequest = [NSMutableURLRequest
requestWithURL:telUrl];
+ telRequest.mainDocumentURL = telUrl;
+
+ // mainDocumentURL and URL are the same in the NSURLRequest
+ // Only UIWebViewNavigationTypeLinkClicked and
UIWebViewNavigationTypeOther should return YES
+ XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeLinkClicked]);
+ XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest navigationType:UIWebViewNavigationTypeOther]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest navigationType:UIWebViewNavigationTypeReload]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeBackForward]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeFormSubmitted]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeFormResubmitted]);
+
--- End diff --
See my comment on that note. The operative test here is for
"shouldOverrideLoadWithRequest" -- if the intent is allowed, it should return
NO, as in it shouldn't override the load with the request (since it is opened
externally).
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]