Bug 1131416 - Desktop syncing module for reading list service (fixes to prepatory changes). rs=jaws

rs=jaws IRL
This commit is contained in:
Drew Willcoxon 2015-03-20 14:26:54 -07:00
parent 20363ac5c8
commit 4029d35b71
2 changed files with 12 additions and 10 deletions

View File

@ -292,7 +292,7 @@ let ReadingListUI = {
if (!uri)
return;
let item = yield ReadingList.getItemForURL(uri);
let item = yield ReadingList.itemForURL(uri);
if (item) {
yield item.delete();
} else {

View File

@ -320,7 +320,7 @@ ReadingListImpl.prototype = {
};
if (metadata.previews.length > 0) {
itemData.preview = metadata.previews[0];
record.preview = metadata.previews[0];
}
return (yield this.addItem(record));
@ -851,18 +851,20 @@ ReadingListItemIterator.prototype = {
* @return The new normalized record.
*/
function normalizeRecord(nonNormalizedRecord) {
let record = {};
for (let prop in nonNormalizedRecord) {
if (!ITEM_RECORD_PROPERTIES.includes(prop)) {
throw new Error("Unrecognized item property: " + prop);
}
}
let record = clone(nonNormalizedRecord);
if (record.url) {
record.url = normalizeURI(record.url).spec;
}
if (record.resolvedURL) {
record.resolvedURL = normalizeURI(record.resolvedURL).spec;
switch (prop) {
case "url":
case "resolvedURL":
record[prop] = normalizeURI(nonNormalizedRecord[prop]).spec;
break;
default:
record[prop] = nonNormalizedRecord[prop];
break;
}
}
return record;
}