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 2002-01-24 02:39:26 +00:00
parent 88bd0eb13e
commit 0123183cd5
3 changed files with 16 additions and 11 deletions

View File

@ -908,13 +908,16 @@ function loadURI(uri, referrer)
}
}
function BrowserLoadURL()
function BrowserLoadURL(aTriggeringEvent)
{
var url = gURLBar.value;
if (url.match(/^view-source:/)) {
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null);
} 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
getBrowser().selectedTab = t;
}
@ -1454,10 +1457,10 @@ function handleURLBarRevert()
return isScrolling;
}
function handleURLBarCommand(aUserAction)
function handleURLBarCommand(aUserAction, aTriggeringEvent)
{
addToUrlbarHistory();
BrowserLoadURL();
BrowserLoadURL(aTriggeringEvent);
}
function UpdatePageProxyState()

View File

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

View File

@ -594,7 +594,7 @@
}
if (this.mFinishAfterSearch)
this.finishAutoComplete(false, this.mFireAfterSearch);
this.finishAutoComplete(false, this.mFireAfterSearch, null);
]]></body>
</method>
@ -603,6 +603,7 @@
<method name="finishAutoComplete">
<parameter name="aForceComplete"/>
<parameter name="aFireTextCommand"/>
<parameter name="aTriggeringEvent"/>
<body><![CDATA[
this.mFinishAfterSearch = false;
this.mFireAfterSearch = false;
@ -656,7 +657,7 @@
this.clearTimer();
if (aFireTextCommand)
this._fireEvent("textcommand", this.userAction);
this._fireEvent("textcommand", this.userAction, aTriggeringEvent);
]]></body>
</method>
@ -789,7 +790,7 @@
}
killEvent = this.mMenuOpen;
this.finishAutoComplete(true, true);
this.finishAutoComplete(true, true, aEvent);
this.closeResultPopup();
if (errItem) {
this._fireEvent("errorcommand", errItem);
@ -1018,14 +1019,15 @@
<method name="_fireEvent">
<parameter name="aEventType"/>
<parameter name="aEventParam"/>
<parameter name="aTriggeringEvent"/>
<body>
<![CDATA[
var noCancel = true;
// handle any xml attribute event handlers
var handler = this.getAttribute("on"+aEventType);
if (handler) {
var fn = new Function("eventParam", handler);
var returned = fn.apply(this, [aEventParam]);
var fn = new Function("eventParam", "domEvent", handler);
var returned = fn.apply(this, [aEventParam, aTriggeringEvent]);
if (returned == false)
noCancel = false;
}
@ -1194,7 +1196,7 @@
action="this.userAction = 'typing';"/>
<handler event="blur" phase="capturing"
action="this.userAction = 'none'; this.finishAutoComplete(false, false);"/>
action="this.userAction = 'none'; this.finishAutoComplete(false, false, event);"/>
</handlers>
</binding>