зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1131416 - Desktop syncing module for reading list service (fixes to prepatory changes). rs=jaws
rs=jaws IRL
This commit is contained in:
Родитель
503964d103
Коммит
48b68185e5
|
@ -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 {
|
||||
|
|
|
@ -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,22 @@ 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":
|
||||
if (nonNormalizedRecord[prop]) {
|
||||
record[prop] = normalizeURI(nonNormalizedRecord[prop]).spec;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
record[prop] = nonNormalizedRecord[prop];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче