зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
74fc4f9f0f
Коммит
f111ce79a7
|
@ -62,12 +62,12 @@ interface nsIBookmarksService : nsISupports
|
|||
in long aIndex);
|
||||
|
||||
nsIRDFResource createBookmark(in wstring aName,
|
||||
in string aURL,
|
||||
in wstring aURL,
|
||||
in wstring aShortcutURL,
|
||||
in wstring aDescription,
|
||||
in wstring aDocCharSet);
|
||||
nsIRDFResource createBookmarkInContainer(in wstring aName,
|
||||
in string aURL,
|
||||
in wstring aURL,
|
||||
in wstring aShortcutURL,
|
||||
in wstring aDescription,
|
||||
in wstring aDocCharSet,
|
||||
|
@ -95,7 +95,7 @@ interface nsIBookmarksService : nsISupports
|
|||
readonly attribute nsITransactionManager transactionManager;
|
||||
|
||||
//XXXpch: to be removed.
|
||||
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);
|
||||
boolean isBookmarked(in string aURL);
|
||||
|
||||
};
|
||||
|
|
|
@ -2515,7 +2515,7 @@ nsBookmarksService::GetURLFromResource(nsIRDFResource* aResource,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
||||
const char* aURL,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aShortcutURL,
|
||||
const PRUnichar* aDescription,
|
||||
const PRUnichar* aDocCharSet,
|
||||
|
@ -2552,7 +2552,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
|||
|
||||
// Resource: URL
|
||||
nsAutoString url;
|
||||
url.AssignWithConversion(aURL);
|
||||
url.Assign(aURL);
|
||||
nsCOMPtr<nsIRDFLiteral> urlLiteral;
|
||||
rv = gRDF->GetLiteral(url.get(), getter_AddRefs(urlLiteral));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -2614,7 +2614,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::CreateBookmarkInContainer(const PRUnichar* aName,
|
||||
const char* aURL,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aShortcutURL,
|
||||
const PRUnichar* aDescription,
|
||||
const PRUnichar* aDocCharSet,
|
||||
|
@ -2782,7 +2782,7 @@ nsBookmarksService::GetParentChain(nsIRDFResource* aSource, nsIArray** aParents)
|
|||
//to be removed RSN
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::AddBookmarkImmediately(const char *aURI,
|
||||
nsBookmarksService::AddBookmarkImmediately(const PRUnichar *aURI,
|
||||
const PRUnichar *aTitle,
|
||||
PRInt32 aBookmarkType,
|
||||
const PRUnichar *aCharset)
|
||||
|
|
|
@ -1150,8 +1150,14 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
|
|||
nsXPIDLString keywordDesc;
|
||||
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
|
||||
descStrings, 2, getter_Copies(keywordDesc));
|
||||
// XXX: Assume Windows stores URLs in ASCII (with everything escaped).
|
||||
// It may change in the future, but we can't assume that it's UTF-8
|
||||
// here. Unlike other places, it's likely to be in a legacy encoding.
|
||||
// Assuming ASCII at least works for Latin-1 if URLs are stored
|
||||
// without being escaped and Win32 supports IDN (it doesn't at the
|
||||
// moment.) Eventually, we have to use 'W' APIs when available.
|
||||
bms->CreateBookmarkInContainer(keywordName.get(),
|
||||
(char*)url,
|
||||
NS_ConvertASCIItoUTF16(url).get(),
|
||||
keyword.get(),
|
||||
keywordDesc.get(),
|
||||
NS_LITERAL_STRING("").get(),
|
||||
|
@ -1272,8 +1278,12 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
|
|||
bookmarkName.Truncate(lnkExtStart);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
// Here it's assumed that NS_GetURLSpecFromFile returns spec in UTF-8.
|
||||
// It is very likely to be ASCII (with everything escaped beyond file://),
|
||||
// but we don't lose much assuming that it's UTF-8. This is not perf.
|
||||
// critical.
|
||||
aBookmarksService->CreateBookmarkInContainer(bookmarkName.get(),
|
||||
spec.get(),
|
||||
NS_ConvertUTF8toUTF16(spec).get(),
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull,
|
||||
|
@ -1337,8 +1347,13 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
|
|||
ResolveShortcut(path, getter_Copies(resolvedURL));
|
||||
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
// As far as I can tell reading the MSDN API document,
|
||||
// IUniformResourceLocator::GetURL (used by ResolveShortcut) returns a
|
||||
// URL in ASCII (with non-ASCII characters escaped) and it doesn't yet
|
||||
// support IDN (i18n) hostname. However, it may in the future so that
|
||||
// using UTF8toUTF16 wouldn't be a bad idea.
|
||||
rv = aBookmarksService->CreateBookmarkInContainer(name.get(),
|
||||
resolvedURL.get(),
|
||||
NS_ConvertUTF8toUTF16(resolvedURL).get(),
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull,
|
||||
|
|
|
@ -1118,9 +1118,13 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
|
|||
aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
|
||||
descStrings, 2, getter_Copies(keywordDesc));
|
||||
|
||||
// XXX We don't know for sure how Opera deals with IDN hostnames in URL.
|
||||
// Assuming it's in UTF-8 is rather safe because it covers two cases
|
||||
// (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
|
||||
// multibyte encoding).
|
||||
rv = aBMS->CreateBookmarkInContainer(nameStr.get(),
|
||||
url.get(),
|
||||
NS_ConvertUTF8toUCS2(keyword).get(),
|
||||
NS_ConvertUTF8toUTF16(url).get(),
|
||||
NS_ConvertUTF8toUTF16(keyword).get(),
|
||||
keywordDesc.get(),
|
||||
nsnull,
|
||||
keywordsFolder,
|
||||
|
@ -1265,11 +1269,15 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
|
|||
onToolbar = PR_TRUE;
|
||||
break;
|
||||
case LineType_NL: {
|
||||
// XXX We don't know for sure how Opera deals with IDN hostnames in URL.
|
||||
// Assuming it's in UTF-8 is rather safe because it covers two cases
|
||||
// (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
|
||||
// multibyte encoding).
|
||||
nsCOMPtr<nsIRDFResource> itemRes;
|
||||
if (entryType == EntryType_BOOKMARK) {
|
||||
if (!name.IsEmpty() && !url.IsEmpty()) {
|
||||
rv = aBMS->CreateBookmarkInContainer(name.get(),
|
||||
url.get(),
|
||||
NS_ConvertUTF8toUTF16(url).get(),
|
||||
keyword.get(),
|
||||
description.get(),
|
||||
nsnull,
|
||||
|
|
|
@ -60,7 +60,7 @@ interface nsIBookmarksService : nsISupports
|
|||
boolean isBookmarked(in string aURL);
|
||||
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 createFolderInContainer(in wstring aName, in nsIRDFResource aParentFolder,
|
||||
|
@ -77,12 +77,12 @@ interface nsIBookmarksService : nsISupports
|
|||
in boolean aRecurse);
|
||||
|
||||
nsIRDFResource createBookmark(in wstring aName,
|
||||
in string aURL,
|
||||
in wstring aURL,
|
||||
in wstring aShortcutURL,
|
||||
in wstring aDescription,
|
||||
in wstring aDocCharSet);
|
||||
nsIRDFResource createBookmarkInContainer(in wstring aName,
|
||||
in string aURL,
|
||||
in wstring aURL,
|
||||
in wstring aShortcutURL,
|
||||
in wstring aDescription,
|
||||
in wstring aDocCharSet,
|
||||
|
|
|
@ -3082,7 +3082,7 @@ nsBookmarksService::SetNewPersonalToolbarFolder(nsIRDFResource* aFolder)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
||||
const char* aURL,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aShortcutURL,
|
||||
const PRUnichar* aDescription,
|
||||
const PRUnichar* aDocCharSet,
|
||||
|
@ -3119,7 +3119,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
|||
|
||||
// Resource: URL
|
||||
nsAutoString url;
|
||||
url.AssignWithConversion(aURL);
|
||||
url.Assign(aURL);
|
||||
nsCOMPtr<nsIRDFLiteral> urlLiteral;
|
||||
rv = gRDF->GetLiteral(url.get(), getter_AddRefs(urlLiteral));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -3181,7 +3181,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::CreateBookmarkInContainer(const PRUnichar* aName,
|
||||
const char* aURL,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aShortcutURL,
|
||||
const PRUnichar* aDescription,
|
||||
const PRUnichar* aDocCharSet,
|
||||
|
@ -3275,7 +3275,7 @@ nsBookmarksService::CloneResource(nsIRDFResource* aSource,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::AddBookmarkImmediately(const char *aURI,
|
||||
nsBookmarksService::AddBookmarkImmediately(const PRUnichar *aURI,
|
||||
const PRUnichar *aTitle,
|
||||
PRInt32 aBookmarkType,
|
||||
const PRUnichar *aCharset)
|
||||
|
@ -3853,8 +3853,14 @@ nsBookmarksService::ParseFavoritesFolder(nsIFile* aDirectory, nsIRDFResource* aP
|
|||
bookmarkName.Truncate(lnkExtStart);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
CreateBookmarkInContainer(bookmarkName.get(), spec.get(), nsnull,
|
||||
nsnull, nsnull, aParentResource, -1, getter_AddRefs(bookmark));
|
||||
// NS_GetURLSpecFromFile on Windows returns url-escaped URL in
|
||||
// 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))
|
||||
continue;
|
||||
}
|
||||
|
@ -3889,7 +3895,15 @@ nsBookmarksService::ParseFavoritesFolder(nsIFile* aDirectory, nsIRDFResource* aP
|
|||
ResolveShortcut(path, getter_Copies(resolvedURL));
|
||||
|
||||
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))
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1918,7 +1918,8 @@ InternetSearchDataSource::addToBookmarks(nsIRDFResource *src)
|
|||
char *uri = getSearchURI(src);
|
||||
if (uri)
|
||||
{
|
||||
rv = bookmarks->AddBookmarkImmediately(uri, name, nsIBookmarksService::BOOKMARK_SEARCH_TYPE, nsnull);
|
||||
rv = bookmarks->AddBookmarkImmediately(NS_ConvertUTF8toUTF16(uri).get(),
|
||||
name, nsIBookmarksService::BOOKMARK_SEARCH_TYPE, nsnull);
|
||||
Recycle(uri);
|
||||
}
|
||||
}
|
||||
|
@ -1981,11 +1982,8 @@ InternetSearchDataSource::addQueryToBookmarks(nsIRDFResource *src)
|
|||
{
|
||||
nsCOMPtr<nsIBookmarksService> bookmarks (do_QueryInterface(datasource));
|
||||
if (bookmarks)
|
||||
{
|
||||
nsXPIDLCString uriUTF8;
|
||||
uriUTF8.Adopt(ToNewUTF8String(nsDependentString(uriUni)));
|
||||
rv = bookmarks->AddBookmarkImmediately((const char *)uriUTF8, value.get(), nsIBookmarksService::BOOKMARK_SEARCH_TYPE, nsnull);
|
||||
}
|
||||
rv = bookmarks->AddBookmarkImmediately(uriUni, value.get(),
|
||||
nsIBookmarksService::BOOKMARK_SEARCH_TYPE, nsnull);
|
||||
}
|
||||
|
||||
return(NS_OK);
|
||||
|
|
Загрузка…
Ссылка в новой задаче