324704 - query creation and execution for bookmarks menu bar is ill-timed... need to do asynchronously in delayed startup or on popup showing, rather than at startup! r=brettw

This commit is contained in:
beng%bengoodger.com 2006-02-16 05:24:26 +00:00
Родитель 316e59b25d
Коммит f4d75982b7
4 изменённых файлов: 41 добавлений и 16 удалений

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

@ -860,6 +860,9 @@ function delayedStartup()
document.getElementById("bookmarks-chevron").ref = btf;
bt.database.AddObserver(BookmarksToolbarRDFObserver);
}
#else
var bookmarksBar = document.getElementById("bookmarksBarContent");
bookmarksBar.init();
#endif
window.addEventListener("resize", BookmarksToolbar.resizeFunc, false);
#ifndef MOZ_PLACES

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

@ -15,8 +15,30 @@
<destructor><![CDATA[
]]></destructor>
<method name="init">
<body><![CDATA[
var hist =
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bms =
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var query = hist.getNewQuery();
query.setFolders([bms.bookmarksRoot], 1);
var options = hist.getNewQueryOptions();
options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1);
options.expandQueries = true;
this._result = hist.executeQuery(query, options);
this._resultNode = this._result.root;
]]></body>
</method>
<method name="onPopupShowing">
<body><![CDATA[
if (!this._resultNode)
this.init();
if (PlacesController.nodeIsContainer(this._resultNode)) {
this._resultNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
this._resultNode.containerOpen = true;

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

@ -130,9 +130,9 @@ var PlacesUIHook = {
_findWasHidden: false,
showPlacesUI: function PP_showPlacesUI() {
/*
ASSERT(PlacesController, "PlacesController does not exist anymore?!");
/*
this._tabbrowser.setAttribute("places", "true");
var statusbar = this._topElement("status-bar");
statusbar.hidden = true;
@ -156,9 +156,9 @@ var PlacesUIHook = {
},
hidePlacesUI: function PP_hidePlacesUI() {
/*
ASSERT(PlacesController, "PlacesController does not exist anymore?!");
/*
this._tabbrowser.removeAttribute("places");
// Approaches that cache the value of the status bar before the Places page

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

@ -9,19 +9,6 @@
<binding id="places-bar">
<implementation>
<constructor><![CDATA[
this._places =
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
this._bms =
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
this._bms.addObserver(this._observer, false);
this.init();
var t = this;
window.addEventListener("resize",
function f(e) { t.updateChevron(e); },
false);
]]></constructor>
<destructor><![CDATA[
@ -30,6 +17,19 @@
<method name="init">
<body><![CDATA[
this._places =
Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
this._bms =
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
this._bms.addObserver(this._observer, false);
var t = this;
window.addEventListener("resize",
function f(e) { t.updateChevron(e); },
false);
var query = this._places.getNewQuery();
query.setFolders([this._bms.toolbarRoot], 1);
var options = this._places.getNewQueryOptions();