B2G/gecko/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain_activeDownloads.js
/**
 * Checks to ensure a URI string is in download history or not.
 *
 * @param aURIString
 *        The string of the URI to check.
 * @param aIsActive
 *        True if the URI should be actively downloaded, false otherwise.
 */
Checks to ensure a URI string is in download history or not.
@param aURIString
The string of the URI to check.
@param aIsActive
True if the URI should be actively downloaded, false otherwise.
Checks to ensure a URI string is in download history or not . @param aURIString The string of the URI to check . @param aIsActive True if the URI should be actively downloaded false otherwise .
function check_active_download(aURIString, aIsActive)
{
  let dm = Cc["@mozilla.org/download-manager;1"].
           getService(Ci.nsIDownloadManager);
  let enumerator = dm.activeDownloads;
  let found = false;
  while (enumerator.hasMoreElements()) {
    let dl = enumerator.getNext().QueryInterface(Ci.nsIDownload);
    if (dl.source.spec == aURIString)
      found = true;
  }
  let checker = aIsActive ? do_check_true : do_check_false;
  checker(found);
}
function check_active_download ( aURIString , aIsActive ) { let dm = Cc [ "@mozilla.org/download-manager;1" ] . getService ( Ci . nsIDownloadManager ) ; let enumerator = dm . activeDownloads ; let found = false ; while ( enumerator . hasMoreElements ( ) ) { let dl = enumerator . getNext ( ) . QueryInterface ( Ci . nsIDownload ) ; if ( dl . source . spec == aURIString ) found = true ; } let checker = aIsActive ? do_check_true : do_check_false ; checker ( found ) ; }
Checks to ensure a URI string is in download history or not.
Checks to ensure a URI string is in download history or not .