B2G/gecko/dom/apps/src/Webapps.jsm
// Try to download a new manifest.
Try to download a new manifest.
Try to download a new manifest .
function doRequest(oldManifest, headers) {
      headers = headers || [];
      let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
                  .createInstance(Ci.nsIXMLHttpRequest);
      xhr.open("GET", aData.manifestURL, true);
      xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
      headers.forEach(function(aHeader) {
        debug("Adding header: " + aHeader.name + ": " + aHeader.value);
        xhr.setRequestHeader(aHeader.name, aHeader.value);
      });
      xhr.responseType = "json";
      if (app.etag) {
        debug("adding manifest etag:" + app.etag);
        xhr.setRequestHeader("If-None-Match", app.etag);
      }
      xhr.channel.notificationCallbacks =
        this.createLoadContext(app.installerAppId, app.installerIsBrowser);
      xhr.addEventListener("load", onload.bind(this, xhr, oldManifest), false);
      xhr.addEventListener("error", (function() {
        sendError("NETWORK_ERROR");
      }).bind(this), false);
      debug("Checking manifest at " + aData.manifestURL);
      xhr.send(null);
    }
function doRequest ( oldManifest , headers ) { headers = headers || [ ] ; let xhr = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ] . createInstance ( Ci . nsIXMLHttpRequest ) ; xhr . open ( "GET" , aData . manifestURL , true ) ; xhr . channel . loadFlags |= Ci . nsIRequest . INHIBIT_CACHING ; headers . forEach ( function ( aHeader ) { debug ( "Adding header: " + aHeader . name + ": " + aHeader . value ) ; xhr . setRequestHeader ( aHeader . name , aHeader . value ) ; } ) ; xhr . responseType = "json" ; if ( app . etag ) { debug ( "adding manifest etag:" + app . etag ) ; xhr . setRequestHeader ( "If-None-Match" , app . etag ) ; } xhr . channel . notificationCallbacks = this . createLoadContext ( app . installerAppId , app . installerIsBrowser ) ; xhr . addEventListener ( "load" , onload . bind ( this , xhr , oldManifest ) , false ) ; xhr . addEventListener ( "error" , ( function ( ) { sendError ( "NETWORK_ERROR" ) ; } ) . bind ( this ) , false ) ; debug ( "Checking manifest at " + aData . manifestURL ) ; xhr . send ( null ) ; }
Try to download a new manifest.
Try to download a new manifest .