bug 758044. Installation directory is now "scheme;host;port" with ";port" omitted if port is the default. Uninstall registry key is now "scheme://host:port" with ":port" omitted if the port is the default. r=felipe
authorTim Abraldes <tabraldes@mozilla.com>
Mon, 04 Jun 2012 00:23:17 -0700
changeset 95744 030fa99e5bdef64a1c4a1a55d076945cc2036c41
parent 95743 a7948da916f2b704648c5d9dc3ef949897d04dca
child 95745 a6cee80d4fde9442df8bf9a5b5d4cad6656ed5fa
push idunknown
push userunknown
push dateunknown
reviewersfelipe
bugs758044
milestone15.0a1
bug 758044. Installation directory is now "scheme;host;port" with ";port" omitted if port is the default. Uninstall registry key is now "scheme://host:port" with ":port" omitted if the port is the default. r=felipe
browser/modules/WebappsInstaller.jsm
--- a/browser/modules/WebappsInstaller.jsm
+++ b/browser/modules/WebappsInstaller.jsm
@@ -187,22 +187,26 @@ WinNativeApp.prototype = {
 
     this.appNameAsFilename = this.appNameAsFilename.replace(filenameRE, "");
     if (this.appNameAsFilename == "") {
       this.appNameAsFilename = "webapp";
     }
 
     // The ${InstallDir} format is as follows:
     //  host of the app origin + ";" +
-    //  protocol + ";" +
-    //  port (-1 for default port)
+    //  protocol
+    //  + ";" + port (only if port is not default)
     this.installDir = Services.dirsvc.get("AppData", Ci.nsIFile);
-    this.installDir.append(this.launchURI.host + ";" + 
-                           this.launchURI.scheme + ";" +
-                           this.launchURI.port);
+    let installDirLeaf = this.launchURI.scheme
+                       + ";"
+                       + this.launchURI.host;
+    if (this.launchURI.port != -1) {
+      installDirLeaf += ";" + this.launchURI.port;
+    }
+    this.installDir.append(installDirLeaf);
 
     this.uninstallDir = this.installDir.clone();
     this.uninstallDir.append("uninstall");
 
     this.uninstallerFile = this.uninstallDir.clone();
     this.uninstallerFile.append("webapp-uninstaller.exe");
 
     this.iconFile = this.installDir.clone();
@@ -215,18 +219,17 @@ WinNativeApp.prototype = {
     this.desktopShortcut.append(this.appNameAsFilename + ".lnk");
     this.desktopShortcut.followLinks = false;
 
     this.startMenuShortcut = Services.dirsvc.get("Progs", Ci.nsILocalFile);
     this.startMenuShortcut.append(this.appNameAsFilename + ".lnk");
     this.startMenuShortcut.followLinks = false;
 
     this.uninstallSubkeyStr = this.launchURI.scheme + "://" +
-                              this.launchURI.host + ":" +
-                              this.launchURI.port;
+                              this.launchURI.hostPort;
   },
 
   /**
    * Remove the current installation
    */
   _removeInstallation : function() {
     let uninstallKey;
     try {