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 2015/03/19 17:56:38 UTC

[49/50] [abbrv] 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/57939bcf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/57939bcf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/57939bcf

Branch: refs/heads/unplug-whitelist
Commit: 57939bcf8f72c8bd858a6092bf4bcbd3a6d01203
Parents: 1e8ae64
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Oct 24 16:13:47 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Thu Mar 19 11:06:30 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/57939bcf/CordovaLib/Classes/Public/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVURLProtocol.m b/CordovaLib/Classes/Public/CDVURLProtocol.m
index a7a38cd..c345060 100644
--- a/CordovaLib/Classes/Public/CDVURLProtocol.m
+++ b/CordovaLib/Classes/Public/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) {
@@ -179,7 +167,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/57939bcf/CordovaLib/Classes/Public/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.h b/CordovaLib/Classes/Public/CDVViewController.h
index f654d6c..27d4807 100644
--- a/CordovaLib/Classes/Public/CDVViewController.h
+++ b/CordovaLib/Classes/Public/CDVViewController.h
@@ -23,7 +23,6 @@
 #import "CDVInvokedUrlCommand.h"
 #import "CDVCommandDelegate.h"
 #import "CDVCommandQueue.h"
-#import "CDVWhitelist.h"
 #import "CDVScreenOrientationDelegate.h"
 #import "CDVPlugin.h"
 #import "CDVWebViewEngineProtocol.h"
@@ -44,7 +43,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/57939bcf/CordovaLib/Classes/Public/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m
index 7247200..305c63e 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -36,7 +36,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) NSMutableArray* startupPluginNames;
 @property (nonatomic, readwrite, strong) NSDictionary* pluginsMap;
@@ -53,7 +52,7 @@
 @implementation CDVViewController
 
 @synthesize supportedOrientations;
-@synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames;
+@synthesize pluginObjects, pluginsMap, startupPluginNames;
 @synthesize configParser, settings, loadFromString;
 @synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent;
 @synthesize commandDelegate = _commandDelegate;
@@ -188,7 +187,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