Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 158E3DD7D for ; Fri, 17 May 2013 01:52:04 +0000 (UTC) Received: (qmail 200 invoked by uid 500); 17 May 2013 01:52:04 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 188 invoked by uid 500); 17 May 2013 01:52:04 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 149 invoked by uid 99); 17 May 2013 01:52:04 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 May 2013 01:52:04 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 081AB2231F; Fri, 17 May 2013 01:52:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Fri, 17 May 2013 01:52:08 -0000 Message-Id: In-Reply-To: <597a94deab1b4c7f85676ac29b427bb6@git.apache.org> References: <597a94deab1b4c7f85676ac29b427bb6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Thu May 16 09:51:34 2013 -0700 Committer: Shazron Abdullah 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