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/27 16:01:02 UTC
[3/4] 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/5b41cd6f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/5b41cd6f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/5b41cd6f
Branch: refs/heads/unplug-whitelist
Commit: 5b41cd6fa45567551905ad43547535e52158132a
Parents: 13d9087
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Oct 24 16:13:47 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Oct 27 10:59:56 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/5b41cd6f/CordovaLib/Classes/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m
index a7a38cd..c345060 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) {
@@ -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/5b41cd6f/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 5b37d40..9442b4c 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/5b41cd6f/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 6708634..e4e683f 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