зеркало из https://github.com/mozilla/pjs.git
ignore 'type' properties in edit commands; fix history sync
This commit is contained in:
Родитель
5ec2b83320
Коммит
86caf96468
|
@ -459,6 +459,10 @@ BookmarksStore.prototype = {
|
|||
|
||||
for (let key in command.data) {
|
||||
switch (key) {
|
||||
case "type":
|
||||
// all commands have this to help in reconciliation, but it makes
|
||||
// no sense to edit it
|
||||
break;
|
||||
case "GUID":
|
||||
var existing = this._getItemIdForGUID(command.data.GUID);
|
||||
if (existing < 0)
|
||||
|
@ -676,7 +680,7 @@ HistoryStore.prototype = {
|
|||
_createCommand: function HistStore__createCommand(command) {
|
||||
this._log.debug(" -> creating history entry: " + command.GUID);
|
||||
try {
|
||||
let uri = Utils.makeURI(command.GUID);
|
||||
let uri = Utils.makeURI(command.data.URI);
|
||||
this._hsvc.addVisit(uri, command.data.time, null,
|
||||
this._hsvc.TRANSITION_TYPED, false, null);
|
||||
this._hsvc.setPageTitle(uri, command.data.title);
|
||||
|
@ -686,15 +690,15 @@ HistoryStore.prototype = {
|
|||
},
|
||||
|
||||
_removeCommand: function HistStore__removeCommand(command) {
|
||||
this._log.debug(" -> NOT removing history entry: " + command.GUID);
|
||||
// we can't remove because we only sync the last 500 items, not
|
||||
this._log.trace(" -> NOT removing history entry: " + command.GUID);
|
||||
// we can't remove because we only sync the last 1000 items, not
|
||||
// the whole store. So we don't know if remove commands were
|
||||
// generated due to the user removing an entry or because it
|
||||
// dropped past the 500 item mark.
|
||||
// dropped past the 1000 item mark.
|
||||
},
|
||||
|
||||
_editCommand: function HistStore__editCommand(command) {
|
||||
this._log.debug(" -> FIXME: NOT editing history entry: " + command.GUID);
|
||||
this._log.trace(" -> FIXME: NOT editing history entry: " + command.GUID);
|
||||
// FIXME: implement!
|
||||
},
|
||||
|
||||
|
@ -703,9 +707,9 @@ HistoryStore.prototype = {
|
|||
options = this._hsvc.getNewQueryOptions();
|
||||
|
||||
query.minVisits = 1;
|
||||
options.maxResults = 500;
|
||||
options.resultType = options.RESULTS_AS_FULL_VISIT;
|
||||
options.sortingMode = query.SORT_BY_LASTMODIFIED_DESCENDING;
|
||||
options.maxResults = 1000;
|
||||
options.resultType = options.RESULTS_AS_VISIT; // FULL_VISIT does not work
|
||||
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
|
||||
options.queryType = options.QUERY_TYPE_HISTORY;
|
||||
|
||||
let root = this._hsvc.executeQuery(query, options).root;
|
||||
|
@ -719,12 +723,13 @@ HistoryStore.prototype = {
|
|||
let items = {};
|
||||
for (let i = 0; i < root.childCount; i++) {
|
||||
let item = root.getChild(i);
|
||||
items[item.uri] = {parentGUID: '',
|
||||
let guid = item.time + ":" + item.uri
|
||||
items[guid] = {parentGUID: '',
|
||||
title: item.title,
|
||||
URI: item.uri,
|
||||
time: item.time
|
||||
};
|
||||
// FIXME: sync transition type
|
||||
// FIXME: sync transition type - requires FULL_VISITs
|
||||
}
|
||||
return items;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче