backing out earlier changes to fix 121054, to address pageload spike

This commit is contained in:
ben%netscape.com 2002-01-24 07:23:21 +00:00
Родитель 0ae6879be7
Коммит 1d1e80baf5
6 изменённых файлов: 47 добавлений и 119 удалений

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

@ -83,7 +83,6 @@
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="Browser:FindAgain" modifiers="accel"/>
<!-- Go Menu -->
<key id="key_gotoHistory" key="&history.commandKey;" oncommand="openHistory();" modifiers="accel"/>
<!-- Bookmarks Menu -->
<key id="addBookmarkKb" key="&addCurPageCmd.commandkey;" command="Browser:AddBookmark" modifiers="accel"/>
@ -289,61 +288,12 @@
</menupopup>
</menu>
<menu accesskey="&goMenu.accesskey;" label="&goMenu.label;"
oncommand="loadHistoryItem(event);"
datasources="rdf:history rdf:bookmarks" ref="NC:HistoryByDate"
template="historyMenuTemplate">
<menu accesskey="&goMenu.accesskey;" label="&goMenu.label;" oncommand="gotoHistoryIndex(event);">
<menupopup onpopupshowing="updateGoMenu(event);">
<menuitem label="&goBackCmd.label;" accesskey="&goBackCmd.accesskey;" key="goBackKb" command="Browser:Back"/>
<menuitem label="&goForwardCmd.label;" accesskey="&goForwardCmd.accesskey;" key="goForwardKb" command="Browser:Forward"/>
<menuitem label="&goHomeCmd.label;" accesskey="&goHomeCmd.accesskey;" command="Browser:Home" key="goHome"/>
<menuseparator/>
<menuseparator id="after-session-history-separator" hidden="true"/>
<menuitem label="&historyCmd.label;" accesskey="&historyCmd.accesskey;"
oncommand="openHistory()" key="key_gotoHistory"/>
<menuseparator />
<template id="historyMenuTemplate">
<rule rdf:type="rdf:http://home.netscape.com/NC-rdf#Folder">
<menupopup>
<menu class="menu-iconic bookmark-item" uri="rdf:*"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
validate="never"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
label="rdf:http://home.netscape.com/NC-rdf#Name">
<menupopup>
<menuitem label="&emptyItem.label;" disabled="true"/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#Separator">
<menupopup>
<menuseparator uri="rdf:*"/>
</menupopup>
</rule>
<rule iscontainer="true">
<menupopup>
<menu class="menu-iconic bookmark-item" uri="rdf:*"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
validate="never" container="true"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
label="rdf:http://home.netscape.com/NC-rdf#Name">
<menupopup />
</menu>
</menupopup>
</rule>
<rule>
<menupopup>
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
url="rdf:http://home.netscape.com/NC-rdf#URL"
validate="never"
label="rdf:http://home.netscape.com/NC-rdf#Name"
status="rdf:http://home.netscape.com/WEB-rdf#status"/>
</menupopup>
</rule>
</template>
<menuseparator hidden="true"/>
</menupopup>
</menu>

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

@ -43,7 +43,7 @@ var gRDF = null;
var gRDFC = null;
var gLocalStore = null;
function FillHistoryMenu(aParent, aMenu, aAdjacentElement)
function FillHistoryMenu(aParent, aMenu)
{
// Remove old entries if any
deleteHistoryItems(aParent);
@ -79,16 +79,13 @@ function FillHistoryMenu(aParent, aMenu, aAdjacentElement)
}
break;
case "go":
if (count > 0) {
if (aAdjacentElement)
aAdjacentElement.removeAttribute( "hidden" );
}
if (count > 0) aParent.lastChild.removeAttribute( "hidden" );
end = count > MAX_HISTORY_MENU_ITEMS ? count - MAX_HISTORY_MENU_ITEMS : 0;
for (j = count - 1; j >= end; j--)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
createCheckboxMenuItem(aParent, j, entry.title, j == index, aAdjacentElement);
createCheckboxMenuItem(aParent, j, entry.title, j==index);
}
break;
}
@ -261,29 +258,23 @@ function addToUrlbarHistory()
} // localstore
}
function createMenuItem( aParent, aIndex, aLabel, aAdjacentElement)
function createMenuItem( aParent, aIndex, aLabel)
{
var menuitem = document.createElement( "menuitem" );
menuitem.setAttribute( "label", aLabel );
menuitem.setAttribute( "index", aIndex );
if ( !aAdjacentElement )
aParent.appendChild( menuitem );
else
aParent.insertBefore( menuitem, aAdjacentElement );
aParent.appendChild( menuitem );
}
function createCheckboxMenuItem( aParent, aIndex, aLabel, aChecked, aAdjacentElement)
function createCheckboxMenuItem( aParent, aIndex, aLabel, aChecked)
{
var menuitem = document.createElement( "menuitem" );
menuitem.setAttribute( "type", "checkbox" );
menuitem.setAttribute( "label", aLabel );
menuitem.setAttribute( "index", aIndex );
if (aChecked)
if (aChecked==true)
menuitem.setAttribute( "checked", "true" );
if ( !aAdjacentElement )
aParent.appendChild( menuitem );
else
aParent.insertBefore( menuitem, aAdjacentElement );
aParent.appendChild( menuitem );
}
function deleteHistoryItems(aParent)
@ -299,50 +290,6 @@ function deleteHistoryItems(aParent)
function updateGoMenu(event)
{
var adjacentElement = document.getElementById("after-session-history-separator");
FillHistoryMenu(event.target, "go", adjacentElement);
FillHistoryMenu(event.target, "go");
}
function openHistory()
{
// Use a single history dialog
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var historyWindow = windowManager.getMostRecentWindow('history:manager');
if (historyWindow)
historyWindow.focus();
else {
if (gDisableHistory)
return;
gDisableHistory = true;
window.open( "chrome://communicator/content/history/history.xul", "_blank",
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar" );
setTimeout(enableHistory, 2000);
}
}
function loadHistoryItem(aEvent)
{
var element = aEvent.target;
var index = element.getAttribute("index");
if (index) {
try {
getWebNavigation().gotoIndex(index);
}
catch (e) {
}
}
var url = element.getAttribute("url");
var isContainer = element.getAttribute("container") == "true";
if (url && !isContainer)
loadURI(url);
}

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

@ -144,9 +144,6 @@
<!ENTITY goHomeCmd.label "Home">
<!ENTITY goHomeCmd.accesskey "h">
<!ENTITY historyCmd.label "Complete History...">
<!ENTITY historyCmd.accesskey "c">
<!ENTITY history.commandKey "h">
<!ENTITY bookmarksMenu.label "Bookmarks">
<!ENTITY bookmarksMenu.accesskey "b">

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

@ -48,6 +48,35 @@ function enableHistory() {
gDisableHistory = false;
}
function toHistory()
{
// Use a single sidebar history dialog
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var historyWindow = windowManager.getMostRecentWindow('history:manager');
if (historyWindow) {
//debug("Reuse existing history window");
historyWindow.focus();
} else {
//debug("Open a new history dialog");
if (true == gDisableHistory) {
//debug("Recently opened one. Wait a little bit.");
return;
}
gDisableHistory = true;
window.open( "chrome://communicator/content/history/history.xul", "_blank",
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar" );
setTimeout(enableHistory, 2000);
}
}
function toJavaScriptConsole()
{
toOpenWindowByType("global:console", "chrome://global/content/console.xul");

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

@ -19,6 +19,8 @@
<key id="key_navigator" key="&navigatorCmd.commandkey;" command="Tasks:Navigator" modifiers="accel"/>
<key id="key_editor" key="&editorCmd.commandkey;" command="Tasks:Editor" modifiers="accel"/>
<!-- Tools Menu -->
<key id="key_gotoHistory" key="&history.commandKey;" oncommand="toHistory();" modifiers="accel"/>
</keyset>
<commandset id="tasksCommands">
<command id="Tasks:Navigator" oncommand="toNavigator();"/>
@ -31,8 +33,7 @@
<template>
<rule>
<menupopup>
<menuitem uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#KeyIndex rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="ShowWindowFromResource(event.target)" accesskey="rdf:http://home.netscape.com/NC-rdf#KeyIndex"/>
<menuitem uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="ShowWindowFromResource(event.target)"/>
</menupopup>
</rule>
</template>
@ -54,6 +55,7 @@
<menu label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;">
<menupopup id="toolsPopup" onpopupshowing="javaItemEnabling();">
<menuitem label="&historyCmd.label;" accesskey="&historyCmd.accesskey;" oncommand="toHistory()" key="key_gotoHistory"/>
<menuitem label="&importUtilCmd.label;" accesskey="&importUtilCmd.accesskey;" oncommand="toImport()"/>
<menuitem id="java" label="&javaConsoleCmd.label;" accesskey="&javaConsoleCmd.accesskey;" oncommand="toJavaConsole()"/>
<menuitem label="&javaScriptConsoleCmd.label;" accesskey="&javaScriptConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/>

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

@ -12,6 +12,9 @@
<!ENTITY toolsMenu.label "Tools">
<!ENTITY toolsMenu.accesskey "t">
<!ENTITY historyCmd.label "History">
<!ENTITY historyCmd.accesskey "h">
<!ENTITY history.commandKey "h">
<!ENTITY securityInfoCmd.label ".Security Info">
<!ENTITY securityInfoCmd.accesskey "s">
<!ENTITY importUtilCmd.label "Import Utility">