246719 - Make link modifiers work consistently throughout Firefox. This fixes 202819, 214816, 224132, and 236864. Also makes middlemouse.contentLoadURL work on Windows by porting the fix for 217090. r=bryner.

This commit is contained in:
jruderman%hmc.edu 2004-06-23 22:54:12 +00:00
Родитель 35ab44f5ac
Коммит 865bfc75b2
11 изменённых файлов: 347 добавлений и 193 удалений

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

@ -70,7 +70,8 @@
<menuitem id="context-viewimage"
label="&viewImageCmd.label;"
accesskey="&viewImageCmd.accesskey;"
oncommand="gContextMenu.viewImage();"/>
oncommand="gContextMenu.viewImage(event);"
onclick="checkForMiddleClick(this, event);"/>
#ifndef XP_UNIX
#ifndef XP_OS2
<menuitem id="context-copyimage-contents"
@ -134,7 +135,8 @@
<menuitem id="context-viewbgimage"
label="&viewBGImageCmd.label;"
accesskey="&viewBGImageCmd.accesskey;"
oncommand="gContextMenu.viewBGImage();"/>
oncommand="gContextMenu.viewBGImage(event);"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="context-undo"
label="&undoCmd.label;"
accesskey="&undoCmd.accesskey;"

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

@ -268,10 +268,28 @@
</menupopup>
</menu>
<menu label="&goMenu.label;" accesskey="&goMenu.accesskey;" oncommand="var url = event.target.getAttribute('statustext'); if (url) openTopWin(url);">
<menu label="&goMenu.label;" accesskey="&goMenu.accesskey;"
oncommand="var url = event.target.getAttribute('statustext'); if (url) openUILink(url, event, false, true);"
onclick="checkForMiddleClick(this, event);">
<menupopup id="goPopup" onpopupshowing="updateGoMenu(this);" onpopuphiding="onGoMenuHidden();">
<menuitem label="&backCmd.label;" accesskey="&backCmd.accesskey;" key="goBackKb" command="Browser:Back"/>
<menuitem label="&forwardCmd.label;" accesskey="&forwardCmd.accesskey;" key="goForwardKb" command="Browser:Forward"/>
<menuitem label="&backCmd.label;"
accesskey="&backCmd.accesskey;"
key="goBackKb"
oncommand="BrowserBack(event, true)"
onclick="checkForMiddleClick(this, event);">
<observes element="Browser:Back" attribute="disabled" />
</menuitem>
<menuitem label="&forwardCmd.label;"
accesskey="&forwardCmd.accesskey;"
key="goForwardKb"
oncommand="BrowserForward(event, true)"
onclick="checkForMiddleClick(this, event);">
<observes element="Browser:Forward" attribute="disabled" />
</menuitem>
<menuitem label="&goHomeCmd.label;" accesskey="&goHomeCmd.accesskey;" command="Browser:Home" key="goHome"/>
<menuseparator id="startHistorySeparator"/>
<menuseparator hidden="true" id="endHistorySeparator"/>
@ -368,7 +386,8 @@
<menupopup id="menu_HelpPopup">
<menuitem accesskey="&releaseCmd.accesskey;"
label="&releaseCmd.label;"
oncommand="openTopWin('&releaseURL;');"/>
oncommand="openUILink('&releaseURL;', event, false, true);"
onclick="checkForMiddleClick(this, event);"/>
<menuseparator/>
<menuitem id="aboutName"
accesskey="&aboutCmd.accesskey;"

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

@ -714,22 +714,69 @@ function gotoHistoryIndex(aEvent)
var index = aEvent.target.getAttribute("index");
if (!index)
return false;
try {
getWebNavigation().gotoIndex(index);
}
catch(ex) {
return false;
}
return true;
var where = whereToOpenLink(aEvent);
if (where == "current") {
// Normal click. Go there in the current tab and update session history.
try {
getWebNavigation().gotoIndex(index);
}
catch(ex) {
return false;
}
return true;
}
else {
// Modified click. Go there in a new tab/window.
// This code doesn't copy history or work well with framed pages.
var sessionHistory = getWebNavigation().sessionHistory;
var entry = sessionHistory.getEntryAtIndex(index, false);
var url = entry.URI.spec;
openUILinkIn(url, where);
return true;
}
}
function BrowserBack()
function BrowserForward(aEvent, aIgnoreAlt)
{
try {
getWebNavigation().goBack();
var where = whereToOpenLink(aEvent, false, aIgnoreAlt);
if (where == "current") {
try {
getWebNavigation().goForward();
}
catch(ex) {
}
}
catch(ex) {
else {
var sessionHistory = getWebNavigation().sessionHistory;
var currentIndex = sessionHistory.index;
var entry = sessionHistory.getEntryAtIndex(currentIndex + 1, false);
var url = entry.URI.spec;
openUILinkIn(url, where);
}
}
function BrowserBack(aEvent, aIgnoreAlt)
{
var where = whereToOpenLink(aEvent, false, aIgnoreAlt);
if (where == "current") {
try {
getWebNavigation().goBack();
}
catch(ex) {
}
}
else {
var sessionHistory = getWebNavigation().sessionHistory;
var currentIndex = sessionHistory.index;
var entry = sessionHistory.getEntryAtIndex(currentIndex - 1, false);
var url = entry.URI.spec;
openUILinkIn(url, where);
}
}
@ -756,15 +803,6 @@ function BrowserHandleBackspace()
}
#endif
function BrowserForward()
{
try {
getWebNavigation().goForward();
}
catch(ex) {
}
}
function BrowserBackMenu(event)
{
return FillHistoryMenu(event.target, "back");
@ -1175,7 +1213,12 @@ function readFromClipboard()
.createInstance(Components.interfaces.nsITransferable);
trans.addDataFlavor("text/unicode");
clipboard.getData(trans, clipboard.kSelectionClipboard);
// If available, use selection clipboard, otherwise global one
if (clipboard.supportsSelectionClipboard())
clipboard.getData(trans, clipboard.kSelectionClipboard);
else
clipboard.getData(trans, clipboard.kGlobalClipboard);
var data = {};
var dataLen = {};
@ -3312,12 +3355,12 @@ nsContextMenu.prototype = {
BrowserPageInfo(this.target.ownerDocument);
},
// Change current window to the URL of the image.
viewImage : function () {
openTopWin( this.imageURL );
viewImage : function (e) {
openUILink( this.imageURL, e );
},
// Change current window to the URL of the background image.
viewBGImage : function () {
openTopWin( this.bgImageURL );
viewBGImage : function (e) {
openUILink( this.bgImageURL, e );
},
setWallpaper: function() {
// Confirm since it's annoying if you hit this accidentally.
@ -3783,9 +3826,7 @@ function asyncOpenWebPanel(event)
if (event.button == 1 &&
!findParentNode(event.originalTarget, "scrollbar") &&
gPrefService.getBoolPref("middlemouse.contentLoadURL")) {
if (middleMousePaste(event)) {
event.preventBubble();
}
middleMousePaste(event);
}
return true;
}
@ -3795,7 +3836,7 @@ function handleLinkClick(event, href, linkNode)
switch (event.button) {
case 0:
#ifdef XP_MACOSX
if (event.metaKey) {
if (event.metaKey) { // Cmd
#else
if (event.ctrlKey) {
#endif
@ -3838,36 +3879,17 @@ function middleMousePaste(event)
{
var url = readFromClipboard();
if (!url)
return false;
return;
var postData = { };
url = getShortcutOrURI(url, postData);
if (!url)
return false;
return;
// On ctrl-middleclick, open in new tab.
var openNewTab;
#ifdef XP_MACOSX
openNewTab = event.metaKey;
#else
openNewTab = event.ctrlKey;
#endif
if (!openNewTab) {
// If ctrl wasn't down, then just load the url in the current win/tab.
loadURI(url, null, postData.value);
} else {
const nsIURIFixup = Components.interfaces.nsIURIFixup;
if (!gURIFixup)
gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
.getService(nsIURIFixup);
url = gURIFixup.createFixupURI(url, nsIURIFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI).spec;
openNewTabWith(url, null, event, true, postData.value);
}
openUILink(url,
event,
true /* ignore the fact this is a middle click */);
event.preventBubble();
return true;
}
function makeURLAbsolute( base, url )

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

@ -60,8 +60,16 @@
#endif
<popupset id="mainPopupSet">
<popup id="backMenu" position="after_start" onpopupshowing="return BrowserBackMenu(event);" oncommand="gotoHistoryIndex(event);"/>
<popup id="forwardMenu" position="after_start" onpopupshowing="return BrowserForwardMenu(event);" oncommand="gotoHistoryIndex(event);"/>
<popup id="backMenu"
position="after_start"
onpopupshowing="return BrowserBackMenu(event);"
oncommand="gotoHistoryIndex(event);"
onclick="checkForMiddleClick(this, event);"/>
<popup id="forwardMenu"
position="after_start"
onpopupshowing="return BrowserForwardMenu(event);"
oncommand="gotoHistoryIndex(event);"
onclick="checkForMiddleClick(this, event);"/>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
<popup id="SearchBarPopup" position="after_start"
@ -136,21 +144,29 @@
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1"
label="&backCmd.label;"
command="Browser:Back"
context="backMenu"
tooltiptext="&backButton.tooltip;">
<menupopup context="" onpopupshowing="BrowserBackMenu(event);"
oncommand="gotoHistoryIndex(event); event.preventBubble();"/>
label="&backCmd.label;"
oncommand="BrowserBack(event)"
onclick="checkForMiddleClick(this, event);"
context="backMenu"
tooltiptext="&backButton.tooltip;">
<observes element="Browser:Back" attribute="disabled"/>
<menupopup context=""
onpopupshowing="BrowserBackMenu(event);"
oncommand="gotoHistoryIndex(event); event.preventBubble();"
onclick="checkForMiddleClick(this, event);"/>
</toolbarbutton>
<toolbarbutton id="forward-button" type="menu-button" class="toolbarbutton-1"
label="&forwardCmd.label;"
command="Browser:Forward"
context="forwardMenu"
tooltiptext="&forwardButton.tooltip;">
<menupopup context="" oncommand="gotoHistoryIndex(event); event.preventBubble()"
onpopupshowing="BrowserForwardMenu(event);"/>
label="&forwardCmd.label;"
oncommand="BrowserForward(event)"
onclick="checkForMiddleClick(this, event);"
context="forwardMenu"
tooltiptext="&forwardButton.tooltip;">
<observes element="Browser:Forward" attribute="disabled"/>
<menupopup context=""
onpopupshowing="BrowserForwardMenu(event);"
oncommand="gotoHistoryIndex(event); event.preventBubble()"
onclick="checkForMiddleClick(this, event);"/>
</toolbarbutton>
<toolbarbutton id="reload-button" class="toolbarbutton-1"
@ -233,7 +249,9 @@
tooltiptext="&printButton.tooltip;"/>
<toolbaritem id="throbber-box" title="&throbberItem.title;" align="center" pack="center">
<button id="navigator-throbber" oncommand="goClickThrobber('browser.throbber.url')"
<button id="navigator-throbber"
oncommand="goClickThrobber('browser.throbber.url', event)"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&throbber.tooltip;"/>
</toolbaritem>

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

@ -141,7 +141,8 @@ const kSaveAsType_Text = 2; // Save document, converting to plain text.
// - Context -> Save Page/Frame As...
// - Context -> Save Link As...
// - Context -> Save Image As...
// - Alt-Click Save Link As
// - Alt-Click links in web pages
// - Alt-Click links in the UI
//
// Try saving each of these types:
// - A complete webpage using File->Save Page As, and Context->Save Page As

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

@ -64,7 +64,9 @@ function goToggleToolbar( id, elementID )
}
}
function goClickThrobber( urlPref )
// urlPref: lets each application have its own throbber URL. example: "messenger.throbber.url"
// event: lets shift+click open it in a new window, etc.
function goClickThrobber( urlPref, e )
{
var url;
try {
@ -78,16 +80,7 @@ function goClickThrobber( urlPref )
}
if ( url )
openTopWin(url);
}
//No longer needed. Rip this out since we are using openTopWin
function goHelpMenu( url )
{
/* note that this chrome url should probably change to not have all of the navigator controls */
/* also, do we want to limit the number of help windows that can be spawned? */
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
openUILink(url, e);
}
function getTopWin()
@ -104,33 +97,184 @@ function getTopWin()
function openTopWin( url )
{
/* note that this chrome url should probably change to not have
all of the navigator controls, but if we do this we need to have
the option for chrome controls because goClickThrobber() needs to
use this function with chrome controls */
/* also, do we want to
limit the number of help windows that can be spawned? */
if ((url == null) || (url == "")) return null;
openUILink(url, {})
}
// xlate the URL if necessary
if (url.indexOf("urn:") == 0)
{
url = xlateURL(url); // does RDF urn expansion
function getBoolPref ( prefname, def )
{
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
return pref.getBoolPref(prefname);
}
catch(er) {
return def;
}
}
// openUILink handles clicks on UI elements that cause URLs to load.
function openUILink( url, e, ignoreButton, ignoreAlt )
{
var where = whereToOpenLink(e, ignoreButton, ignoreAlt);
openUILinkIn(url, where);
}
/* whereToOpenLink() looks at an event to decide where to open a link.
*
* The event may be a mouse event (click, double-click, middle-click) or keypress event (enter).
*
* On Windows, the modifiers are:
* Ctrl new tab, selected
* Shift new window
* Ctrl+Shift new tab, in background
* Alt save
*
* You can swap Ctrl and Ctrl+shift by toggling the hidden pref
* browser.tabs.loadBookmarksInBackground (not browser.tabs.loadInBackground, which
* is for content area links).
*
* Middle-clicking is the same as Ctrl+clicking (it opens a new tab) and it is
* subject to the shift modifier and pref in the same way.
*
* Exceptions:
* - Alt is ignored for menu items selected using the keyboard so you don't accidentally save stuff.
* (Currently, the Alt isn't sent here at all for menu items, but that will change in bug 126189.)
* - Alt is hard to use in context menus, because pressing Alt closes the menu.
* - Alt can't be used on the bookmarks toolbar because Alt is used for "treat this as something draggable".
* - The button is ignored for the middle-click-paste-URL feature, since it's always a middle-click.
*/
function whereToOpenLink( e, ignoreButton, ignoreAlt )
{
if (e == null)
e = { shiftKey:false, ctrlKey:false, metaKey:false, altKey:false, button:0 };
var shift = e.shiftKey;
var ctrl = e.ctrlKey;
var meta = e.metaKey;
var alt = e.altKey && !ignoreAlt;
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
var middle = !ignoreButton && e.button == 1;
var middleUsesTabs = getBoolPref("browser.tabs.opentabfor.middleclick", true);
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
#ifdef XP_MACOSX
if (meta || (middle && middleUsesTabs)) {
#else
if (ctrl || (middle && middleUsesTabs)) {
#endif
if (shift)
return "tabshifted";
else
return "tab";
}
else if (alt) {
return "save";
}
else if (shift || (middle && !middleUsesTabs)) {
return "window";
}
else {
return "current";
}
}
/* openUILinkIn opens a URL in a place specified by the parameter |where|.
*
* |where| can be:
* "current" current tab (if there aren't any browser windows, then in a new window instead)
* "tab" new tab (if there aren't any browser windows, then in a new window instead)
* "tabshifted" same as "tab" but in background if default is to select new tabs, and vice versa
* "window" new window
* "save" save to disk (with no filename hint!)
*/
function openUILinkIn( url, where )
{
if (!where)
return;
if ((url == null) || (url == ""))
return;
// xlate the URL if necessary
if (url.indexOf("urn:") == 0) {
url = xlateURL(url); // does RDF urn expansion
}
// avoid loading "", since this loads a directory listing
if (url == "") {
url = "about:blank";
}
if (where == "save") {
saveURL(url, null, null, true);
return;
}
var w = (where == "window") ? null : getTopWin();
if (!w) {
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
return;
}
var browser = w.document.getElementById("content");
switch (where) {
case "current":
browser.loadURI(url);
w._content.focus();
break;
case "tabshifted":
case "tab":
var tab = browser.addTab(url);
// We check the pref here, rather than in whereToOpenLink, because an "open link in tab"
// context menu item could call openUILinkwhere directly.
if ((where == "tab") ^ getBoolPref("browser.tabs.loadBookmarksInBackground", false)) {
browser.selectedTab = tab;
w._content.focus();
}
// avoid loading "", since this loads a directory listing
if (url == "") {
url = "about:blank";
}
break;
}
}
var topWindowOfType = getTopWin();
if ( topWindowOfType )
{
topWindowOfType.focus();
topWindowOfType.loadURI(url);
return topWindowOfType;
}
return window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
// Used as an onclick handler for UI elements with link-like behavior.
// e.g. onclick="checkForMiddleClick(this, event);"
function checkForMiddleClick(node, event)
{
if (event.button == 1) {
/* Execute the node's oncommand.
*
* Using eval() because of bug 246720. Would like to use node.oncommand(event).
*
* Since we're using eval():
*
* |event| is correct because the name of this function's formal parameter matches
* the automatic name of the formal parameter for oncommand, |event|.
*
* |this| is incorrect. To make it correct, we would have to use Function.call.
*/
eval(node.getAttribute("oncommand"));
// If the middle-click was on part of a menu, close the menu.
// (Menus close automatically with left-click but not with middle-click.)
closeMenus(event.target);
}
}
// Closes all popups that are ancestors of the node.
function closeMenus(node)
{
if ("tagName" in node) {
if (node.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
&& (node.tagName == "menupopup" || node.tagName == "popup"))
node.hidePopup();
closeMenus(node.parentNode);
}
}
// update menu items that rely on focus

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

@ -518,7 +518,7 @@ var BookmarksCommand = {
if (aTargetBrowser == "save") {
var item = aSelection.item[i];
saveURL(item.Value, BookmarksUtils.getProperty(item, "Name"), null, true);
}
}
else if (type == "Bookmark" || type == "") {
var webPanel = BMDS.GetTarget(aSelection.item[i],
RDF.GetResource(NC_NS + "WebPanel"),
@ -558,38 +558,15 @@ var BookmarksCommand = {
w.openWebPanel(BookmarksUtils.getProperty(aResource, NC_NS+"Name"), url);
},
// requires utilityOverlay.js if opening in new window for getTopWin()
// requires utilityOverlay.js because it calls openUILinkIn
openOneBookmark: function (aURI, aTargetBrowser, aDS)
{
var url = BookmarksUtils.getProperty(aURI, NC_NS+"URL", aDS);
// Ignore "NC:" and empty urls.
if (url == "")
return;
var w = aTargetBrowser == "window"? null:getTopWin();
if (!w) {
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
return;
}
var browser = w.document.getElementById("content");
switch (aTargetBrowser) {
case "current":
browser.loadURI(url);
w._content.focus();
break;
case "tab":
var loadInBackground = false;
loadInBackground = PREF.getBoolPref("browser.tabs.loadBookmarksInBackground");
// open link in new tab
var tab = browser.addTab(url);
if (!loadInBackground)
browser.selectedTab = tab;
browser.focus();
break;
}
openUILinkIn(url, aTargetBrowser);
},
openGroupBookmark: function (aURI, aTargetBrowser)
@ -1374,25 +1351,6 @@ var BookmarksUtils = {
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
"centerscreen,chrome,dialog,resizable,dependent", aTitle, aURL, null, aCharset,
null, null, aIsWebPanel);
},
getBrowserTargetFromEvent: function (aEvent)
{
var button = (aEvent.type == "command" || aEvent.type == "keypress") ? 0 :aEvent.button;
if (button == 1)
return PREF.getBoolPref("browser.tabs.opentabfor.middleclick")? "tab":"window"
else if (aEvent.shiftKey)
return "window";
#ifdef XP_MACOSX
else if (aEvent.metaKey)
#else
else if (aEvent.ctrlKey)
#endif
return "tab";
else if (aEvent.altKey)
return "save"
else
return "current";
}
}

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

@ -366,7 +366,7 @@ var BookmarksMenu = {
return;
var rSource = RDF.GetResource(aTarget.id);
var selection = BookmarksUtils.getSelectionFromResource(rSource);
var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
var browserTarget = whereToOpenLink(aEvent);
BookmarksCommand.openBookmark(selection, browserTarget, aDS);
aEvent.preventBubble();
},

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

@ -549,7 +549,7 @@
return;
}
}
var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
var browserTarget = whereToOpenLink(aEvent);
BookmarksCommand.openBookmark(selection, browserTarget, this.db);
]]></body>
</method>

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

@ -50,11 +50,11 @@
<menuitem id="miCollapse" label="&collapse.label;" accesskey="&collapse.accesskey;"
default="true" oncommand="collapseExpand();"/>
<menuitem id="miOpen" label="&openLinkInWindow.label;" accesskey="&openLinkInWindow.accesskey;" default="true"
oncommand="OpenURL(0);"/>
oncommand="OpenURLIn('current');"/>
<menuitem id="miOpenInNewWindow" label="&openInNewWindow.label;" accesskey="&openInNewWindow.accesskey;"
oncommand="OpenURL(1);"/>
oncommand="OpenURLIn('window');"/>
<menuitem id="miOpenInNewTab" label="&openInNewTab.label;" accesskey="&openInNewTab.accesskey;"
oncommand="OpenURL(2);"/>
oncommand="OpenURLIn('tab');"/>
<menuseparator id="pre-bookmarks-separator"/>
<menuitem id="miAddBookmark" label="&bookmarkLink.label;" accesskey="&bookmarkLink.accesskey;" oncommand="historyAddBookmarks();"/>
<menuitem id="miCopyLink" label="&copyLink.label;" accesskey="&copyLink.accesskey;" oncommand="historyCopyLink();"/>
@ -92,13 +92,13 @@
<tree id="historyTree" flex="1" class="plain"
context="historyContextMenu"
datasources="rdf:history" ref="NC:HistoryByDate" flags="dont-build-content"
onkeypress="if (event.keyCode == 13) OpenURL(event.shiftKey || event.metaKey);"
onkeypress="if (event.keyCode == 13) OpenURL(event);"
onselect="this.treeBoxObject.view.selectionChanged();
historyOnSelect();"
hidecolumnpicker="true"
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, historyDNDObserver);"
onclick="if (event.button == 1) OpenURL(2, event);"
ondblclick="if (isValidLeftClick(event,'treechildren')) onDoubleClick(event);">
onclick="if (event.button == 1) OpenURL(event);"
ondblclick="if (isValidLeftClick(event,'treechildren')) OpenURL(event);">
<template>
<rule>
<treechildren>

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

@ -96,14 +96,28 @@ function collapseExpand()
gHistoryTree.treeBoxObject.view.toggleOpenState(currentIndex);
}
function onDoubleClick(event)
function OpenURLIn(where)
{
if (event.metaKey || event.shiftKey)
OpenURL(1);
else if (event.ctrlKey)
OpenURL(2, event);
else
OpenURL(0);
var count = gHistoryTree.view.selection.count;
if (count != 1)
return;
var currentIndex = gHistoryTree.currentIndex;
if (isContainer(gHistoryTree, currentIndex))
return;
var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
var url = builder.getResourceAtIndex(currentIndex).ValueUTF8;
if (!checkURLSecurity(url))
return;
openUILinkIn(url, where);
}
function OpenURL(event)
{
OpenURLIn(whereToOpenLink(event));
}
function checkURLSecurity(aURL)
@ -126,30 +140,6 @@ function checkURLSecurity(aURL)
return true;
}
function OpenURL(aWhere, event)
{
var count = gHistoryTree.view.selection.count;
if (count != 1)
return;
var currentIndex = gHistoryTree.currentIndex;
if (isContainer(gHistoryTree, currentIndex))
return;
var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
var url = builder.getResourceAtIndex(currentIndex).ValueUTF8;
if (!checkURLSecurity(url))
return;
if (aWhere == 0)
openTopWin(url);
else if (aWhere == 1)
openNewWindowWith(url, null, false);
else
openNewTabWith(url, null, event, false);
}
function SortBy(sortKey)
{
// We set the sortDirection to the one before we actually want it to be in the