cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cordova-lib git commit: CB-12002 - Add getAllowIntents() to ConfigParser
Date Wed, 12 Oct 2016 20:36:21 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master c44db3d7a -> 6a3c76326


CB-12002 - Add getAllowIntents() to ConfigParser

 This closes #502


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

Branch: refs/heads/master
Commit: 6a3c76326811768c310a0c97942bc397183c0144
Parents: c44db3d
Author: Darryl Pogue <darryl@ayogo.com>
Authored: Wed Oct 12 10:48:26 2016 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Wed Oct 12 13:32:26 2016 -0700

----------------------------------------------------------------------
 cordova-common/spec/ConfigParser/ConfigParser.spec.js | 4 ++++
 cordova-common/spec/fixtures/test-config.xml          | 3 +++
 cordova-common/src/ConfigParser/ConfigParser.js       | 9 +++++++++
 3 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6a3c7632/cordova-common/spec/ConfigParser/ConfigParser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/ConfigParser/ConfigParser.spec.js b/cordova-common/spec/ConfigParser/ConfigParser.spec.js
index 097fe61..22fbc99 100644
--- a/cordova-common/spec/ConfigParser/ConfigParser.spec.js
+++ b/cordova-common/spec/ConfigParser/ConfigParser.spec.js
@@ -227,6 +227,10 @@ describe('config.xml parser', function () {
                 var navigations = cfg.getAllowNavigations();
                 expect(navigations.length).not.toEqual(0);
             });
+            it('it should read <allow-intent> tag entries', function(){
+                var intents = cfg.getAllowIntents();
+                expect(intents.length).not.toEqual(0);
+            });
         });
         describe('static resources', function() {
             var hasPlatformPropertyDefined = function (e) { return !!e.platform; };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6a3c7632/cordova-common/spec/fixtures/test-config.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/test-config.xml b/cordova-common/spec/fixtures/test-config.xml
index df47948..a656143 100644
--- a/cordova-common/spec/fixtures/test-config.xml
+++ b/cordova-common/spec/fixtures/test-config.xml
@@ -74,6 +74,9 @@
     <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"
/>
 
+    <allow-intent href="https://*" />
+    <allow-intent href="com.example.myapp:*" />
+
     <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/6a3c7632/cordova-common/src/ConfigParser/ConfigParser.js
----------------------------------------------------------------------
diff --git a/cordova-common/src/ConfigParser/ConfigParser.js b/cordova-common/src/ConfigParser/ConfigParser.js
index f23df4d..6e74ce3 100644
--- a/cordova-common/src/ConfigParser/ConfigParser.js
+++ b/cordova-common/src/ConfigParser/ConfigParser.js
@@ -480,6 +480,15 @@ ConfigParser.prototype = {
             };
         });
     },
+    /* Get all the allow-intent tags */
+    getAllowIntents: function() {
+        var allow_intents = this.doc.findall('./allow-intent');
+        return allow_intents.map(function(allow_intent){
+            return {
+                'href': allow_intent.attrib.href
+            };
+        });
+    },
     /* Get all edit-config tags */
     getEditConfigs: function(platform) {
         var platform_tag = this.doc.find('./platform[@name="' + platform + '"]');


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


Mime
View raw message