B2G/gecko/toolkit/components/aboutmemory/content/aboutMemory.js
/**
 * Like updateAboutMemory(), but gets its data from a file instead of the
 * memory reporters.
 *
 * @param aFile
 *        The File being read from.  Accepted format is described in the
 *        comment describing nsIMemoryReporterManager::dumpReports.
 */
Like updateAboutMemory(), but gets its data from a file instead of the
memory reporters.

@param aFile
The File being read from.  Accepted format is described in the
comment describing nsIMemoryReporterManager::dumpReports.
Like updateAboutMemory () but gets its data from a file instead of the memory reporters . @param aFile The File being read from . Accepted format is described in the comment describing nsIMemoryReporterManager :: dumpReports .
function updateAboutMemoryFromFile(aFile)
{
  try {
    let reader = new FileReader();
    reader.onerror = function(aEvent) { throw "FileReader.onerror"; };
    reader.onabort = function(aEvent) { throw "FileReader.onabort"; };
    reader.onload = function(aEvent) {
      updateAboutMemoryFromJSONString(aEvent.target.result);
    };
    reader.readAsText(aFile);
  } catch (ex) {
    let body = clearBody();
    handleException(ex);
    appendAboutMemoryFooter(body);
  }
}
function updateAboutMemoryFromFile ( aFile ) { try { let reader = new FileReader ( ) ; reader . onerror = function ( aEvent ) { throw "FileReader.onerror" ; } ; reader . onabort = function ( aEvent ) { throw "FileReader.onabort" ; } ; reader . onload = function ( aEvent ) { updateAboutMemoryFromJSONString ( aEvent . target . result ) ; } ; reader . readAsText ( aFile ) ; } catch ( ex ) { let body = clearBody ( ) ; handleException ( ex ) ; appendAboutMemoryFooter ( body ) ; } }
Like updateAboutMemory(), but gets its data from a file instead of the
 memory reporters.
Like updateAboutMemory () but gets its data from a file instead of the memory reporters .
// Note: reader.onload is called asynchronously, once FileReader.readAsText() // completes.  Therefore its exception handling has to be distinct from that // surrounding the |reader.readAsText(aFile)| call.