You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/11/21 06:47:04 UTC

git commit: Bump to 0.1.12. Fix to #68: can use either `uri` or `origin` attribute to denote domain whitelist (noted as such in readme).

Updated Branches:
  refs/heads/cordova-client c0aa6d985 -> cd15f4432


Bump to 0.1.12. Fix to #68: can use either `uri` or `origin` attribute to denote domain whitelist (noted as such in readme).


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

Branch: refs/heads/cordova-client
Commit: cd15f44325a65459da0515e5a7c4ece505e643a5
Parents: c0aa6d9
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Nov 20 21:46:39 2012 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Nov 20 21:46:39 2012 -0800

----------------------------------------------------------------------
 README.md                               |    2 +-
 package.json                            |    2 +-
 spec/metadata/blackberry_parser.spec.js |   32 +++++++++++++++++--------
 src/config_parser.js                    |    2 +-
 4 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/cd15f443/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 6ea3015..bc11216 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ This file is what you should be editing to modify your application's metadata. A
 
 - The user-facing name can be modified via the contents of the `<name>` element.
 - The package name (AKA bundle identifier or application id) can be modified via the `id` attribute from the top-level `<widget>` element.
-- The whitelist can be modified using the `<access>` elements. Make sure the `origin` attribute of your `<access>` element points to a valid URL (you can use `*` as wildcard). For more information on the whitelisting syntax, see the [docs.phonegap.com](http://docs.phonegap.com/en/2.2.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide).
+- The whitelist can be modified using the `<access>` elements. Make sure the `origin` attribute of your `<access>` element points to a valid URL (you can use `*` as wildcard). For more information on the whitelisting syntax, see the [docs.phonegap.com](http://docs.phonegap.com/en/2.2.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide). You can use either attribute `uri` ([BlackBerry-proprietary](https://developer.blackberry.com/html5/documentation/access_element_834677_11.html)) or `origin` ([standards-compliant](http://www.w3.org/TR/widgets-access/#attributes)) to denote the domain.
 
 # Hooks
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/cd15f443/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 4577f10..c0e7588 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova",
-  "version": "0.1.11",
+  "version": "0.1.12",
   "preferGlobal": "true",
   "description": "Cordova client tool",
   "main": "cordova",

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/cd15f443/spec/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/blackberry_parser.spec.js b/spec/metadata/blackberry_parser.spec.js
index 4dc7a57..c4cb1d3 100644
--- a/spec/metadata/blackberry_parser.spec.js
+++ b/spec/metadata/blackberry_parser.spec.js
@@ -61,17 +61,29 @@ describe('blackberry project parser', function() {
             var bb_cfg = new config_parser(blackberry_config);
             expect(bb_cfg.packageName()).toBe('sofa.king.awesome');
         });
-        it('should update the whitelist properly', function() {
-            config.access.remove('*');
-            config.access.add('http://blackberry.com');
-            config.access.add('http://rim.com');
-            project.update_from_config(config);
+        describe('whitelist', function() {
+            it('should update the whitelist when using access elements with origin attribute', function() {
+                config.access.remove('*');
+                config.access.add('http://blackberry.com');
+                config.access.add('http://rim.com');
+                project.update_from_config(config);
+
+                var bb_cfg = new et.ElementTree(et.XML(fs.readFileSync(blackberry_config, 'utf-8')));
+                var as = bb_cfg.getroot().findall('access');
+                expect(as.length).toEqual(2);
+                expect(as[0].attrib.uri).toEqual('http://blackberry.com');
+                expect(as[1].attrib.uri).toEqual('http://rim.com');
+            });
+            it('should update the whitelist when using access elements with uri attributes', function() {
+                fs.writeFileSync(cfg_path, fs.readFileSync(cfg_path, 'utf-8').replace(/origin="\*/,'uri="http://rim.com'), 'utf-8');
+                config = new config_parser(cfg_path);
+                project.update_from_config(config);
 
-            var bb_cfg = new et.ElementTree(et.XML(fs.readFileSync(blackberry_config, 'utf-8')));
-            var as = bb_cfg.getroot().findall('access');
-            expect(as.length).toEqual(2);
-            expect(as[0].attrib.uri).toEqual('http://blackberry.com');
-            expect(as[1].attrib.uri).toEqual('http://rim.com');
+                var bb_cfg = new et.ElementTree(et.XML(fs.readFileSync(blackberry_config, 'utf-8')));
+                var as = bb_cfg.getroot().findall('access');
+                expect(as.length).toEqual(1);
+                expect(as[0].attrib.uri).toEqual('http://rim.com');
+            });
         });
     });
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/cd15f443/src/config_parser.js
----------------------------------------------------------------------
diff --git a/src/config_parser.js b/src/config_parser.js
index 49aa2a4..f68a0e9 100644
--- a/src/config_parser.js
+++ b/src/config_parser.js
@@ -47,7 +47,7 @@ access.prototype = {
         this.config.update();
     },
     get:function() {
-        return this.config.doc.findall('access').map(function(a) { return a.attrib.origin; });
+        return this.config.doc.findall('access').map(function(a) { return a.attrib.origin || a.attrib.uri; });
     }
 };