You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/17 03:52:08 UTC
[06/21] ios commit: CordovaLib Unit Tests: added test for CB-3394
CordovaLib Unit Tests: added test for CB-3394
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6bbdd789
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6bbdd789
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6bbdd789
Branch: refs/heads/3.0.0
Commit: 6bbdd78910657d45ddb560adf24003c7910ad0f2
Parents: f108c40
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 16 09:51:34 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 16 09:51:34 2013 -0700
----------------------------------------------------------------------
CordovaLibTests/CDVWhitelistTests.m | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6bbdd789/CordovaLibTests/CDVWhitelistTests.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVWhitelistTests.m b/CordovaLibTests/CDVWhitelistTests.m
index 21576a3..b809972 100644
--- a/CordovaLibTests/CDVWhitelistTests.m
+++ b/CordovaLibTests/CDVWhitelistTests.m
@@ -290,4 +290,22 @@
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.google.com"]], nil);
}
+- (void)testWildcardPlusOtherUrls
+{
+ // test for https://issues.apache.org/jira/browse/CB-3394
+
+ NSArray* allowedHosts = [NSArray arrayWithObjects:
+ @"*",
+ @"cordova.apache.org",
+ nil];
+
+ CDVWhitelist* whitelist = [[CDVWhitelist alloc] initWithArray:allowedHosts];
+
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://*.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://www.google.com"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"ftp://cordova.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://cordova.apache.org"]], nil);
+ STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"https://cordova.apache.org"]], nil);
+}
+
@end