return NS_OK;
return(NS_OK);
nsBookmarksService::ReadBookmarks(){	nsresult	rv;	// the profile manager might call Readbookmarks() in certain circumstances	// so we need to forget about any previous bookmarks	mInner = nsnull;	if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID,				nsnull, nsIRDFDataSource::GetIID(), (void**) &mInner)))		return(rv);	nsFileSpec	bookmarksFile;	rv = GetBookmarksFile(&bookmarksFile);	// Oh well, couldn't get the bookmarks file. Guess there	// aren't any bookmarks to read in.	if (NS_FAILED(rv))	    return NS_OK;	rv = gRDFC->MakeSeq(mInner, kNC_BookmarksRoot, nsnull);	NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to make NC:BookmarksRoot a sequence");	if (NS_FAILED(rv)) return rv;	PRBool	foundIERoot = PR_FALSE;#ifdef	DEBUG	PRTime		now;#ifdef	XP_MAC	Microseconds((UnsignedWide *)&now);#else	now = PR_Now();#endif	printf("Start reading in bookmarks.html\n");#endif#ifdef	XP_WIN	nsCOMPtr<nsIRDFResource>	ieFolder;	char				*ieFavoritesURL = nsnull;#endif#ifdef	XP_BEOS	nsCOMPtr<nsIRDFResource>	netPositiveFolder;	char				*netPositiveURL = nsnull;#endif	{ // <-- scope the stream to get the open/close automatically.		nsInputFileStream strm(bookmarksFile);		if (! strm.is_open())		{			NS_ERROR("unable to open file");			return NS_ERROR_FAILURE;		}		BookmarkParser parser;		parser.Init(&strm, mInner);#ifdef	XP_MAC		parser.SetIEFavoritesRoot(kURINC_IEFavoritesRoot);#endif#ifdef	XP_WIN		nsSpecialSystemDirectory	ieFavoritesFile(nsSpecialSystemDirectory::Win_Favorites);		nsFileURL			ieFavoritesURLSpec(ieFavoritesFile);		const char			*favoritesURL = ieFavoritesURLSpec.GetAsString();		if (favoritesURL)		{			ieFavoritesURL = strdup(favoritesURL);		}		parser.SetIEFavoritesRoot(ieFavoritesURL);#endif#ifdef	XP_BEOS		nsSpecialSystemDirectory	netPositiveFile(nsSpecialSystemDirectory::BeOS_SettingsDirectory);		nsFileURL			netPositiveURLSpec(netPositiveFile);		// XXX Currently hard-coded; does the BeOS have anything like a		// system registry which we could use to get this instead?		netPositiveURLSpec += "NetPositive/Bookmarks/";		const char			*constNetPositiveURL = netPositiveURLSpec.GetAsString();		if (constNetPositiveURL)		{			netPositiveURL = strdup(constNetPositiveURL);		}		parser.SetIEFavoritesRoot(netPositiveURL);#endif		parser.Parse(kNC_BookmarksRoot, kNC_Bookmark);		mBookmarksAvailable = PR_TRUE;		parser.ParserFoundIEFavoritesRoot(&foundIERoot);	} // <-- scope the stream to get the open/close automatically.		// look for and import any IE Favorites	nsAutoString	ieTitle("Imported IE Favorites");			// XXX localization?#ifdef	XP_BEOS	nsAutoString	netPositiveTitle("Imported NetPositive Bookmarks");	// XXX localization?#endif#ifdef	XP_MAC	nsSpecialSystemDirectory ieFavoritesFile(nsSpecialSystemDirectory::Mac_PreferencesDirectory);	ieFavoritesFile += "Explorer";	ieFavoritesFile += "Favorites.html";	nsInputFileStream	ieStream(ieFavoritesFile);	if (ieStream.is_open())	{		if (NS_SUCCEEDED(rv = gRDFC->MakeSeq(mInner, kNC_IEFavoritesRoot, nsnull)))		{			BookmarkParser parser;			parser.Init(&ieStream, mInner);			parser.Parse(kNC_IEFavoritesRoot, kNC_IEFavorite);							nsCOMPtr<nsIRDFLiteral>	ieTitleLiteral;			rv = gRDF->GetLiteral(ieTitle.GetUnicode(), getter_AddRefs(ieTitleLiteral));			if (NS_SUCCEEDED(rv) && ieTitleLiteral)			{				rv = mInner->Assert(kNC_IEFavoritesRoot, kNC_Name, ieTitleLiteral, PR_TRUE);			}							// if the IE Favorites root isn't somewhere in bookmarks.html, add it			if (!foundIERoot)			{				nsCOMPtr<nsIRDFContainer> bookmarksRoot;				rv = nsComponentManager::CreateInstance(kRDFContainerCID,									nsnull,									nsIRDFContainer::GetIID(),									getter_AddRefs(bookmarksRoot));				if (NS_FAILED(rv)) return rv;				rv = bookmarksRoot->Init(mInner, kNC_BookmarksRoot);				if (NS_FAILED(rv)) return rv;				rv = bookmarksRoot->AppendElement(kNC_IEFavoritesRoot);				if (NS_FAILED(rv)) return rv;			}		}	}#endif#ifdef	XP_WIN	rv = gRDF->GetResource(ieFavoritesURL, getter_AddRefs(ieFolder));	if (NS_SUCCEEDED(rv))	{		nsCOMPtr<nsIRDFLiteral>	ieTitleLiteral;		rv = gRDF->GetLiteral(ieTitle.GetUnicode(), getter_AddRefs(ieTitleLiteral));		if (NS_SUCCEEDED(rv) && ieTitleLiteral)		{			rv = mInner->Assert(ieFolder, kNC_Name, ieTitleLiteral, PR_TRUE);		}		// if the IE Favorites root isn't somewhere in bookmarks.html, add it		if (!foundIERoot)		{			nsCOMPtr<nsIRDFContainer> container;			rv = nsComponentManager::CreateInstance(kRDFContainerCID,								nsnull,								nsIRDFContainer::GetIID(),								getter_AddRefs(container));			if (NS_FAILED(rv)) return rv;			rv = container->Init(mInner, kNC_BookmarksRoot);			if (NS_FAILED(rv)) return rv;			rv = container->AppendElement(ieFolder);			if (NS_FAILED(rv)) return rv;		}	}	if (ieFavoritesURL)	{		free(ieFavoritesURL);		ieFavoritesURL = nsnull;	}#endif#ifdef	XP_BEOS	rv = gRDF->GetResource(netPositiveURL, getter_AddRefs(netPositiveFolder));	if (NS_SUCCEEDED(rv))	{		nsCOMPtr<nsIRDFLiteral>	netPositiveTitleLiteral;		rv = gRDF->GetLiteral(netPositiveTitle.GetUnicode(), getter_AddRefs(netPositiveTitleLiteral));		if (NS_SUCCEEDED(rv) && netPositiveTitleLiteral)		{			rv = mInner->Assert(netPositiveFolder, kNC_Name, netPositiveTitleLiteral, PR_TRUE);		}		// if the Favorites root isn't somewhere in bookmarks.html, add it		if (!foundIERoot)		{			nsCOMPtr<nsIRDFContainer> container;			rv = nsComponentManager::CreateInstance(kRDFContainerCID,								nsnull,								nsIRDFContainer::GetIID(),								getter_AddRefs(container));			if (NS_FAILED(rv)) return rv;			rv = container->Init(mInner, kNC_BookmarksRoot);			if (NS_FAILED(rv)) return rv;			rv = container->AppendElement(netPositiveFolder);			if (NS_FAILED(rv)) return rv;		}	}	if (netPositiveURL)	{		free(netPositiveURL);		netPositiveURL = nsnull;	}#endif#ifdef	DEBUG	PRTime		now2;#ifdef	XP_MAC	Microseconds((UnsignedWide *)&now2);#else	now2 = PR_Now();#endif	PRUint64	loadTime64;	LL_SUB(loadTime64, now2, now);	PRUint32	loadTime32;	LL_L2UI(loadTime32, loadTime64);	printf("Finished reading in bookmarks.html  (%u microseconds)\n", loadTime32);#endif	return NS_OK;	}