You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2023/04/13 09:33:20 UTC

[cordova-ios] branch 6.3.x created (now bf49a104)

This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a change to branch 6.3.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


      at bf49a104 fix: URL parsing for ATS in node 18 (#1302)

This branch includes the following new commits:

     new 6cfcbf8c (ios) fix: workaround for DisallowOverscroll on iOS 16 (#1258)
     new bf49a104 fix: URL parsing for ATS in node 18 (#1302)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[cordova-ios] 01/02: (ios) fix: workaround for DisallowOverscroll on iOS 16 (#1258)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a commit to branch 6.3.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit 6cfcbf8c74b1df37d6deee1fb92eebfd82dcdd7d
Author: Volker Braun <ta...@vbraun.imap.cc>
AuthorDate: Wed Oct 12 16:15:35 2022 +0200

    (ios) fix: workaround for DisallowOverscroll on iOS 16 (#1258)
---
 .../Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
index d8c78d26..859d4def 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
@@ -390,7 +390,10 @@ static void * KVOContext = &KVOContext;
     // prevent webView from bouncing
     if (!bounceAllowed) {
         if ([wkWebView respondsToSelector:@selector(scrollView)]) {
-            ((UIScrollView*)[wkWebView scrollView]).bounces = NO;
+            UIScrollView* scrollView = [wkWebView scrollView];
+            scrollView.bounces = NO;
+            scrollView.alwaysBounceVertical = NO;     /* iOS 16 workaround */
+            scrollView.alwaysBounceHorizontal = NO;   /* iOS 16 workaround */
         } else {
             for (id subview in wkWebView.subviews) {
                 if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {


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


[cordova-ios] 02/02: fix: URL parsing for ATS in node 18 (#1302)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a commit to branch 6.3.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit bf49a1046ec08a766a6e0afc510e5e96a24e059b
Author: Darryl Pogue <da...@dpogue.ca>
AuthorDate: Wed Apr 12 00:00:09 2023 -0700

    fix: URL parsing for ATS in node 18 (#1302)
    
    Fixes #1290
---
 bin/templates/scripts/cordova/lib/prepare.js | 46 ++++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js
index 7badf9fa..fa703117 100644
--- a/bin/templates/scripts/cordova/lib/prepare.js
+++ b/bin/templates/scripts/cordova/lib/prepare.js
@@ -997,12 +997,8 @@ function processAccessAndAllowNavigationEntries (config) {
     null is returned if the URL cannot be parsed, or is to be skipped for ATS.
 */
 function parseWhitelistUrlForATS (url, options) {
-    // @todo 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead.
-    const href = URL.parse(url); // eslint-disable-line
-    const retObj = {};
-    retObj.Hostname = href.hostname;
-
     // Guiding principle: we only set values in retObj if they are NOT the default
+    const retObj = {};
 
     if (url === '*') {
         retObj.Hostname = '*';
@@ -1026,27 +1022,33 @@ function parseWhitelistUrlForATS (url, options) {
         return retObj;
     }
 
-    if (!retObj.Hostname) {
-        // check origin, if it allows subdomains (wildcard in hostname), we set NSIncludesSubdomains to YES. Default is NO
-        const subdomain1 = '/*.'; // wildcard in hostname
-        const subdomain2 = '*://*.'; // wildcard in hostname and protocol
-        const subdomain3 = '*://'; // wildcard in protocol only
-        if (!href.pathname) {
-            return null;
-        } else if (href.pathname.indexOf(subdomain1) === 0) {
-            retObj.NSIncludesSubdomains = true;
-            retObj.Hostname = href.pathname.substring(subdomain1.length);
-        } else if (href.pathname.indexOf(subdomain2) === 0) {
-            retObj.NSIncludesSubdomains = true;
-            retObj.Hostname = href.pathname.substring(subdomain2.length);
-        } else if (href.pathname.indexOf(subdomain3) === 0) {
-            retObj.Hostname = href.pathname.substring(subdomain3.length);
+    let href = null;
+    try {
+        href = new URL.URL(url);
+    } catch (e) {
+        const scheme = url.split(':')[0];
+        // If there's a wildcard in the protocol, the URL will fail to parse
+        // Replace it with "http" to allow insecure loads
+        if (scheme.includes('*')) {
+            href = new URL.URL(url.replace(scheme, 'http'));
         } else {
-            // Handling "scheme:*" case to avoid creating of a blank key in NSExceptionDomains.
             return null;
         }
     }
 
+    retObj.Hostname = href.hostname;
+
+    // Handling "scheme:*" case to avoid creating of a blank key in NSExceptionDomains.
+    if (retObj.Hostname === '') {
+        return null;
+    }
+
+    // check origin, if it allows subdomains (wildcard in hostname), we set NSIncludesSubdomains to YES. Default is NO
+    if (retObj.Hostname.startsWith('*.')) {
+        retObj.NSIncludesSubdomains = true;
+        retObj.Hostname = href.hostname.substring(2);
+    }
+
     if (options.minimum_tls_version && options.minimum_tls_version !== 'TLSv1.2') { // default is TLSv1.2
         retObj.NSExceptionMinimumTLSVersion = options.minimum_tls_version;
     }
@@ -1064,8 +1066,6 @@ function parseWhitelistUrlForATS (url, options) {
     // if the scheme is HTTP, we set NSExceptionAllowsInsecureHTTPLoads to YES. Default is NO
     if (href.protocol === 'http:') {
         retObj.NSExceptionAllowsInsecureHTTPLoads = true;
-    } else if (!href.protocol && href.pathname.indexOf('*:/') === 0) { // wilcard in protocol
-        retObj.NSExceptionAllowsInsecureHTTPLoads = true;
     }
 
     return retObj;


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