B2G/gecko/dom/apps/src/Webapps.jsm
// aStoreVersion must be a positive integer.
aStoreVersion must be a positive integer.
aStoreVersion must be a positive integer .
function checkForStoreIdMatch(aStoreId, aStoreVersion) {
      let appId = self.getAppLocalIdByStoreId(aStoreId);
      let isInstalled = appId != Ci.nsIScriptSecurityManager.NO_APP_ID;
      if (aIsUpdate) {
        let isDifferent = app.localId !== appId;
        let isPending = app.storeId.indexOf(STORE_ID_PENDING_PREFIX) == 0;
        if ((!isInstalled && !isPending) || (isInstalled && isDifferent)) {
          throw "WRONG_APP_STORE_ID";
        }
        if (!isPending && (app.storeVersion >= aStoreVersion)) {
          throw "APP_STORE_VERSION_ROLLBACK";
        }
      } else if (isInstalled) {
        throw "WRONG_APP_STORE_ID";
      }
    }
function checkForStoreIdMatch ( aStoreId , aStoreVersion ) { let appId = self . getAppLocalIdByStoreId ( aStoreId ) ; let isInstalled = appId != Ci . nsIScriptSecurityManager . NO_APP_ID ; if ( aIsUpdate ) { let isDifferent = app . localId !== appId ; let isPending = app . storeId . indexOf ( STORE_ID_PENDING_PREFIX ) == 0 ; if ( ( ! isInstalled && ! isPending ) || ( isInstalled && isDifferent ) ) { throw "WRONG_APP_STORE_ID" ; } if ( ! isPending && ( app . storeVersion >= aStoreVersion ) ) { throw "APP_STORE_VERSION_ROLLBACK" ; } } else if ( isInstalled ) { throw "WRONG_APP_STORE_ID" ; } }
aStoreVersion must be a positive integer.
aStoreVersion must be a positive integer .
// Things to check: // 1. if it's a update: //   a. We should already have this storeId, or the original storeId must start //      with STORE_ID_PENDING_PREFIX //   b. The manifestURL for the stored app should be the same one we're //      updating //   c. And finally the version of the update should be higher than the one //      on the already installed package // 2. else //   a. We should not have this storeId on the list // We're currently launching WRONG_APP_STORE_ID for all the mismatch kind of // errors, and APP_STORE_VERSION_ROLLBACK for the version error. // Does an app with this storeID exist already?