bug 191053 : relanding the original patch + ben's firefox patch + additional patch (sr=bz for additional changes to fix Windows bustage)

This commit is contained in:
jshin%mailaps.org 2007-09-12 17:51:16 +00:00
Родитель 04065c1e24
Коммит bdb26abe73
2 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -60,7 +60,7 @@ interface nsIBookmarksService : nsISupports
boolean isBookmarked(in string aURL); boolean isBookmarked(in string aURL);
boolean isBookmarkedResource(in nsIRDFResource aSource); boolean isBookmarkedResource(in nsIRDFResource aSource);
void addBookmarkImmediately(in string aURI, in wstring aTitle, in long bmType, in wstring docCharset); void addBookmarkImmediately(in wstring aURI, in wstring aTitle, in long bmType, in wstring docCharset);
nsIRDFResource createFolder(in wstring aName); nsIRDFResource createFolder(in wstring aName);
nsIRDFResource createFolderInContainer(in wstring aName, in nsIRDFResource aParentFolder, nsIRDFResource createFolderInContainer(in wstring aName, in nsIRDFResource aParentFolder,
@ -77,12 +77,12 @@ interface nsIBookmarksService : nsISupports
in boolean aRecurse); in boolean aRecurse);
nsIRDFResource createBookmark(in wstring aName, nsIRDFResource createBookmark(in wstring aName,
in string aURL, in wstring aURL,
in wstring aShortcutURL, in wstring aShortcutURL,
in wstring aDescription, in wstring aDescription,
in wstring aDocCharSet); in wstring aDocCharSet);
nsIRDFResource createBookmarkInContainer(in wstring aName, nsIRDFResource createBookmarkInContainer(in wstring aName,
in string aURL, in wstring aURL,
in wstring aShortcutURL, in wstring aShortcutURL,
in wstring aDescription, in wstring aDescription,
in wstring aDocCharSet, in wstring aDocCharSet,

Просмотреть файл

@ -3082,7 +3082,7 @@ nsBookmarksService::SetNewPersonalToolbarFolder(nsIRDFResource* aFolder)
NS_IMETHODIMP NS_IMETHODIMP
nsBookmarksService::CreateBookmark(const PRUnichar* aName, nsBookmarksService::CreateBookmark(const PRUnichar* aName,
const char* aURL, const PRUnichar* aURL,
const PRUnichar* aShortcutURL, const PRUnichar* aShortcutURL,
const PRUnichar* aDescription, const PRUnichar* aDescription,
const PRUnichar* aDocCharSet, const PRUnichar* aDocCharSet,
@ -3119,7 +3119,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
// Resource: URL // Resource: URL
nsAutoString url; nsAutoString url;
url.AssignWithConversion(aURL); url.Assign(aURL);
nsCOMPtr<nsIRDFLiteral> urlLiteral; nsCOMPtr<nsIRDFLiteral> urlLiteral;
rv = gRDF->GetLiteral(url.get(), getter_AddRefs(urlLiteral)); rv = gRDF->GetLiteral(url.get(), getter_AddRefs(urlLiteral));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
@ -3181,7 +3181,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
NS_IMETHODIMP NS_IMETHODIMP
nsBookmarksService::CreateBookmarkInContainer(const PRUnichar* aName, nsBookmarksService::CreateBookmarkInContainer(const PRUnichar* aName,
const char* aURL, const PRUnichar* aURL,
const PRUnichar* aShortcutURL, const PRUnichar* aShortcutURL,
const PRUnichar* aDescription, const PRUnichar* aDescription,
const PRUnichar* aDocCharSet, const PRUnichar* aDocCharSet,
@ -3275,7 +3275,7 @@ nsBookmarksService::CloneResource(nsIRDFResource* aSource,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBookmarksService::AddBookmarkImmediately(const char *aURI, nsBookmarksService::AddBookmarkImmediately(const PRUnichar *aURI,
const PRUnichar *aTitle, const PRUnichar *aTitle,
PRInt32 aBookmarkType, PRInt32 aBookmarkType,
const PRUnichar *aCharset) const PRUnichar *aCharset)
@ -3853,8 +3853,14 @@ nsBookmarksService::ParseFavoritesFolder(nsIFile* aDirectory, nsIRDFResource* aP
bookmarkName.Truncate(lnkExtStart); bookmarkName.Truncate(lnkExtStart);
nsCOMPtr<nsIRDFResource> bookmark; nsCOMPtr<nsIRDFResource> bookmark;
CreateBookmarkInContainer(bookmarkName.get(), spec.get(), nsnull, // NS_GetURLSpecFromFile on Windows returns url-escaped URL in
nsnull, nsnull, aParentResource, -1, getter_AddRefs(bookmark)); // pure ASCII. However, in the future, we may return 'hostpart'
// of a remote file in UTF-8. Therefore, using UTF-8 in place of
// ASCII is not a bad idea.
CreateBookmarkInContainer(bookmarkName.get(),
NS_ConvertUTF8toUTF16(spec).get(),
nsnull, nsnull, nsnull, aParentResource,
-1, getter_AddRefs(bookmark));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
continue; continue;
} }
@ -3889,7 +3895,15 @@ nsBookmarksService::ParseFavoritesFolder(nsIFile* aDirectory, nsIRDFResource* aP
ResolveShortcut(path, getter_Copies(resolvedURL)); ResolveShortcut(path, getter_Copies(resolvedURL));
nsCOMPtr<nsIRDFResource> bookmark; nsCOMPtr<nsIRDFResource> bookmark;
rv = CreateBookmarkInContainer(name.get(), resolvedURL.get(), nsnull, nsnull, nsnull, aParentResource, -1, getter_AddRefs(bookmark)); // As far as I can tell, IUniformResourceLocator::GetURL()
// returns the URL in pure ASCII. However, it could be UTF-8 (I'm
// almost sure that it's not in any legacy encoding) so that I'm
// assuming it's in UTF-8.
// http://msdn.microsoft.com/library/default.asp?url=/workshop/misc/shortcuts/reference/iuniformresourcelocator.asp
rv = CreateBookmarkInContainer(name.get(),
NS_ConvertUTF8toUTF16(resolvedURL).get(),
nsnull, nsnull, nsnull, aParentResource, -1,
getter_AddRefs(bookmark));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
continue; continue;
} }