B2G/gecko/dom/apps/src/Webapps.jsm
//      yet in the current registry, and run installPermissions()
yet in the current registry, and run installPermissions()
yet in the current registry and run installPermissions ()
function installSystemApps(aNext) {
    let file;
    try {
      file = FileUtils.getFile("coreAppsDir", ["webapps", "webapps.json"], false);
    } catch(e) { }
    if (file && file.exists()) {
      this._loadJSONAsync(file, (function loadCoreRegistry(aData) {
        if (!aData) {
          aNext();
          return;
        }
        for (let id in this.webapps) {
          if (id in aData || this.webapps[id].removable)
            continue;
          let localId = this.webapps[id].localId;
          let permMgr = Cc["@mozilla.org/permissionmanager;1"]
                          .getService(Ci.nsIPermissionManager);
          permMgr.removePermissionsForApp(localId, false);
          Services.cookies.removeCookiesForApp(localId, false);
          this._clearPrivateData(localId, false);
          delete this.webapps[id];
        }
        let appDir = FileUtils.getDir("coreAppsDir", ["webapps"], false);
        for (let id in aData) {
          if (!(id in this.webapps)) {
            this.webapps[id] = aData[id];
            this.webapps[id].basePath = appDir.path;
            this.webapps[id].id = id;
            this.webapps[id].localId = this._nextLocalId();
            if (this.webapps[id].removable === undefined) {
              this.webapps[id].removable = false;
            }
          }
        }
        aNext();
      }).bind(this));
    } else {
      aNext();
    }
  }
function installSystemApps ( aNext ) { let file ; try { file = FileUtils . getFile ( "coreAppsDir" , [ "webapps" , "webapps.json" ] , false ) ; } catch ( e ) { } if ( file && file . exists ( ) ) { this . _loadJSONAsync ( file , ( function loadCoreRegistry ( aData ) { if ( ! aData ) { aNext ( ) ; return ; } for ( let id in this . webapps ) { if ( id in aData || this . webapps [ id ] . removable ) continue ; let localId = this . webapps [ id ] . localId ; let permMgr = Cc [ "@mozilla.org/permissionmanager;1" ] . getService ( Ci . nsIPermissionManager ) ; permMgr . removePermissionsForApp ( localId , false ) ; Services . cookies . removeCookiesForApp ( localId , false ) ; this . _clearPrivateData ( localId , false ) ; delete this . webapps [ id ] ; } let appDir = FileUtils . getDir ( "coreAppsDir" , [ "webapps" ] , false ) ; for ( let id in aData ) { if ( ! ( id in this . webapps ) ) { this . webapps [ id ] = aData [ id ] ; this . webapps [ id ] . basePath = appDir . path ; this . webapps [ id ] . id = id ; this . webapps [ id ] . localId = this . _nextLocalId ( ) ; if ( this . webapps [ id ] . removable === undefined ) { this . webapps [ id ] . removable = false ; } } } aNext ( ) ; } ) . bind ( this ) ) ; } else { aNext ( ) ; } }
yet in the current registry, and run installPermissions()
yet in the current registry and run installPermissions ()
// a // b : core apps are not removable. // Remove the permissions, cookies and private data for this app. // c // Core apps have ids matching their domain name (eg: dialer.gaiamobile.org) // Use that property to check if they are new or not. // Create a new localId. // Core apps are not removable.