factor out code for updating and refreshing microsummaries when the user selects a new one from the bookmark dialogs

bug=339296
r=mconnor


git-svn-id: svn://10.0.0.236/trunk@218326 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
myk%mozilla.org 2007-01-14 05:37:58 +00:00
parent 0db6068d27
commit 997d30a4e2

View File

@ -771,23 +771,10 @@ MicrosummaryService.prototype = {
*/
setMicrosummary: function MSS_setMicrosummary(bookmarkID, microsummary) {
this._setField(bookmarkID, FIELD_MICSUM_GEN_URI, microsummary.generatorURI.spec);
// If the microsummary content has already been generated,
// set the URI's generated title to the microsummary content
// and expire the microsummary after the normal interval.
if (microsummary.content) {
var now = new Date().getTime();
this._setField(bookmarkID, FIELD_GENERATED_TITLE, microsummary.content);
this._setField(bookmarkID, FIELD_MICSUM_EXPIRATION, now + UPDATE_INTERVAL);
}
// Otherwise, expire the microsummary and update it immediately.
else {
if (this._hasField(bookmarkID, FIELD_MICSUM_EXPIRATION))
this._clearField(bookmarkID, FIELD_MICSUM_EXPIRATION);
microsummary.addObserver(this);
microsummary.update();
}
if (microsummary.content)
this._updateMicrosummary(bookmarkID, microsummary);
else
this.refreshMicrosummary(bookmarkID);
},
/**