nsCOMPtr<nsIURI>	uri; if (NS_SUCCEEDED(rv = NS_NewURI(getter_AddRefs(uri), url))) { nsCOMPtr<nsIChannel>	channel; if (NS_SUCCEEDED(rv = NS_OpenURI(getter_AddRefs(channel), uri, nsnull))) { channel->SetLoadAttributes(nsIChannel::FORCE_VALIDATION | nsIChannel::VALIDATE_ALWAYS); nsCOMPtr<nsIHTTPChannel>	httpChannel = do_QueryInterface(channel); if (httpChannel) { bmks->htmlSize = 0;  nsCOMPtr<nsIAtom> headAtom = getter_AddRefs(NS_NewAtom("HEAD")); if (headAtom) { httpChannel->SetRequestMethod(headAtom); } if (NS_SUCCEEDED(rv = channel->AsyncRead(bmks, nsnull))) { bmks->busySchedule = TRUE; } } } } } } #ifdef	DEBUG_BOOKMARK_PING_OUTPUT else { printf("nsBookmarksService::FireTimer - busy pinging.\n"); } #endif  #ifndef	REPEATING_TIMERS if (mTimer) { mTimer->Cancel(); mTimer = nsnull; } mTimer = do_CreateInstance("component: if (NS_FAILED(rv) || (!mTimer)) return; mTimer->Init(nsBookmarksService::FireTimer, bmks, BOOKMARK_TIMEOUT, NS_PRIORITY_LOWEST, NS_TYPE_REPEATING_SLACK);
nsCOMPtr<nsIURI>    uri; if (NS_SUCCEEDED(rv = NS_NewURI(getter_AddRefs(uri), url))) { nsCOMPtr<nsIChannel>    channel; if (NS_SUCCEEDED(rv = NS_NewChannel(getter_AddRefs(channel), uri, nsnull))) { channel->SetLoadFlags(nsIRequest::VALIDATE_ALWAYS); nsCOMPtr<nsIHttpChannel>    httpChannel = do_QueryInterface(channel); if (httpChannel) { bmks->htmlSize = 0; httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("HEAD")); if (NS_SUCCEEDED(rv = channel->AsyncOpen(bmks, nsnull))) { bmks->busySchedule = PR_TRUE; } } } } } } #ifdef  DEBUG_BOOKMARK_PING_OUTPUT else { printf("nsBookmarksService::FireTimer - busy pinging.\n"); }
nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure){	nsBookmarksService *bmks = NS_STATIC_CAST(nsBookmarksService *, aClosure);	if (!bmks)	return;	nsresult			rv;	if ((bmks->mBookmarksAvailable == PR_TRUE) && (bmks->mDirty == PR_TRUE))	{		bmks->Flush();	}	if (bmks->busySchedule == PR_FALSE)	{		nsCOMPtr<nsIRDFResource>	bookmark;		if (NS_SUCCEEDED(rv = bmks->GetBookmarkToPing(getter_AddRefs(bookmark))) && (bookmark))		{			bmks->busyResource = bookmark;			const char		*url = nsnull;			bookmark->GetValueConst(&url);#ifdef	DEBUG_BOOKMARK_PING_OUTPUT			printf("nsBookmarksService::FireTimer - Pinging '%s'\n", url);#endif			nsCOMPtr<nsIURI>	uri;			if (NS_SUCCEEDED(rv = NS_NewURI(getter_AddRefs(uri), url)))			{				nsCOMPtr<nsIChannel>	channel;				if (NS_SUCCEEDED(rv = NS_OpenURI(getter_AddRefs(channel), uri, nsnull)))				{					channel->SetLoadAttributes(nsIChannel::FORCE_VALIDATION | nsIChannel::VALIDATE_ALWAYS);					nsCOMPtr<nsIHTTPChannel>	httpChannel = do_QueryInterface(channel);					if (httpChannel)					{						bmks->htmlSize = 0;						nsCOMPtr<nsIAtom> headAtom = getter_AddRefs(NS_NewAtom("HEAD"));						if (headAtom)						{							httpChannel->SetRequestMethod(headAtom);						}						if (NS_SUCCEEDED(rv = channel->AsyncRead(bmks, nsnull)))						{							bmks->busySchedule = TRUE;						}					}				}			}		}	}#ifdef	DEBUG_BOOKMARK_PING_OUTPUTelse	{	printf("nsBookmarksService::FireTimer - busy pinging.\n");	}#endif#ifndef	REPEATING_TIMERS	if (mTimer)	{		mTimer->Cancel();		mTimer = nsnull;	}	mTimer = do_CreateInstance("component://netscape/timer", &rv);	if (NS_FAILED(rv) || (!mTimer)) return;	mTimer->Init(nsBookmarksService::FireTimer, bmks, BOOKMARK_TIMEOUT, NS_PRIORITY_LOWEST, NS_TYPE_REPEATING_SLACK);	// Note: don't addref "this" as we'll cancel the timer in the nsBookmarkService destructor#endif}