You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/23 20:23:19 UTC

[2/2] git commit: Add a check to config_parser that root tag is .

Add a check to config_parser that root tag is <widget>.


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

Branch: refs/heads/master
Commit: 837e8e367ae4feed4854f9ac95a8e906c893d818
Parents: 9b7fedf
Author: Mark Koudritsky <ka...@chromium.org>
Authored: Mon Dec 23 14:22:27 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Dec 23 14:22:27 2013 -0500

----------------------------------------------------------------------
 src/config_parser.js | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/837e8e36/src/config_parser.js
----------------------------------------------------------------------
diff --git a/src/config_parser.js b/src/config_parser.js
index b6293d8..4267d30 100644
--- a/src/config_parser.js
+++ b/src/config_parser.js
@@ -27,6 +27,11 @@ function config_parser(path) {
     } catch (e) {
         throw new Error("Parsing "+path+" failed:\n"+e.message);
     }
+    var r = this.doc.getroot();
+    var xmlns ='http://www.w3.org/ns/widgets';
+    if((r.tag !== 'widget') || !r.attrib || (r.attrib.xmlns !== xmlns)) {
+        throw new Error("This file does not seem to be a cordova config.xml file: " + path);
+    }
     this.access = new access(this);
     this.preference = new preference(this);
 }