Bug 830291 - remove "downloads/destinationFileName" annotation. r=mak

MozReview-Commit-ID: GznhjKHOr9c

--HG--
extra : rebase_source : 68e554d3eca400062c398cd4398a2a2989668a92
This commit is contained in:
Asaf Romano 2017-05-12 15:44:25 +02:00
parent 569c55f5cb
commit ef29ad0af2
3 changed files with 11 additions and 26 deletions

View File

@ -62,8 +62,6 @@ namespace places {
#define DESTINATIONFILEURI_ANNO \
NS_LITERAL_CSTRING("downloads/destinationFileURI")
#define DESTINATIONFILENAME_ANNO \
NS_LITERAL_CSTRING("downloads/destinationFileName")
////////////////////////////////////////////////////////////////////////////////
//// VisitData
@ -1519,14 +1517,6 @@ public:
nsresult rv = aPlaceInfo->GetUri(getter_AddRefs(source));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> destinationFile;
rv = destinationFileURL->GetFile(getter_AddRefs(destinationFile));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString destinationFileName;
rv = destinationFile->GetLeafName(destinationFileName);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString destinationURISpec;
rv = destinationFileURL->GetSpec(destinationURISpec);
NS_ENSURE_SUCCESS(rv, rv);
@ -1544,15 +1534,6 @@ public:
);
NS_ENSURE_SUCCESS(rv, rv);
rv = annosvc->SetPageAnnotationString(
source,
DESTINATIONFILENAME_ANNO,
destinationFileName,
0,
nsIAnnotationService::EXPIRE_WITH_HISTORY
);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString title;
rv = aPlaceInfo->GetTitle(title);
NS_ENSURE_SUCCESS(rv, rv);
@ -1562,6 +1543,14 @@ public:
// history title with the name of the destination file, to allow it to be
// visible and searchable in history results.
if (title.IsEmpty()) {
nsCOMPtr<nsIFile> destinationFile;
rv = destinationFileURL->GetFile(getter_AddRefs(destinationFile));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString destinationFileName;
rv = destinationFile->GetLeafName(destinationFileName);
NS_ENSURE_SUCCESS(rv, rv);
rv = mHistory->SetURITitle(source, destinationFileName);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -272,7 +272,8 @@ this.PlacesDBUtils = {
WHERE type = 4
OR anno_attribute_id IN (
SELECT id FROM moz_anno_attributes
WHERE name BETWEEN 'weave/' AND 'weave0'
WHERE name = 'downloads/destinationFileName' OR
name BETWEEN 'weave/' AND 'weave0'
)`);
cleanupStatements.push(deleteObsoleteAnnos);

View File

@ -207,10 +207,9 @@ add_test(function test_dh_details() {
let titleSet = false;
let destinationFileUriSet = false;
let destinationFileNameSet = false;
function checkFinished() {
if (titleSet && destinationFileUriSet && destinationFileNameSet) {
if (titleSet && destinationFileUriSet) {
PlacesUtils.annotations.removeObserver(annoObserver);
PlacesUtils.history.removeObserver(historyObserver);
@ -227,10 +226,6 @@ add_test(function test_dh_details() {
destinationFileUriSet = true;
do_check_eq(value, destFileUri.spec);
break;
case "downloads/destinationFileName":
destinationFileNameSet = true;
do_check_eq(value, DEST_FILE_NAME);
break;
}
checkFinished();
}