B2G/gecko/toolkit/webapps/WebappsInstaller.jsm
/**
 * This function implements the common constructor for
 * the Windows, Mac and Linux native app shells. It reads and parses
 * the data from the app manifest and stores it in the NativeApp
 * object. It's meant to be called as NativeApp.call(this, aData)
 * from the platform-specific constructor.
 *
 * @param aData the data object provided by the web app with
 *              all the app settings and specifications.
 *
 */
This function implements the common constructor for
the Windows, Mac and Linux native app shells. It reads and parses
the data from the app manifest and stores it in the NativeApp
object. It's meant to be called as NativeApp.call(this, aData)
from the platform-specific constructor.

@param aData the data object provided by the web app with
all the app settings and specifications.
This function implements the common constructor for the Windows Mac and Linux native app shells . It reads and parses the data from the app manifest and stores it in the NativeApp object . It ' s meant to be called as NativeApp . call ( this aData ) from the platform - specific constructor . @param aData the data object provided by the web app with all the app settings and specifications .
function NativeApp(aData) {
  let app = this.app = aData.app;
  let origin = Services.io.newURI(app.origin, null, null);
  if (app.manifest.launch_path) {
    this.launchURI = Services.io.newURI(origin.resolve(app.manifest.launch_path),
                                        null, null);
  } else {
    this.launchURI = origin.clone();
  }
  let biggestIcon = getBiggestIconURL(app.manifest.icons);
  try {
    let iconURI = Services.io.newURI(biggestIcon, null, null);
    if (iconURI.scheme == "data") {
      this.iconURI = iconURI;
    }
  } catch (ex) {}
  if (!this.iconURI) {
    try {
      this.iconURI = Services.io.newURI(origin.resolve(biggestIcon), null, null);
    }
    catch (ex) {}
  }
  this.appName = sanitize(app.manifest.name);
  this.appNameAsFilename = stripStringForFilename(this.appName);
  if(app.manifest.developer && app.manifest.developer.name) {
    let devName = app.manifest.developer.name.substr(0, 128);
    devName = sanitize(devName);
    if (devName) {
      this.developerName = devName;
    }
  }
  let shortDesc = this.appName;
  if (app.manifest.description) {
    let firstLine = app.manifest.description.split("\n")[0];
    shortDesc = firstLine.length <= 256
                ? firstLine
                : firstLine.substr(0, 253) + "...";
  }
  this.shortDescription = sanitize(shortDesc);
  this.registryFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
  this.webappJson = {
    "registryDir": this.registryFolder.path,
    "app": app
  };
  this.runtimeFolder = Services.dirsvc.get("GreD", Ci.nsIFile);
}
function NativeApp ( aData ) { let app = this . app = aData . app ; let origin = Services . io . newURI ( app . origin , null , null ) ; if ( app . manifest . launch_path ) { this . launchURI = Services . io . newURI ( origin . resolve ( app . manifest . launch_path ) , null , null ) ; } else { this . launchURI = origin . clone ( ) ; } let biggestIcon = getBiggestIconURL ( app . manifest . icons ) ; try { let iconURI = Services . io . newURI ( biggestIcon , null , null ) ; if ( iconURI . scheme == "data" ) { this . iconURI = iconURI ; } } catch ( ex ) { } if ( ! this . iconURI ) { try { this . iconURI = Services . io . newURI ( origin . resolve ( biggestIcon ) , null , null ) ; } catch ( ex ) { } } this . appName = sanitize ( app . manifest . name ) ; this . appNameAsFilename = stripStringForFilename ( this . appName ) ; if ( app . manifest . developer && app . manifest . developer . name ) { let devName = app . manifest . developer . name . substr ( 0 , 128 ) ; devName = sanitize ( devName ) ; if ( devName ) { this . developerName = devName ; } } let shortDesc = this . appName ; if ( app . manifest . description ) { let firstLine = app . manifest . description . split ( "\n" ) [ 0 ] ; shortDesc = firstLine . length <= 256 ? firstLine : firstLine . substr ( 0 , 253 ) + "..." ; } this . shortDescription = sanitize ( shortDesc ) ; this . registryFolder = Services . dirsvc . get ( "ProfD" , Ci . nsIFile ) ; this . webappJson = { "registryDir" : this . registryFolder . path , "app" : app } ; this . runtimeFolder = Services . dirsvc . get ( "GreD" , Ci . nsIFile ) ; }
This function implements the common constructor for
 the Windows, Mac and Linux native app shells.
This function implements the common constructor for the Windows Mac and Linux native app shells .
// The app registry is the Firefox profile from which the app // was installed.