You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/10/24 22:17:45 UTC

[4/5] ios commit: Remove whitelist objects from CDVURLProtocol and CDVViewController classes

Remove whitelist objects from CDVURLProtocol and CDVViewController classes

Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/376a5ba9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/376a5ba9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/376a5ba9

Branch: refs/heads/unplug-whitelist
Commit: 376a5ba938e9338092a98bfd3833c35c16675a5f
Parents: 04a538e
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Oct 24 16:13:47 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Oct 24 16:13:47 2014 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVURLProtocol.m    | 14 +-------------
 CordovaLib/Classes/CDVViewController.h |  2 --
 CordovaLib/Classes/CDVViewController.m |  4 +---
 3 files changed, 2 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/376a5ba9/CordovaLib/Classes/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m
index 28adc2c..dfc7444 100644
--- a/CordovaLib/Classes/CDVURLProtocol.m
+++ b/CordovaLib/Classes/CDVURLProtocol.m
@@ -23,10 +23,8 @@
 #import <MobileCoreServices/MobileCoreServices.h>
 #import "CDVURLProtocol.h"
 #import "CDVCommandQueue.h"
-#import "CDVWhitelist.h"
 #import "CDVViewController.h"
 
-static CDVWhitelist* gWhitelist = nil;
 // Contains a set of NSNumbers of addresses of controllers. It doesn't store
 // the actual pointer to avoid retaining.
 static NSMutableSet* gRegisteredControllers = nil;
@@ -77,16 +75,6 @@ static CDVViewController *viewControllerForRequest(NSURLRequest* request)
     if (gRegisteredControllers == nil) {
         [NSURLProtocol registerClass:[CDVURLProtocol class]];
         gRegisteredControllers = [[NSMutableSet alloc] initWithCapacity:8];
-        // The whitelist doesn't change, so grab the first one and store it.
-        gWhitelist = viewController.whitelist;
-
-        // Note that we grab the whitelist from the first viewcontroller for now - but this will change
-        // when we allow a registered viewcontroller to have its own whitelist (e.g InAppBrowser)
-        // Differentiating the requests will be through the 'vc' http header below as used for the js->objc bridge.
-        //  The 'vc' value is generated by casting the viewcontroller object to a (long long) value (see CDVViewController::webViewDidFinishLoad)
-        if (gWhitelist == nil) {
-            NSLog(@"WARNING: NO whitelist has been set in CDVURLProtocol.");
-        }
     }
 
     @synchronized(gRegisteredControllers) {
@@ -176,7 +164,7 @@ static CDVViewController *viewControllerForRequest(NSURLRequest* request)
         return;
     }
 
-    NSString* body = [gWhitelist errorStringForURL:url];
+    NSString* body = [NSString stringWithFormat:@"Access not allowed to URL: %@", url];
     [self sendResponseWithResponseCode:401 data:[body dataUsingEncoding:NSASCIIStringEncoding] mimeType:nil];
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/376a5ba9/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index fbf5260..a2fb2b0 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -23,7 +23,6 @@
 #import "CDVInvokedUrlCommand.h"
 #import "CDVCommandDelegate.h"
 #import "CDVCommandQueue.h"
-#import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
 
@@ -41,7 +40,6 @@
 @property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
 @property (nonatomic, readonly, strong) NSMutableDictionary* settings;
 @property (nonatomic, readonly, strong) NSXMLParser* configParser;
-@property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public
 @property (nonatomic, readonly, assign) BOOL loadFromString;
 
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/376a5ba9/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index a33beeb..888367d 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -34,7 +34,6 @@
 
 @property (nonatomic, readwrite, strong) NSXMLParser* configParser;
 @property (nonatomic, readwrite, strong) NSMutableDictionary* settings;
-@property (nonatomic, readwrite, strong) CDVWhitelist* whitelist;
 @property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects;
 @property (nonatomic, readwrite, strong) NSArray* startupPluginNames;
 @property (nonatomic, readwrite, strong) NSDictionary* pluginsMap;
@@ -50,7 +49,7 @@
 @implementation CDVViewController
 
 @synthesize webView, supportedOrientations;
-@synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames;
+@synthesize pluginObjects, pluginsMap, startupPluginNames;
 @synthesize configParser, settings, loadFromString;
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
@@ -185,7 +184,6 @@
     // Get the plugin dictionary, whitelist and settings from the delegate.
     self.pluginsMap = delegate.pluginsDict;
     self.startupPluginNames = delegate.startupPluginNames;
-    self.whitelist = [[CDVWhitelist alloc] initWithArray:delegate.whitelistHosts];
     self.settings = delegate.settings;
 
     // And the start folder/page.


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