Make new tabs _not_ open for just enter if the "open new tab for

ctrl-enter" pref is set.  Bug 105537, r=timeless, sr=hyatt
This commit is contained in:
bzbarsky%mit.edu 2006-09-14 06:02:25 +00:00
Родитель 458baf3bf3
Коммит ff5fd892ff
2 изменённых файлов: 8 добавлений и 5 удалений

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

@ -908,13 +908,16 @@ function loadURI(uri, referrer)
} }
} }
function BrowserLoadURL() function BrowserLoadURL(aTriggeringEvent)
{ {
var url = gURLBar.value; var url = gURLBar.value;
if (url.match(/^view-source:/)) { if (url.match(/^view-source:/)) {
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null); BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null);
} else { } else {
if (pref && pref.getBoolPref("browser.tabs.opentabfor.urlbar") && getBrowser().localName == "tabbrowser") { if (pref && pref.getBoolPref("browser.tabs.opentabfor.urlbar") &&
getBrowser().localName == "tabbrowser" &&
aTriggeringEvent && 'ctrlKey' in aTriggeringEvent &&
aTriggeringEvent.ctrlKey) {
var t = getBrowser().addTab(getShortcutOrURI(url)); // open link in new tab var t = getBrowser().addTab(getShortcutOrURI(url)); // open link in new tab
getBrowser().selectedTab = t; getBrowser().selectedTab = t;
} }
@ -1454,10 +1457,10 @@ function handleURLBarRevert()
return isScrolling; return isScrolling;
} }
function handleURLBarCommand(aUserAction) function handleURLBarCommand(aUserAction, aTriggeringEvent)
{ {
addToUrlbarHistory(); addToUrlbarHistory();
BrowserLoadURL(); BrowserLoadURL(aTriggeringEvent);
} }
function UpdatePageProxyState() function UpdatePageProxyState()

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

@ -163,7 +163,7 @@ Contributor(s): ______________________________________. -->
showCommentColumn="true" showCommentColumn="true"
tooltiptext="&locationBar.tooltip;" tooltiptext="&locationBar.tooltip;"
oninput="window.XULBrowserWindow.userTyped.value=true;" oninput="window.XULBrowserWindow.userTyped.value=true;"
ontextcommand="return handleURLBarCommand(eventParam);" ontextcommand="return handleURLBarCommand(eventParam, domEvent);"
ontextrevert="return handleURLBarRevert();" ontextrevert="return handleURLBarRevert();"
onfocus="URLBarFocusHandler(event);" onfocus="URLBarFocusHandler(event);"
onblur="URLBarBlurHandler(event);"> onblur="URLBarBlurHandler(event);">