You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2015/10/20 12:48:04 UTC

cordova-lib git commit: CB-9758 Mobilespec crashes adding plugins on OS X

Repository: cordova-lib
Updated Branches:
  refs/heads/master e21689182 -> a49e67fc1


CB-9758 Mobilespec crashes adding plugins on OS X

Avoid empty keys in NSExceptionDomains
Added corresponding test

github: close #318


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

Branch: refs/heads/master
Commit: a49e67fc1b06c0c8c7db13ba8101c66f91cdbe7d
Parents: e216891
Author: daserge <v-...@microsoft.com>
Authored: Thu Oct 8 12:53:07 2015 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Tue Oct 20 13:43:39 2015 +0300

----------------------------------------------------------------------
 cordova-lib/spec-cordova/metadata/ios_parser.spec.js | 9 +++++++++
 cordova-lib/spec-cordova/test-config.xml             | 9 ++++++++-
 cordova-lib/src/cordova/metadata/ios_parser.js       | 5 ++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a49e67fc/cordova-lib/spec-cordova/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/ios_parser.spec.js b/cordova-lib/spec-cordova/metadata/ios_parser.spec.js
index 5721672..330d1e1 100644
--- a/cordova-lib/spec-cordova/metadata/ios_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/ios_parser.spec.js
@@ -496,6 +496,15 @@ describe('ios project parser', function () {
                     expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
                 });
             });
+            it('<allow-navigation> - should ignore wildcards like data:*, https:*, https://*', function(done) {
+                wrapper(p.update_from_config(cfg), done, function() {
+                    var ats = plist_build.mostRecentCall.args[0].NSAppTransportSecurity;
+                    var exceptionDomains = ats.NSExceptionDomains;
+                    expect(exceptionDomains['']).toBeUndefined();
+                    expect(exceptionDomains['null']).toBeUndefined();
+                    expect(exceptionDomains['undefined']).toBeUndefined();
+                });
+            });
         });
         describe('www_dir method', function() {
             it('should return /www', function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a49e67fc/cordova-lib/spec-cordova/test-config.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/test-config.xml b/cordova-lib/spec-cordova/test-config.xml
index d90837a..ffe8cf7 100644
--- a/cordova-lib/spec-cordova/test-config.xml
+++ b/cordova-lib/spec-cordova/test-config.xml
@@ -72,7 +72,14 @@
     <allow-navigation href="*://server38.com" minimum-tls-version="TLSv1.2" requires-forward-secrecy="false" />
     <allow-navigation href="*://server39.com" minimum-tls-version="TLSv1.1" requires-forward-secrecy="true" />
     <allow-navigation href="*://server40.com" minimum-tls-version="TLSv1.1" requires-forward-secrecy="false" />
-        
+
+    <!-- https://issues.apache.org/jira/browse/CB-9758 Mobilespec crashes adding plugins on OS X -->
+    <allow-navigation href="data:*" />
+    <allow-navigation href="http:*" />
+    <allow-navigation href="https:*" />
+    <allow-navigation href="http://*" />
+    <allow-navigation href="https://*" />
+
     <preference name="fullscreen" value="true" />
     <preference name="webviewbounce" value="true" />
     <preference name="orientation" value="portrait" />

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a49e67fc/cordova-lib/src/cordova/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/ios_parser.js b/cordova-lib/src/cordova/metadata/ios_parser.js
index 3eb4b6b..87ef5a2 100644
--- a/cordova-lib/src/cordova/metadata/ios_parser.js
+++ b/cordova-lib/src/cordova/metadata/ios_parser.js
@@ -389,7 +389,10 @@ function processUrlAsATS(ats0, url, minimum_tls_version, requires_forward_secrec
         } else if (href.pathname.indexOf(subdomain3) === 0) {
             includesSubdomains = false;
             hostname = href.pathname.substring(subdomain3.length);
-        } 
+        } else {
+            // Handling "scheme:*" case to avoid creating of a blank key in NSExceptionDomains.
+            return ats;
+        }
     }
 
     // get existing entry, if any


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