B2G/gecko/toolkit/mozapps/extensions/XPIProvider.jsm
/**
   * Check the redirect response for a hash of the target XPI and verify that
   * we don't end up on an insecure channel.
   *
   * @see nsIChannelEventSink
   */
Check the redirect response for a hash of the target XPI and verify that
we don't end up on an insecure channel.


Check the redirect response for a hash of the target XPI and verify that we don ' t end up on an insecure channel .
function AI_asyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, aCallback) {
    if (!this.hash && aOldChannel.originalURI.schemeIs("https") &&
        aOldChannel instanceof Ci.nsIHttpChannel) {
      try {
        let hashStr = aOldChannel.getResponseHeader("X-Target-Digest");
        let hashSplit = hashStr.toLowerCase().split(":");
        this.hash = {
          algorithm: hashSplit[0],
          data: hashSplit[1]
        };
      }
      catch (e) {
      }
    }
    if (!this.hash)
      this.badCertHandler.asyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, aCallback);
    else
      aCallback.onRedirectVerifyCallback(Cr.NS_OK);
    this.channel = aNewChannel;
  }
function AI_asyncOnChannelRedirect ( aOldChannel , aNewChannel , aFlags , aCallback ) { if ( ! this . hash && aOldChannel . originalURI . schemeIs ( "https" ) && aOldChannel instanceof Ci . nsIHttpChannel ) { try { let hashStr = aOldChannel . getResponseHeader ( "X-Target-Digest" ) ; let hashSplit = hashStr . toLowerCase ( ) . split ( ":" ) ; this . hash = { algorithm : hashSplit [ 0 ] , data : hashSplit [ 1 ] } ; } catch ( e ) { } } if ( ! this . hash ) this . badCertHandler . asyncOnChannelRedirect ( aOldChannel , aNewChannel , aFlags , aCallback ) ; else aCallback . onRedirectVerifyCallback ( Cr . NS_OK ) ; this . channel = aNewChannel ; }
Check the redirect response for a hash of the target XPI and verify that
 we don't end up on an insecure channel.
Check the redirect response for a hash of the target XPI and verify that we don ' t end up on an insecure channel .
// Verify that we don't end up on an insecure channel if we haven't got a // hash to verify with (see bug 537761 for discussion)