cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/2] cordova-lib git commit: CB-9935: Cordova CLI silently fails on node.js v5
Date Tue, 03 Nov 2015 01:56:59 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/5.4.x 1ce6a5a24 -> d5927721c


CB-9935: Cordova CLI silently fails on node.js v5

Cordova in a couple places was mis-using the Q.all() function from
the Q promises library. That function expects an array (of values or
promises), but Cordova was passing a single string parameter. The
string was actually being reduced like an array. Previously that
happened to work out OK: the result was an array of fulfilled
single-character promises. But one line of code in Q that worked
on node.js v4 now fails on node.js v5, where because of the bad
parameter it ends up assigning a value to an index of the string:
    exception in cordova-lib\node_modules\q\q.js:1490
    >    promises[index] = value;
    TypeError: Cannot assign to read only property '0' of <string>
It appears the newer version of V8 is a little more strict about
assigning to a string index.

The fix is simply to use Q() instead of Q.all() when the intention
is to return a single fulfilled promise of type string.


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

Branch: refs/heads/5.4.x
Commit: 0e052f2ff86f303209bce4ee2636914217f3717f
Parents: 1ce6a5a
Author: Jason Ginchereau <jasongin@microsoft.com>
Authored: Mon Nov 2 16:29:55 2015 -0800
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Mon Nov 2 17:56:40 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/restore-util.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e052f2f/cordova-lib/src/cordova/restore-util.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/restore-util.js b/cordova-lib/src/cordova/restore-util.js
index c80ade7..102e302 100644
--- a/cordova-lib/src/cordova/restore-util.js
+++ b/cordova-lib/src/cordova/restore-util.js
@@ -55,7 +55,7 @@ function installPlatformsFromConfigXML(platforms, opts) {
     });
 
     if (!targets || !targets.length) {
-        return Q.all('No platforms are listed in config.xml to restore');
+        return Q('No platforms are listed in config.xml to restore');
     }
 
 
@@ -87,7 +87,7 @@ function installPluginsFromConfigXML(args) {
     // Get all configured plugins
     var plugins = cfg.getPluginIdList();
     if (0 === plugins.length) {
-        return Q.all('No config.xml plugins to install');
+        return Q('No config.xml plugins to install');
     }
 
     // CB-9560 : Run `plugin add` serially, one plugin after another


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


Mime
View raw message