nsXPIDLCString buffer;  GetURIStringFromChannel(aDocChannel, buffer); if (aLoadInitiator == this) { PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, ("DocLoader:%p: ++ Firing OnEndDocumentLoad(...)" "\tURI: %s Status: %x\n", this, (const char *) buffer, aStatus)); } else { PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, ("DocLoader:%p: --   Propagating OnEndDocumentLoad(...)." "DocLoader:%p  URI:%s\n", this, aLoadInitiator, (const char *)buffer)); }
nsCOMPtr<nsIURI> uri; nsresult rv = NS_OK; if (aDocChannel) rv = aDocChannel->GetURI(getter_AddRefs(uri)); if (NS_SUCCEEDED(rv)) { char* buffer = nsnull; if (uri) rv = uri->GetSpec(&buffer); if (NS_SUCCEEDED(rv) && buffer != nsnull) { PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, ("DocLoader:%p: Firing OnEndDocumentLoad(...) called for [DocLoader:%p] %s\n", this, aLoadInitiator, buffer)); nsCRT::free(buffer); } }
void nsDocLoaderImpl::FireOnEndDocumentLoad(nsDocLoaderImpl* aLoadInitiator,                                            nsIChannel *aDocChannel,                                            nsresult aStatus)									{#if defined(DEBUG)  nsXPIDLCString buffer;  GetURIStringFromChannel(aDocChannel, buffer);  if (aLoadInitiator == this) {    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,            ("DocLoader:%p: ++ Firing OnEndDocumentLoad(...)"            "\tURI: %s Status: %x\n",             this, (const char *) buffer, aStatus));  } else {    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,            ("DocLoader:%p: --   Propagating OnEndDocumentLoad(...)."            "DocLoader:%p  URI:%s\n",             this, aLoadInitiator, (const char *)buffer));  }#endif /* DEBUG */  /*   * First notify any observers that the document load has finished...   *   * Operate the elements from back to front so that if items get   * get removed from the list it won't affect our iteration   */  PRInt32 count;  count = mDocObservers.Count();  while (count > 0) {    nsIDocumentLoaderObserver *observer;    observer = NS_STATIC_CAST(nsIDocumentLoaderObserver*, mDocObservers.ElementAt(--count));    NS_ASSERTION(observer, "NULL observer found in list.");    if (! observer) {      continue;    }    observer->OnEndDocumentLoad(aLoadInitiator, aDocChannel, aStatus);  }  /*   * Next notify the parent...   */  if (mParent) {    mParent->FireOnEndDocumentLoad(aLoadInitiator, aDocChannel, aStatus);  }}