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 2014/03/10 04:34:26 UTC

[2/5] git commit: Fix ServeInstaller NPE by having installPath accessed as a property always

Fix ServeInstaller NPE by having installPath accessed as a property always


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

Branch: refs/heads/master
Commit: be0b7a9bd0419f1ae698f352eaf753735bc82f96
Parents: 343b9d0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Sun Mar 9 22:55:00 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Sun Mar 9 22:55:00 2014 -0400

----------------------------------------------------------------------
 www/cdvah/js/CrxInstaller.js   | 3 ++-
 www/cdvah/js/Installer.js      | 4 ++--
 www/cdvah/js/ServeInstaller.js | 9 +++++----
 3 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/be0b7a9b/www/cdvah/js/CrxInstaller.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/CrxInstaller.js b/www/cdvah/js/CrxInstaller.js
index d0f2777..34e4c04 100644
--- a/www/cdvah/js/CrxInstaller.js
+++ b/www/cdvah/js/CrxInstaller.js
@@ -13,7 +13,8 @@
 
         CrxInstaller.prototype.type = 'crx';
 
-        CrxInstaller.prototype.doUpdateApp = function(installPath) {
+        CrxInstaller.prototype.doUpdateApp = function() {
+            var installPath = this.installPath;
             var platformConfig = location.pathname.replace(/\/[^\/]*$/, '/crx_files/config.' + platformId + '.xml');
             var targetConfig = installPath + '/config.xml';
             var xhr;

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/be0b7a9b/www/cdvah/js/Installer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/Installer.js b/www/cdvah/js/Installer.js
index 9864e91..54c1b40 100644
--- a/www/cdvah/js/Installer.js
+++ b/www/cdvah/js/Installer.js
@@ -63,9 +63,9 @@
         Installer.prototype.updateApp = function(installPath) {
             var self = this;
             this.updatingStatus = 0;
-            return this.doUpdateApp(installPath)
+            this.installPath = installPath;
+            return this.doUpdateApp()
             .then(function() {
-                self.installPath = installPath;
                 self.lastUpdated = new Date();
                 self.updatingStatus = null;
                 if (self.type === 'crx') {

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/be0b7a9b/www/cdvah/js/ServeInstaller.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/ServeInstaller.js b/www/cdvah/js/ServeInstaller.js
index aafdb7b..9a2d495 100644
--- a/www/cdvah/js/ServeInstaller.js
+++ b/www/cdvah/js/ServeInstaller.js
@@ -71,17 +71,18 @@
         }
 
         // TODO: update should be more atomic. Maybe download to a new directory?
-        ServeInstaller.prototype.doUpdateApp = function(installPath) {
+        ServeInstaller.prototype.doUpdateApp = function() {
             if (this._assetManifest) {
-                return this._doUpdateAppForReal(installPath);
+                return this._doUpdateAppForReal();
             }
             var me = this;
             return this._readAssetManifest().then(function() {
-                return me._doUpdateAppForReal(installPath);
+                return me._doUpdateAppForReal();
             });
         };
 
-        ServeInstaller.prototype._doUpdateAppForReal = function(installPath) {
+        ServeInstaller.prototype._doUpdateAppForReal = function() {
+            var installPath = this.installPath;
             var deferred = $q.defer();
             var self = this;
             // Write the asset manifest to disk at most every 2 seconds.