зеркало из https://github.com/mozilla/pjs.git
Bug 497563 - Crashes [@ BindStatementURI] (r=sdwilsh)
* * *
This commit is contained in:
Родитель
2e9bc4f075
Коммит
0595737b80
|
@ -1088,11 +1088,13 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
|
|||
if (GetDictionaryStringValue(URIDictionary, CFSTR("title"), title) &&
|
||||
GetDictionaryCStringValue(entry, CFSTR("URLString"), url, kCFStringEncodingUTF8)) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv |= NS_NewURI(getter_AddRefs(uri), url);
|
||||
PRInt64 id;
|
||||
rv |= aBookmarksService->InsertBookmark(aParentFolder, uri,
|
||||
nsINavBookmarksService::DEFAULT_INDEX,
|
||||
NS_ConvertUTF16toUTF8(title), &id);
|
||||
rv = NS_NewURI(getter_AddRefs(uri), url);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt64 id;
|
||||
rv = aBookmarksService->InsertBookmark(aParentFolder, uri,
|
||||
nsINavBookmarksService::DEFAULT_INDEX,
|
||||
NS_ConvertUTF16toUTF8(title), &id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -849,7 +849,7 @@ placesEditBookmarkPostDataTransactions.prototype = {
|
|||
__proto__: placesBaseTransaction.prototype,
|
||||
|
||||
doTransaction: function PEUPDT_doTransaction() {
|
||||
this._oldPostData = PlacesUtils.getPostDataForBookmark(this._id);
|
||||
this._oldPostData = PlacesUtils.getPostDataForBookmark(this.id);
|
||||
PlacesUtils.setPostDataForBookmark(this.id, this._newPostData);
|
||||
},
|
||||
|
||||
|
|
|
@ -336,6 +336,7 @@ nsAnnotationService::SetPageAnnotation(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG(aValue);
|
||||
|
||||
PRUint16 dataType;
|
||||
|
@ -408,6 +409,7 @@ nsAnnotationService::SetItemAnnotation(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG(aValue);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
|
@ -485,6 +487,8 @@ nsAnnotationService::SetPageAnnotationString(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -510,6 +514,8 @@ nsAnnotationService::SetItemAnnotationString(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -565,6 +571,8 @@ nsAnnotationService::SetPageAnnotationInt32(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -589,6 +597,8 @@ nsAnnotationService::SetItemAnnotationInt32(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -644,6 +654,8 @@ nsAnnotationService::SetPageAnnotationInt64(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -668,6 +680,8 @@ nsAnnotationService::SetItemAnnotationInt64(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -723,6 +737,8 @@ nsAnnotationService::SetPageAnnotationDouble(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -747,6 +763,8 @@ nsAnnotationService::SetItemAnnotationDouble(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -809,6 +827,8 @@ nsAnnotationService::SetPageAnnotationBinary(nsIURI* aURI,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -833,6 +853,8 @@ nsAnnotationService::SetItemAnnotationBinary(PRInt64 aItemId,
|
|||
PRInt32 aFlags,
|
||||
PRUint16 aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -859,6 +881,8 @@ nsAnnotationService::GetPageAnnotationString(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
nsAString& _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -876,6 +900,8 @@ nsAnnotationService::GetItemAnnotationString(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
nsAString& _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -891,6 +917,8 @@ nsAnnotationService::GetPageAnnotation(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
nsIVariant** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
*_retval = nsnull;
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -934,6 +962,9 @@ nsAnnotationService::GetItemAnnotation(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
nsIVariant** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -979,6 +1010,8 @@ nsAnnotationService::GetPageAnnotationInt32(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -996,6 +1029,8 @@ nsAnnotationService::GetItemAnnotationInt32(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1012,6 +1047,8 @@ nsAnnotationService::GetPageAnnotationInt64(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
PRInt64 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ENSURE_ANNO_TYPE(TYPE_INT64, mDBGetAnnotationFromURI)
|
||||
|
@ -1027,6 +1064,8 @@ nsAnnotationService::GetItemAnnotationInt64(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
PRInt64 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ENSURE_ANNO_TYPE(TYPE_INT64, mDBGetAnnotationFromItemId)
|
||||
|
@ -1042,6 +1081,9 @@ nsAnnotationService::GetPageAnnotationType(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
PRUint16* _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*_retval = mDBGetAnnotationFromURI->AsInt32(kAnnoIndex_Type);
|
||||
|
@ -1056,6 +1098,8 @@ nsAnnotationService::GetItemAnnotationType(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
PRUint16* _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*_retval = mDBGetAnnotationFromItemId->AsInt32(kAnnoIndex_Type);
|
||||
|
@ -1070,6 +1114,9 @@ nsAnnotationService::GetPageAnnotationDouble(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
double *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1086,6 +1133,8 @@ nsAnnotationService::GetItemAnnotationDouble(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
double *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1104,6 +1153,10 @@ nsAnnotationService::GetPageAnnotationBinary(nsIURI* aURI,
|
|||
PRUint32* aDataLen,
|
||||
nsACString& aMimeType)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aData);
|
||||
NS_ENSURE_ARG_POINTER(aDataLen);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1127,6 +1180,9 @@ nsAnnotationService::GetItemAnnotationBinary(PRInt64 aItemId,
|
|||
PRUint32* aDataLen,
|
||||
nsACString& aMimeType)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aData);
|
||||
NS_ENSURE_ARG_POINTER(aDataLen);
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1151,6 +1207,11 @@ nsAnnotationService::GetPageAnnotationInfo(nsIURI* aURI,
|
|||
nsACString& aMimeType,
|
||||
PRUint16 *aStorageType)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aFlags);
|
||||
NS_ENSURE_ARG_POINTER(aExpiration);
|
||||
NS_ENSURE_ARG_POINTER(aStorageType);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1181,6 +1242,11 @@ nsAnnotationService::GetItemAnnotationInfo(PRInt64 aItemId,
|
|||
nsACString& aMimeType,
|
||||
PRUint16 *aStorageType)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aFlags);
|
||||
NS_ENSURE_ARG_POINTER(aExpiration);
|
||||
NS_ENSURE_ARG_POINTER(aStorageType);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1285,6 +1351,9 @@ nsAnnotationService::GetItemsWithAnnotation(const nsACString& aName,
|
|||
PRUint32* aResultCount,
|
||||
PRInt64** aResults)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResultCount);
|
||||
NS_ENSURE_ARG_POINTER(aResults);
|
||||
|
||||
if (aName.IsEmpty() || !aResultCount || !aResults)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -1332,6 +1401,10 @@ NS_IMETHODIMP
|
|||
nsAnnotationService::GetPageAnnotationNames(nsIURI* aURI, PRUint32* aCount,
|
||||
nsIVariant*** _result)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
NS_ENSURE_ARG_POINTER(_result);
|
||||
|
||||
*aCount = 0;
|
||||
*_result = nsnull;
|
||||
|
||||
|
@ -1404,6 +1477,10 @@ NS_IMETHODIMP
|
|||
nsAnnotationService::GetItemAnnotationNames(PRInt64 aItemId, PRUint32* aCount,
|
||||
nsIVariant*** _result)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
NS_ENSURE_ARG_POINTER(_result);
|
||||
|
||||
*aCount = 0;
|
||||
*_result = nsnull;
|
||||
|
||||
|
@ -1442,6 +1519,9 @@ nsAnnotationService::PageHasAnnotation(nsIURI* aURI,
|
|||
const nsACString& aName,
|
||||
PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromURI(aURI, aName);
|
||||
if (rv == NS_ERROR_NOT_AVAILABLE) {
|
||||
*_retval = PR_FALSE;
|
||||
|
@ -1461,6 +1541,9 @@ nsAnnotationService::ItemHasAnnotation(PRInt64 aItemId,
|
|||
const nsACString& aName,
|
||||
PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = StartGetAnnotationFromItemId(aItemId, aName);
|
||||
if (rv == NS_ERROR_NOT_AVAILABLE) {
|
||||
*_retval = PR_FALSE;
|
||||
|
@ -1507,6 +1590,8 @@ NS_IMETHODIMP
|
|||
nsAnnotationService::RemovePageAnnotation(nsIURI* aURI,
|
||||
const nsACString& aName)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
PRInt64 placeId;
|
||||
nsresult rv = GetPlaceIdForURI(aURI, &placeId, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1529,6 +1614,8 @@ NS_IMETHODIMP
|
|||
nsAnnotationService::RemoveItemAnnotation(PRInt64 aItemId,
|
||||
const nsACString& aName)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = RemoveAnnotationInternal(aItemId, PR_TRUE, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1548,6 +1635,8 @@ nsAnnotationService::RemoveItemAnnotation(PRInt64 aItemId,
|
|||
NS_IMETHODIMP
|
||||
nsAnnotationService::RemovePageAnnotations(nsIURI* aURI)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
PRInt64 placeId;
|
||||
nsresult rv = GetPlaceIdForURI(aURI, &placeId, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1577,6 +1666,8 @@ nsAnnotationService::RemovePageAnnotations(nsIURI* aURI)
|
|||
NS_IMETHODIMP
|
||||
nsAnnotationService::RemoveItemAnnotations(PRInt64 aItemId)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> statement;
|
||||
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"DELETE FROM moz_items_annos WHERE item_id = ?1"),
|
||||
|
@ -1614,6 +1705,9 @@ nsAnnotationService::CopyPageAnnotations(nsIURI* aSourceURI,
|
|||
nsIURI* aDestURI,
|
||||
PRBool aOverwriteDest)
|
||||
{
|
||||
NS_ENSURE_ARG(aSourceURI);
|
||||
NS_ENSURE_ARG(aDestURI);
|
||||
|
||||
if (InPrivateBrowsingMode())
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1725,6 +1819,8 @@ nsAnnotationService::CopyItemAnnotations(PRInt64 aSourceItemId,
|
|||
NS_IMETHODIMP
|
||||
nsAnnotationService::AddObserver(nsIAnnotationObserver* aObserver)
|
||||
{
|
||||
NS_ENSURE_ARG(aObserver);
|
||||
|
||||
if (mObservers.IndexOfObject(aObserver) >= 0)
|
||||
return NS_ERROR_INVALID_ARG; // already registered
|
||||
if (!mObservers.AppendObject(aObserver))
|
||||
|
@ -1738,6 +1834,8 @@ nsAnnotationService::AddObserver(nsIAnnotationObserver* aObserver)
|
|||
NS_IMETHODIMP
|
||||
nsAnnotationService::RemoveObserver(nsIAnnotationObserver* aObserver)
|
||||
{
|
||||
NS_ENSURE_ARG(aObserver);
|
||||
|
||||
if (!mObservers.RemoveObject(aObserver))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
return NS_OK;
|
||||
|
|
|
@ -305,8 +305,8 @@ nsFaviconService::ExpireAllFavicons()
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(aFaviconURI);
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
if (mExpirationRunning)
|
||||
return NS_OK;
|
||||
|
@ -326,6 +326,8 @@ nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI)
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::GetDefaultFavicon(nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
// not found, use default
|
||||
if (!mDefaultIcon) {
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(mDefaultIcon),
|
||||
|
@ -503,8 +505,8 @@ nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
|
|||
nsIURI* aFaviconURI,
|
||||
PRBool aForceReload)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(aFaviconURI);
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
if (mExpirationRunning)
|
||||
return NS_OK;
|
||||
|
@ -681,6 +683,8 @@ nsFaviconService::SetFaviconData(nsIURI* aFaviconURI, const PRUint8* aData,
|
|||
PRUint32 aDataLen, const nsACString& aMimeType,
|
||||
PRTime aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
if (mExpirationRunning)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -754,6 +758,7 @@ nsFaviconService::SetFaviconDataFromDataURL(nsIURI* aFaviconURI,
|
|||
const nsAString& aDataURL,
|
||||
PRTime aExpiration)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
if (mExpirationRunning)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -814,6 +819,10 @@ NS_IMETHODIMP
|
|||
nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType,
|
||||
PRUint32* aDataLen, PRUint8** aData)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
NS_ENSURE_ARG_POINTER(aDataLen);
|
||||
NS_ENSURE_ARG_POINTER(aData);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetData);
|
||||
nsresult rv = BindStatementURI(mDBGetData, 0, aFaviconURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -835,13 +844,13 @@ NS_IMETHODIMP
|
|||
nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
|
||||
nsAString& aDataURL)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
PRUint8* data;
|
||||
PRUint32 dataLen;
|
||||
nsCAutoString mimeType;
|
||||
|
||||
rv = GetFaviconData(aFaviconURI, mimeType, &dataLen, &data);
|
||||
nsresult rv = GetFaviconData(aFaviconURI, mimeType, &dataLen, &data);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!data) {
|
||||
|
@ -871,6 +880,9 @@ nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetURL);
|
||||
nsresult rv = BindStatementURI(mDBGetURL, 0, aPageURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -892,6 +904,9 @@ nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconImageForPage(nsIURI* aPageURI, nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetURL);
|
||||
nsresult rv = BindStatementURI(mDBGetURL, 0, aPageURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -923,6 +938,9 @@ nsresult
|
|||
nsFaviconService::GetFaviconLinkForIcon(nsIURI* aFaviconURI,
|
||||
nsIURI** aOutputURI)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
NS_ENSURE_ARG_POINTER(aOutputURI);
|
||||
|
||||
nsCAutoString spec;
|
||||
if (aFaviconURI) {
|
||||
nsresult rv = aFaviconURI->GetSpec(spec);
|
||||
|
@ -948,6 +966,8 @@ ExpireFailedFaviconsCallback(nsCStringHashKey::KeyType aKey,
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::AddFailedFavicon(nsIURI* aFaviconURI)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
nsCAutoString spec;
|
||||
nsresult rv = aFaviconURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -972,6 +992,8 @@ nsFaviconService::AddFailedFavicon(nsIURI* aFaviconURI)
|
|||
NS_IMETHODIMP
|
||||
nsFaviconService::RemoveFailedFavicon(nsIURI* aFaviconURI)
|
||||
{
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
nsCAutoString spec;
|
||||
nsresult rv = aFaviconURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -357,6 +357,9 @@ LivemarkService.prototype = {
|
|||
|
||||
createLivemark: function LS_createLivemark(aParentId, aName, aSiteURI,
|
||||
aFeedURI, aIndex) {
|
||||
if (!aParentId || !aFeedURI)
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Don't add livemarks to livemarks
|
||||
if (this.isLivemark(aParentId))
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
|
@ -374,6 +377,9 @@ LivemarkService.prototype = {
|
|||
createLivemarkFolderOnly:
|
||||
function LS_createLivemarkFolderOnly(aParentId, aName, aSiteURI,
|
||||
aFeedURI, aIndex) {
|
||||
if (aParentId < 1 || !aFeedURI)
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Don't add livemarks to livemarks
|
||||
if (this.isLivemark(aParentId))
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
|
@ -404,6 +410,8 @@ LivemarkService.prototype = {
|
|||
},
|
||||
|
||||
isLivemark: function LS_isLivemark(aFolderId) {
|
||||
if (aFolderId < 1)
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
return this._ans.itemHasAnnotation(aFolderId, LMANNO_FEEDURI);
|
||||
},
|
||||
|
||||
|
|
|
@ -1000,20 +1000,24 @@ nsNavBookmarks::GetUnfiledBookmarksFolder(PRInt64 *aRoot)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex,
|
||||
nsNavBookmarks::InsertBookmark(PRInt64 aFolder,
|
||||
nsIURI *aURI,
|
||||
PRInt32 aIndex,
|
||||
const nsACString& aTitle,
|
||||
PRInt64 *aNewBookmarkId)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aNewBookmarkId);
|
||||
|
||||
// You can pass -1 to indicate append, but no other negative number is allowed
|
||||
if (aIndex < nsINavBookmarksService::DEFAULT_INDEX)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
NS_ENSURE_ARG_POINTER(aNewBookmarkId);
|
||||
|
||||
mozStorageTransaction transaction(mDBConn, PR_FALSE);
|
||||
|
||||
// This is really a place ID
|
||||
PRInt64 childID;
|
||||
nsresult rv = History()->GetUrlIdFor(aItem, &childID, PR_TRUE);
|
||||
nsresult rv = History()->GetUrlIdFor(aURI, &childID, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 index;
|
||||
|
@ -1071,7 +1075,7 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex,
|
|||
// as livemarks feeds yet.
|
||||
|
||||
nsCAutoString url;
|
||||
rv = aItem->GetSpec(url);
|
||||
rv = aURI->GetSpec(url);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// prevent place: queries from showing up in the URL bar autocomplete results
|
||||
|
@ -1119,7 +1123,7 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex,
|
|||
// query for all bookmarks for that URI, notify for each
|
||||
nsTArray<PRInt64> bookmarks;
|
||||
|
||||
rv = GetBookmarkIdsForURITArray(aItem, &bookmarks);
|
||||
rv = GetBookmarkIdsForURITArray(aURI, &bookmarks);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (bookmarks.Length()) {
|
||||
|
@ -1247,6 +1251,9 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::CreateFolder(PRInt64 aParent, const nsACString &aName,
|
||||
PRInt32 aIndex, PRInt64 *aNewFolder)
|
||||
{
|
||||
// NOTE: aParent can be null for root creation, so not checked
|
||||
NS_ENSURE_ARG_POINTER(aNewFolder);
|
||||
|
||||
// CreateContainerWithID returns the index of the new folder, but that's not
|
||||
// used here. To avoid any risk of corrupting data should this function
|
||||
// be changed, we'll use a local variable to hold it. The PR_TRUE argument
|
||||
|
@ -1272,6 +1279,9 @@ nsNavBookmarks::CreateDynamicContainer(PRInt64 aParent, const nsACString &aName,
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetFolderReadonly(PRInt64 aFolder, PRBool *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aFolder, 1);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
|
||||
NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
|
||||
return annosvc->ItemHasAnnotation(aFolder, READ_ONLY_ANNO, aResult);
|
||||
|
@ -1280,6 +1290,8 @@ nsNavBookmarks::GetFolderReadonly(PRInt64 aFolder, PRBool *aResult)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetFolderReadonly(PRInt64 aFolder, PRBool aReadOnly)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aFolder, 1);
|
||||
|
||||
nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
|
||||
NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
|
||||
if (aReadOnly) {
|
||||
|
@ -1393,6 +1405,9 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::InsertSeparator(PRInt64 aParent, PRInt32 aIndex,
|
||||
PRInt64* aNewItemId)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aParent, 1);
|
||||
NS_ENSURE_ARG_POINTER(aNewItemId);
|
||||
|
||||
// You can pass -1 to indicate append, but no other negative number is
|
||||
// allowed
|
||||
if (aIndex < -1)
|
||||
|
@ -1480,6 +1495,9 @@ nsNavBookmarks::GetLastChildId(PRInt64 aFolder, PRInt64* aItemId)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetIdForItemAt(PRInt64 aFolder, PRInt32 aIndex, PRInt64* aItemId)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aFolder, 1);
|
||||
NS_ENSURE_ARG_POINTER(aItemId);
|
||||
|
||||
nsresult rv;
|
||||
if (aIndex == nsINavBookmarksService::DEFAULT_INDEX) {
|
||||
// we want the last item within aFolder
|
||||
|
@ -1512,6 +1530,8 @@ nsNavBookmarks::GetIdForItemAt(PRInt64 aFolder, PRInt32 aIndex, PRInt64* aItemId
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::RemoveChildAt(PRInt64 aParent, PRInt32 aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aParent, 1);
|
||||
|
||||
mozStorageTransaction transaction(mDBConn, PR_FALSE);
|
||||
nsresult rv;
|
||||
PRInt64 id;
|
||||
|
@ -1666,13 +1686,16 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
|
|||
NS_IMPL_ISUPPORTS1(nsNavBookmarks::RemoveFolderTransaction, nsITransaction)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetRemoveFolderTransaction(PRInt64 aFolder, nsITransaction** aResult)
|
||||
nsNavBookmarks::GetRemoveFolderTransaction(PRInt64 aFolderId, nsITransaction** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aFolderId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
// Create and initialize a RemoveFolderTransaction object that can be used to
|
||||
// recreate the folder safely later.
|
||||
|
||||
RemoveFolderTransaction* rft =
|
||||
new RemoveFolderTransaction(aFolder);
|
||||
new RemoveFolderTransaction(aFolderId);
|
||||
if (!rft)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -2098,6 +2121,8 @@ nsNavBookmarks::SetItemDateInternal(mozIStorageStatement* aStatement, PRInt64 aI
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetItemDateAdded(PRInt64 aItemId, PRTime aDateAdded)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = SetItemDateInternal(mDBSetItemDateAdded, aItemId, aDateAdded);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2110,6 +2135,7 @@ nsNavBookmarks::SetItemDateAdded(PRInt64 aItemId, PRTime aDateAdded)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemDateAdded(PRInt64 aItemId, PRTime *aDateAdded)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aDateAdded);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
@ -2129,6 +2155,8 @@ nsNavBookmarks::GetItemDateAdded(PRInt64 aItemId, PRTime *aDateAdded)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetItemLastModified(PRInt64 aItemId, PRTime aLastModified)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv = SetItemDateInternal(mDBSetItemLastModified, aItemId, aLastModified);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2141,6 +2169,7 @@ nsNavBookmarks::SetItemLastModified(PRInt64 aItemId, PRTime aLastModified)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemLastModified(PRInt64 aItemId, PRTime *aLastModified)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aLastModified);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
@ -2182,6 +2211,8 @@ nsNavBookmarks::GetGUIDBase(nsAString &aGUIDBase)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemGUID(PRInt64 aItemId, nsAString &aGUID)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
|
||||
NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsresult rv = annosvc->GetItemAnnotationString(aItemId, GUID_ANNO, aGUID);
|
||||
|
@ -2204,6 +2235,8 @@ nsNavBookmarks::GetItemGUID(PRInt64 aItemId, nsAString &aGUID)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetItemGUID(PRInt64 aItemId, const nsAString &aGUID)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
PRInt64 checkId;
|
||||
GetItemIdForGUID(aGUID, &checkId);
|
||||
if (checkId != -1)
|
||||
|
@ -2218,6 +2251,8 @@ nsNavBookmarks::SetItemGUID(PRInt64 aItemId, const nsAString &aGUID)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemIdForGUID(const nsAString &aGUID, PRInt64 *aItemId)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aItemId);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetItemIdForGUID);
|
||||
nsresult rv = mDBGetItemIdForGUID->BindStringParameter(0, aGUID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2236,6 +2271,8 @@ nsNavBookmarks::GetItemIdForGUID(const nsAString &aGUID, PRInt64 *aItemId)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetItemTitle(PRInt64 aItemId, const nsACString &aTitle)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> statement;
|
||||
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"UPDATE moz_bookmarks SET title = ?1, lastModified = ?2 WHERE id = ?3"),
|
||||
|
@ -2264,6 +2301,8 @@ nsNavBookmarks::SetItemTitle(PRInt64 aItemId, const nsACString &aTitle)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemTitle(PRInt64 aItemId, nsACString &aTitle)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
||||
nsresult rv = mDBGetItemProperties->BindInt64Parameter(0, aItemId);
|
||||
|
@ -2282,6 +2321,7 @@ nsNavBookmarks::GetItemTitle(PRInt64 aItemId, nsACString &aTitle)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetBookmarkURI(PRInt64 aItemId, nsIURI **aURI)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
@ -2312,6 +2352,9 @@ nsNavBookmarks::GetBookmarkURI(PRInt64 aItemId, nsIURI **aURI)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemType(PRInt64 aItemId, PRUint16 *aType)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aType);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
||||
nsresult rv = mDBGetItemProperties->BindInt64Parameter(0, aItemId);
|
||||
|
@ -2494,6 +2537,7 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::IsBookmarked(nsIURI *aURI, PRBool *aBookmarked)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aBookmarked);
|
||||
|
||||
nsNavHistory* history = History();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_UNEXPECTED);
|
||||
|
@ -2532,6 +2576,9 @@ nsNavBookmarks::IsBookmarked(nsIURI *aURI, PRBool *aBookmarked)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetBookmarkedURIFor(nsIURI* aURI, nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
|
||||
nsNavHistory* history = History();
|
||||
|
@ -2569,6 +2616,7 @@ nsNavBookmarks::GetBookmarkedURIFor(nsIURI* aURI, nsIURI** _retval)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI *aNewURI)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aBookmarkId, 1);
|
||||
NS_ENSURE_ARG(aNewURI);
|
||||
|
||||
mozStorageTransaction transaction(mDBConn, PR_FALSE);
|
||||
|
@ -2642,6 +2690,7 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI *aNewURI)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetFolderIdForItem(PRInt64 aItemId, PRInt64 *aFolderId)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aFolderId);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemProperties);
|
||||
|
@ -2667,6 +2716,9 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::GetBookmarkIdsForURITArray(nsIURI *aURI,
|
||||
nsTArray<PRInt64> *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
mozStorageStatementScoper scope(mDBFindURIBookmarks);
|
||||
|
||||
nsresult rv = BindStatementURI(mDBFindURIBookmarks, 0, aURI);
|
||||
|
@ -2688,6 +2740,10 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::GetBookmarkIdsForURI(nsIURI *aURI, PRUint32 *aCount,
|
||||
PRInt64 **aBookmarks)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
NS_ENSURE_ARG_POINTER(aBookmarks);
|
||||
|
||||
*aCount = 0;
|
||||
*aBookmarks = nsnull;
|
||||
nsTArray<PRInt64> bookmarks;
|
||||
|
@ -2713,6 +2769,9 @@ nsNavBookmarks::GetBookmarkIdsForURI(nsIURI *aURI, PRUint32 *aCount,
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetItemIndex(PRInt64 aItemId, PRInt32 *aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
|
||||
mozStorageStatementScoper scope(mDBGetItemIndex);
|
||||
mDBGetItemIndex->BindInt64Parameter(0, aItemId);
|
||||
PRBool results;
|
||||
|
@ -2730,6 +2789,8 @@ nsNavBookmarks::GetItemIndex(PRInt64 aItemId, PRInt32 *aIndex)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetItemIndex(PRInt64 aItemId, PRInt32 aNewIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||
|
||||
nsresult rv;
|
||||
PRInt32 oldIndex = 0;
|
||||
PRInt64 parent = 0;
|
||||
|
@ -2773,8 +2834,7 @@ nsNavBookmarks::SetItemIndex(PRInt64 aItemId, PRInt32 aNewIndex)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId, const nsAString& aKeyword)
|
||||
{
|
||||
if (aBookmarkId < 1)
|
||||
return NS_ERROR_INVALID_ARG; // invalid bookmark id
|
||||
NS_ENSURE_ARG_MIN(aBookmarkId, 1);
|
||||
|
||||
// Shortcuts are always lowercased internally.
|
||||
nsAutoString kwd(aKeyword);
|
||||
|
@ -2860,6 +2920,7 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId, const nsAString& aKey
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
aKeyword.Truncate(0);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetKeywordForURI);
|
||||
|
@ -2880,6 +2941,7 @@ nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetKeywordForBookmark(PRInt64 aBookmarkId, nsAString& aKeyword)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aBookmarkId, 1);
|
||||
aKeyword.Truncate(0);
|
||||
|
||||
mozStorageStatementScoper scoper(mDBGetKeywordForBookmark);
|
||||
|
@ -2900,6 +2962,7 @@ nsNavBookmarks::GetKeywordForBookmark(PRInt64 aBookmarkId, nsAString& aKeyword)
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::GetURIForKeyword(const nsAString& aKeyword, nsIURI** aURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
*aURI = nsnull;
|
||||
if (aKeyword.IsEmpty())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
@ -2958,7 +3021,7 @@ nsNavBookmarks::EndUpdateBatch()
|
|||
NS_IMETHODIMP
|
||||
nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
|
||||
nsISupports* aUserData) {
|
||||
NS_ENSURE_ARG_POINTER(aCallback);
|
||||
NS_ENSURE_ARG(aCallback);
|
||||
|
||||
BeginUpdateBatch();
|
||||
nsresult rv = aCallback->RunBatched(aUserData);
|
||||
|
@ -2971,6 +3034,7 @@ NS_IMETHODIMP
|
|||
nsNavBookmarks::AddObserver(nsINavBookmarkObserver *aObserver,
|
||||
PRBool aOwnsWeak)
|
||||
{
|
||||
NS_ENSURE_ARG(aObserver);
|
||||
return mObservers.AppendWeakElement(aObserver, aOwnsWeak);
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ TaggingService.prototype = {
|
|||
|
||||
// nsITaggingService
|
||||
getURIsForTag: function TS_getURIsForTag(aTag) {
|
||||
if (aTag.length == 0)
|
||||
if (!aTag || aTag.length == 0)
|
||||
throw Cr.NS_ERROR_INVALID_ARG;
|
||||
|
||||
var uris = [];
|
||||
|
|
|
@ -52,7 +52,7 @@ try {
|
|||
}
|
||||
|
||||
// get bookmarks root id
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
var root = bmsvc.bookmarksMenuFolder;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
|
|
|
@ -51,7 +51,7 @@ try {
|
|||
}
|
||||
|
||||
// get bookmarks root id
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
var root = bmsvc.bookmarksMenuFolder;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
|
|
|
@ -59,7 +59,7 @@ try {
|
|||
}
|
||||
|
||||
// get bookmarks root id
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
var root = bmsvc.bookmarksMenuFolder;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
|
|
|
@ -54,7 +54,7 @@ try {
|
|||
}
|
||||
|
||||
// get bookmarks root index
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
var root = bmsvc.bookmarksMenuFolder;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
|
|
|
@ -83,7 +83,6 @@ function runTest() {
|
|||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
const FEEDSPEC = "http://localhost:8888/tests/toolkit/components/places/tests/chrome/bad_links.atom";
|
||||
|
||||
gLivemarkId = lmsvc.createLivemarkFolderOnly(toolbarFolderId, "foo",
|
||||
|
|
|
@ -67,7 +67,6 @@ var observer =
|
|||
|
||||
};
|
||||
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
const FEEDSPEC = "http://localhost:8888/tests/toolkit/components/places/tests/chrome/rss_as_html.rss";
|
||||
|
||||
gLivemarkId = lmsvc.createLivemarkFolderOnly(toolbarFolderId, "foo",
|
||||
|
|
|
@ -62,7 +62,7 @@ try {
|
|||
}
|
||||
|
||||
// get bookmarks root index
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
var root = bmsvc.bookmarksMenuFolder;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
|
|
|
@ -59,7 +59,8 @@ const kSyncFinished = "places-sync-finished";
|
|||
const EXPECTED_SYNCS = 4;
|
||||
|
||||
function add_fake_livemark() {
|
||||
let lmId = lms.createLivemarkFolderOnly(bs.bookmarksToolbarId, "Livemark",
|
||||
let lmId = lms.createLivemarkFolderOnly(bs.toolbarFolder,
|
||||
"Livemark",
|
||||
uri("http://www.mozilla.org/"),
|
||||
uri("http://www.mozilla.org/test.xml"),
|
||||
bs.DEFAULT_INDEX);
|
||||
|
|
|
@ -53,6 +53,12 @@ let testServices = [
|
|||
["browser/nav-history-service;1", "nsINavHistoryService",
|
||||
["queryStringToQueries", "removePagesByTimeframe", "removePagesFromHost",
|
||||
"removeVisitsByTimeframe"]],
|
||||
["browser/nav-bookmarks-service;1","nsINavBookmarksService",
|
||||
["createFolder", "getItemIdForGUID"]],
|
||||
["browser/livemark-service;2","nsILivemarkService", []],
|
||||
["browser/annotation-service;1","nsIAnnotationService", []],
|
||||
["browser/favicon-service;1","nsIFaviconService", []],
|
||||
["browser/tagging-service;1","nsITaggingService", []],
|
||||
];
|
||||
_(testServices.join("\n"));
|
||||
|
||||
|
@ -84,7 +90,7 @@ function run_test()
|
|||
_("Generating an array of functions to test service:", s);
|
||||
[i for (i in s) if (okName(i))].sort().forEach(function(n) {
|
||||
_();
|
||||
_("Testing history function with null args:", n);
|
||||
_("Testing " + iface + " function with null args:", n);
|
||||
|
||||
let func = s[n];
|
||||
let num = func.length;
|
||||
|
@ -116,6 +122,12 @@ function run_test()
|
|||
_("Function call expects an out object at", pos);
|
||||
args[pos] = {};
|
||||
}
|
||||
catch(ex if ex.name.match(/NS_ERROR_NOT_IMPLEMENTED/)) {
|
||||
_("Method not implemented exception:", ex.name);
|
||||
|
||||
_("Moving on to the next test..");
|
||||
tryAgain = false;
|
||||
}
|
||||
catch(ex) {
|
||||
_("Caught some unexpected exception.. dumping");
|
||||
_([[i, ex[i]] for (i in ex)].join("\n"));
|
||||
|
|
Загрузка…
Ссылка в новой задаче