зеркало из https://github.com/mozilla/pjs.git
fix for bug #381624: history sidebar slower the first time you open it (or on startup), then when you switch history views.
fix for regression bug #381896: history sidebar not sorted properly the first time you open it r=dietrich, mano
This commit is contained in:
Родитель
e7323b04ef
Коммит
0e7fefa925
|
@ -40,11 +40,7 @@
|
|||
const NHRVO = Ci.nsINavHistoryResultViewObserver;
|
||||
|
||||
// XXXmano: we should move most/all of these constants to PlacesUtils
|
||||
|
||||
// These need to be kept in sync with the meaning of these roots in
|
||||
// default_places.html!
|
||||
const ORGANIZER_ROOT_HISTORY_UNSORTED = "place:beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&type=1"
|
||||
const ORGANIZER_ROOT_HISTORY = ORGANIZER_ROOT_HISTORY_UNSORTED + "&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
|
||||
const ORGANIZER_ROOT_HISTORY_UNSORTED = "place:beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&type=1";
|
||||
const ORGANIZER_ROOT_BOOKMARKS = "place:folder=2&group=3&excludeItems=1";
|
||||
const ORGANIZER_SUBSCRIPTIONS_QUERY = "place:annotation=livemark%2FfeedURI";
|
||||
|
||||
|
|
|
@ -63,6 +63,15 @@ function HistorySidebarInit()
|
|||
document.getElementById("byday").setAttribute("checked", "true");
|
||||
|
||||
initContextMenu();
|
||||
|
||||
// set the place on the tree dynamically
|
||||
// otherwise, we will end up calling the place's tree's load() twice
|
||||
var optionsRef = {};
|
||||
var queriesRef = {};
|
||||
PlacesUtils.history.queryStringToQueries(ORGANIZER_ROOT_HISTORY_UNSORTED, queriesRef, {}, optionsRef);
|
||||
SetSortingAndGrouping(optionsRef.value);
|
||||
var place = PlacesUtils.history.queriesToQueryString(queriesRef.value, 1, optionsRef.value);
|
||||
gHistoryTree.place = place;
|
||||
|
||||
gSearchBox.focus();
|
||||
}
|
||||
|
@ -110,7 +119,8 @@ function historyAddBookmarks()
|
|||
#endif
|
||||
}
|
||||
|
||||
function SetSortingAndGrouping() {
|
||||
function SetSortingAndGrouping(aOptions)
|
||||
{
|
||||
const NHQO = Ci.nsINavHistoryQueryOptions;
|
||||
var sortingMode;
|
||||
var groups = [];
|
||||
|
@ -134,9 +144,8 @@ function SetSortingAndGrouping() {
|
|||
sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
|
||||
break;
|
||||
}
|
||||
var options = asQuery(gHistoryTree.getResult().root).queryOptions;
|
||||
options.setGroupingMode(groups, groups.length);
|
||||
options.sortingMode = sortingMode;
|
||||
aOptions.setGroupingMode(groups, groups.length);
|
||||
aOptions.sortingMode = sortingMode;
|
||||
}
|
||||
|
||||
function searchHistory(aInput)
|
||||
|
@ -144,14 +153,15 @@ function searchHistory(aInput)
|
|||
if (aInput) {
|
||||
if (!gSearching) {
|
||||
// Unset grouping when searching; applyFilter will update the view
|
||||
var options = asQuery(gHistoryTree.getResult().root).queryOptions;
|
||||
var options = gHistoryTree.getResult().root.queryOptions;
|
||||
options.setGroupingMode([], 0);
|
||||
gSearching = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// applyFilter will update the view
|
||||
SetSortingAndGrouping();
|
||||
var options = gHistoryTree.getResult().root.queryOptions;
|
||||
SetSortingAndGrouping(options);
|
||||
gSearching = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
<tree id="historyTree"
|
||||
flex="1"
|
||||
type="places"
|
||||
place="place:beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&type=1"
|
||||
context="placesContext"
|
||||
onkeypress="if (event.keyCode == 13) this.controller.openSelectedNodeWithEvent(event);"
|
||||
hidecolumnpicker="true"
|
||||
|
|
|
@ -53,8 +53,10 @@
|
|||
// but do it on setTimeout() for bugs #373719 and bug #373721
|
||||
// caused by a change for bug #267833
|
||||
// note the corresponding setTimeout() in PO_init()
|
||||
var self = this;
|
||||
setTimeout(function() { self.place = self.place; }, 0);
|
||||
if (this.place) {
|
||||
var self = this;
|
||||
setTimeout(function() { self.place = self.place; }, 0);
|
||||
}
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
|
@ -105,7 +107,7 @@
|
|||
<parameter name="onlyBookmarks"/>
|
||||
<parameter name="folderRestrict"/>
|
||||
<parameter name="optionsFilter"/>
|
||||
<body><![CDATA[
|
||||
<body><![CDATA[
|
||||
// preserve grouping
|
||||
var queryNode = asQuery(this.getResult().root);
|
||||
var options = queryNode.queryOptions.clone();
|
||||
|
@ -136,7 +138,7 @@
|
|||
<method name="load">
|
||||
<parameter name="queries"/>
|
||||
<parameter name="options"/>
|
||||
<body><![CDATA[
|
||||
<body><![CDATA[
|
||||
var result = PlacesUtils.history.executeQueries(queries, queries.length,
|
||||
options);
|
||||
var treeView = new PlacesTreeView(this.showRoot);
|
||||
|
|
Загрузка…
Ссылка в новой задаче