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/26 18:52:41 UTC

[8/9] ios commit: Document use of new plugin network policy (whitelist) hooks

Document use of new plugin network policy (whitelist) hooks


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

Branch: refs/heads/4.0.x
Commit: 656ae1c02802cc84bb21e199b8e65085b24b1d50
Parents: 5955096
Author: Ian Clelland <ic...@chromium.org>
Authored: Thu Oct 30 14:12:45 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Thu Mar 19 11:06:30 2015 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/Public/CDVPlugin.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/656ae1c0/CordovaLib/Classes/Public/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVPlugin.h b/CordovaLib/Classes/Public/CDVPlugin.h
index 54c8afd..ff4c2f5 100644
--- a/CordovaLib/Classes/Public/CDVPlugin.h
+++ b/CordovaLib/Classes/Public/CDVPlugin.h
@@ -64,6 +64,26 @@ extern NSString* const CDVRemoteNotificationError;
  - (void)didReceiveLocalNotification:(NSNotification *)notification;
  */
 
+ /*
+ // These methods may optionally be implemented. If present, they will be called by CVDViewController when network-policy (whitelist) decisions need to be made.
+
+    This method, if present, will be called by CDVURLProtocol to determine whether to block a request for a web resource. If all plugins which implement this method return true, then the request will be allowed. If any plugin returns false, the request will be blocked. If no plugins implement this method, then the default policy will be followed. (See [CDVViewController defaultResourcePolicyForURL:])
+
+    Note that this method will *not* be called for some resources, such as WebSocket connections, and will not be called by WKWebView at all. Please use CSP headers to handle those situations if needed.
+
+ - (BOOL)shouldAllowRequestForURL:(NSURL *)url
+
+
+    This method, if present, will be called by CDVViewController to determine whether webview navigation to a web page should be allowed. If all plugins which implement this method return true, then the navigation will be allowed. If any plugin returns false, the navigation will be blocked. If no plugins implement this method, then the default policy will be followed. (See [CDVViewController defaultResourcePolicyForURL:])
+
+ - (BOOL)shouldAllowNavigationToURL:(NSURL *)url
+
+
+    This method, if present, will be called by CDVViewController to determine whether a web page which is otherwise blocked should be opened in the system browser. If all plugins which implement this method return true, then the page will be opened. If any plugin returns false, the page will not be opened. If no plugins implement this method, then the default policy will be followed. (See [CDVViewController shouldOpenExternalURL:] and [CDVViewController webView:shouldStartLoadWithRequest:navigationType:])
+
+ - (BOOL)shouldOpenExternalURL:(NSURL *)url
+ */
+
 - (id)appDelegate;
 
 @end


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