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) if (!uri)
return; return;
let item = yield ReadingList.getItemForURL(uri); let item = yield ReadingList.itemForURL(uri);
if (item) { if (item) {
yield item.delete(); yield item.delete();
} else { } else {

View File

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