зеркало из https://github.com/mozilla/pjs.git
Don't build search results when search panel isn't open and
auto open search panel isn't set. b=91168; r=morse,jruderman; sr=alecf
This commit is contained in:
Родитель
08d83362ba
Коммит
e81012e370
|
@ -129,16 +129,21 @@ function UpdateInternetSearchResults(event)
|
|||
var url = _content.location.href;
|
||||
if (url) {
|
||||
try {
|
||||
var search = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
|
||||
.getService(Components.interfaces.nsIInternetSearchService);
|
||||
var autoOpenSearchPanel =
|
||||
pref.getBoolPref("browser.search.opensidebarsearchpanel");
|
||||
|
||||
var searchInProgressFlag = search.FindInternetSearchResults(url);
|
||||
if (autoOpenSearchPanel || isSearchPanelOpen())
|
||||
{
|
||||
var search = Components.
|
||||
classes["@mozilla.org/rdf/datasource;1?name=internetsearch"].
|
||||
getService(Components.interfaces.nsIInternetSearchService);
|
||||
|
||||
if (searchInProgressFlag) {
|
||||
var autoOpenSearchPanel = pref.getBoolPref("browser.search.opensidebarsearchpanel");
|
||||
var searchInProgressFlag = search.FindInternetSearchResults(url);
|
||||
|
||||
if (autoOpenSearchPanel)
|
||||
RevealSearchPanel();
|
||||
if (searchInProgressFlag) {
|
||||
if (autoOpenSearchPanel)
|
||||
RevealSearchPanel();
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
|
@ -797,6 +802,14 @@ function RevealSearchPanel()
|
|||
SidebarSelectPanel(searchPanel, true, true); // lives in sidebarOverlay.js
|
||||
}
|
||||
|
||||
function isSearchPanelOpen()
|
||||
{
|
||||
return ( !sidebar_is_hidden() &&
|
||||
!sidebar_is_collapsed() &&
|
||||
SidebarGetLastSelectedPanel() == "urn:sidebar:panel:search"
|
||||
);
|
||||
}
|
||||
|
||||
//Note: BrowserNewEditorWindow() was moved to globalOverlay.xul and renamed to NewEditorWindow()
|
||||
|
||||
function BrowserOpenWindow()
|
||||
|
|
|
@ -760,6 +760,12 @@ function SidebarSelectPanel(header, should_popopen, should_unhide) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function SidebarGetLastSelectedPanel()
|
||||
{
|
||||
return (sidebarObj.panels &&
|
||||
sidebarObj.panels.node.getAttribute('last-selected-panel'));
|
||||
}
|
||||
|
||||
function SidebarStopPanelLoad(header) {
|
||||
var panel = sidebarObj.panels.get_panel_from_header_node(header);
|
||||
panel.stop_load();
|
||||
|
|
Загрузка…
Ссылка в новой задаче