Bug 488190 - Use record properties instead of cleartext properties

Switch pretty much all references to cleartext in modules/engines/ to just use the record. Also clean up some references to null cleartext to use deleted. The only reference to cleartext is to iterate over that hash in bookmarks.
This commit is contained in:
Edward Lee 2009-04-13 16:39:29 -05:00
Родитель 5a136689fb
Коммит f6367261d8
5 изменённых файлов: 35 добавлений и 42 удалений

Просмотреть файл

@ -190,31 +190,30 @@ BookmarksStore.prototype = {
parentId = this._bms.bookmarksMenuFolder;
}
switch (record.cleartext.type) {
case "query":
switch (record.type) {
case "bookmark":
case "microsummary": {
this._log.debug(" -> creating bookmark \"" + record.cleartext.title + "\"");
this._log.debug(" -> creating bookmark \"" + record.title + "\"");
let uri = Utils.makeURI(record.bmkUri);
this._log.debug(" -> -> ParentID is " + parentId);
this._log.debug(" -> -> uri is " + record.bmkUri);
this._log.debug(" -> -> sortindex is " + record.sortindex);
this._log.debug(" -> -> title is " + record.cleartext.title);
this._log.debug(" -> -> title is " + record.title);
newId = this._bms.insertBookmark(parentId, uri, record.sortindex,
record.cleartext.title);
record.title);
this._ts.untagURI(uri, null);
this._ts.tagURI(uri, record.cleartext.tags);
this._bms.setKeywordForBookmark(newId, record.cleartext.keyword);
if (record.cleartext.description) {
this._ts.tagURI(uri, record.tags);
this._bms.setKeywordForBookmark(newId, record.keyword);
if (record.description) {
this._ans.setItemAnnotation(newId, "bookmarkProperties/description",
record.cleartext.description, 0,
record.description, 0,
this._ans.EXPIRE_NEVER);
}
if (record.cleartext.type == "microsummary") {
if (record.type == "microsummary") {
this._log.debug(" \-> is a microsummary");
this._ans.setItemAnnotation(newId, "bookmarks/staticTitle",
record.cleartext.staticTitle || "", 0, this._ans.EXPIRE_NEVER);
record.staticTitle || "", 0, this._ans.EXPIRE_NEVER);
let genURI = Utils.makeURI(record.generatorUri);
if (this._ms) {
try {
@ -228,29 +227,29 @@ BookmarksStore.prototype = {
}
} break;
case "folder":
this._log.debug(" -> creating folder \"" + record.cleartext.title + "\"");
this._log.debug(" -> creating folder \"" + record.title + "\"");
newId = this._bms.createFolder(parentId,
record.cleartext.title,
record.title,
record.sortindex);
// If folder is an outgoing share, put the annotations on it:
if ( record.cleartext.outgoingSharedAnno != undefined ) {
if ( record.outgoingSharedAnno != undefined ) {
this._ans.setItemAnnotation(newId,
OUTGOING_SHARED_ANNO,
record.cleartext.outgoingSharedAnno,
record.outgoingSharedAnno,
0,
this._ans.EXPIRE_NEVER);
this._ans.setItemAnnotation(newId,
SERVER_PATH_ANNO,
record.cleartext.serverPathAnno,
record.serverPathAnno,
0,
this._ans.EXPIRE_NEVER);
}
break;
case "livemark":
this._log.debug(" -> creating livemark \"" + record.cleartext.title + "\"");
this._log.debug(" -> creating livemark \"" + record.title + "\"");
newId = this._ls.createLivemark(parentId,
record.cleartext.title,
record.title,
Utils.makeURI(record.siteUri),
Utils.makeURI(record.feedUri),
record.sortindex);
@ -259,18 +258,18 @@ BookmarksStore.prototype = {
/* even though incoming shares are folders according to the
* bookmarkService, _wrap() wraps them as type=incoming-share, so we
* handle them separately, like so: */
this._log.debug(" -> creating incoming-share \"" + record.cleartext.title + "\"");
this._log.debug(" -> creating incoming-share \"" + record.title + "\"");
newId = this._bms.createFolder(parentId,
record.cleartext.title,
record.title,
record.sortindex);
this._ans.setItemAnnotation(newId,
INCOMING_SHARED_ANNO,
record.cleartext.incomingSharedAnno,
record.incomingSharedAnno,
0,
this._ans.EXPIRE_NEVER);
this._ans.setItemAnnotation(newId,
SERVER_PATH_ANNO,
record.cleartext.serverPathAnno,
record.serverPathAnno,
0,
this._ans.EXPIRE_NEVER);
break;
@ -279,7 +278,7 @@ BookmarksStore.prototype = {
newId = this._bms.insertSeparator(parentId, record.sortindex);
break;
default:
this._log.error("_create: Unknown item type: " + record.cleartext.type);
this._log.error("_create: Unknown item type: " + record.type);
break;
}
if (newId) {

Просмотреть файл

@ -78,12 +78,10 @@ FormEngine.prototype = {
},
_recordLike: function SyncEngine__recordLike(a, b) {
if (a.cleartext == null || b.cleartext == null)
if (a.deleted || b.deleted)
return false;
if (a.cleartext.name == b.cleartext.name &&
a.cleartext.value == b.cleartext.value) {
if (a.name == b.name && a.value == b.value)
return true;
}
return false;
}
};

Просмотреть файл

@ -419,14 +419,14 @@ HistoryStore.prototype = {
curvisits = this._getVisits(record.histUri);
let visit;
while ((visit = record.cleartext.visits.pop())) {
while ((visit = record.visits.pop())) {
if (curvisits.filter(function(i) i.date == visit.date).length)
continue;
this._log.debug(" visit " + visit.date);
this._hsvc.addVisit(uri, visit.date, null, visit.type,
(visit.type == 5 || visit.type == 6), 0);
}
this._hsvc.setPageTitle(uri, record.cleartext.title);
this._hsvc.setPageTitle(uri, record.title);
// Equalize IDs
let localId = this._getGUID(record.histUri);

Просмотреть файл

@ -78,17 +78,13 @@ PasswordEngine.prototype = {
},
_recordLike: function SyncEngine__recordLike(a, b) {
if (a.cleartext == null || b.cleartext == null)
if (a.deleted || b.deleted)
return false;
if (a.cleartext.hostname == b.cleartext.hostname) {
}
if (a.cleartext.hostname != b.cleartext.hostname ||
a.cleartext.httpRealm != b.cleartext.httpRealm ||
a.cleartext.username != b.cleartext.username)
if (["hostname", "httpRealm", "username"].some(function(k) a[k] != b[k]))
return false;
if (!a.cleartext.formSubmitURL || !b.cleartext.formSubmitURL)
if (!a.formSubmitURL || !b.formSubmitURL)
return true;
return a.cleartext.formSubmitURL == b.cleartext.formSubmitURL;
return a.formSubmitURL == b.formSubmitURL;
}
};

Просмотреть файл

@ -103,7 +103,7 @@ Bookmark.prototype = {
_Bookmark_init: function BmkRec_init(uri) {
this._PlacesItem_init(uri);
this.cleartext.type = "bookmark";
this.type = "bookmark";
},
};
@ -119,7 +119,7 @@ BookmarkMicsum.prototype = {
_BookmarkMicsum_init: function BmkMicsumRec_init(uri) {
this._Bookmark_init(uri);
this.cleartext.type = "microsummary";
this.type = "microsummary";
},
};
@ -134,7 +134,7 @@ BookmarkFolder.prototype = {
_BookmarkFolder_init: function FolderRec_init(uri) {
this._PlacesItem_init(uri);
this.cleartext.type = "folder";
this.type = "folder";
},
};
@ -149,7 +149,7 @@ Livemark.prototype = {
_Livemark_init: function LvmkRec_init(uri) {
this._BookmarkFolder_init(uri);
this.cleartext.type = "livemark";
this.type = "livemark";
},
};
@ -164,6 +164,6 @@ BookmarkSeparator.prototype = {
_BookmarkSeparator_init: function SepRec_init(uri) {
this._PlacesItem_init(uri);
this.cleartext.type = "separator";
this.type = "separator";
}
};