B2G/gecko/toolkit/components/places/tests/favicons/head_favicons.js
/**
 * Waits for the first OnPageChanged notification for ATTRIBUTE_FAVICON, and
 * verifies that it matches the expected page URI and associated favicon URI.
 *
 * This function also double-checks the GUID parameter of the notification.
 *
 * @param aExpectedPageURI
 *        nsIURI object of the page whose favicon should change.
 * @param aExpectedFaviconURI
 *        nsIURI object of the newly associated favicon.
 * @param aCallback
 *        This function is called after the check finished.
 */
Waits for the first OnPageChanged notification for ATTRIBUTE_FAVICON, and
verifies that it matches the expected page URI and associated favicon URI.

This function also double-checks the GUID parameter of the notification.

@param aExpectedPageURI
nsIURI object of the page whose favicon should change.
@param aExpectedFaviconURI
nsIURI object of the newly associated favicon.
@param aCallback
This function is called after the check finished.
Waits for the first OnPageChanged notification for ATTRIBUTE_FAVICON and verifies that it matches the expected page URI and associated favicon URI . This function also double - checks the GUID parameter of the notification . @param aExpectedPageURI nsIURI object of the page whose favicon should change . @param aExpectedFaviconURI nsIURI object of the newly associated favicon . @param aCallback This function is called after the check finished .
function waitForFaviconChanged(aExpectedPageURI, aExpectedFaviconURI,
                               aCallback) {
  let historyObserver = {
    __proto__: NavHistoryObserver.prototype,
    onPageChanged: function WFFC_onPageChanged(aURI, aWhat, aValue, aGUID) {
      if (aWhat != Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON) {
        return;
      }
      PlacesUtils.history.removeObserver(this);
      do_check_true(aURI.equals(aExpectedPageURI));
      do_check_eq(aValue, aExpectedFaviconURI.spec);
      do_check_guid_for_uri(aURI, aGUID);
      aCallback();
    }
  };
  PlacesUtils.history.addObserver(historyObserver, false);
}
function waitForFaviconChanged ( aExpectedPageURI , aExpectedFaviconURI , aCallback ) { let historyObserver = { __proto__ : NavHistoryObserver . prototype , onPageChanged : function WFFC_onPageChanged ( aURI , aWhat , aValue , aGUID ) { if ( aWhat != Ci . nsINavHistoryObserver . ATTRIBUTE_FAVICON ) { return ; } PlacesUtils . history . removeObserver ( this ) ; do_check_true ( aURI . equals ( aExpectedPageURI ) ) ; do_check_eq ( aValue , aExpectedFaviconURI . spec ) ; do_check_guid_for_uri ( aURI , aGUID ) ; aCallback ( ) ; } } ; PlacesUtils . history . addObserver ( historyObserver , false ) ; }
Waits for the first OnPageChanged notification for ATTRIBUTE_FAVICON, and
 verifies that it matches the expected page URI and associated favicon URI.
Waits for the first OnPageChanged notification for ATTRIBUTE_FAVICON and verifies that it matches the expected page URI and associated favicon URI .