B2G/gecko/dom/apps/src/AppsUtils.jsm
/**
   * Method to apply modifications to webapp manifests file saved internally.
   * For now, only ensure app can't rename itself.
   */
Method to apply modifications to webapp manifests file saved internally.
For now, only ensure app can't rename itself.
Method to apply modifications to webapp manifests file saved internally . For now only ensure app can ' t rename itself .
function ensureSameAppName(aOldManifest, aNewManifest, aApp) {
    aNewManifest.name = aApp.name;
    if ('locales' in aNewManifest) {
      let defaultName = new ManifestHelper(aOldManifest, aApp.origin).name;
      for (let locale in aNewManifest.locales) {
        let entry = aNewManifest.locales[locale];
        if (!entry.name) {
          continue;
        }
        let localizedName = defaultName;
        if (aOldManifest && 'locales' in aOldManifest &&
            locale in aOldManifest.locales) {
          localizedName = aOldManifest.locales[locale].name;
        }
        entry.name = localizedName;
      }
    }
  }
function ensureSameAppName ( aOldManifest , aNewManifest , aApp ) { aNewManifest . name = aApp . name ; if ( 'locales' in aNewManifest ) { let defaultName = new ManifestHelper ( aOldManifest , aApp . origin ) . name ; for ( let locale in aNewManifest . locales ) { let entry = aNewManifest . locales [ locale ] ; if ( ! entry . name ) { continue ; } let localizedName = defaultName ; if ( aOldManifest && 'locales' in aOldManifest && locale in aOldManifest . locales ) { localizedName = aOldManifest . locales [ locale ] . name ; } entry . name = localizedName ; } } }
Method to apply modifications to webapp manifests file saved internally.
Method to apply modifications to webapp manifests file saved internally .
// Ensure that app name can't be updated // Nor through localized names // In case previous manifest didn't had a name, // we use the default app name