Bug 15050, bug 109650: if user starts typing after page load kicks off, but before it replaces the url, don't overwrite what the user just typed, but do update the rest of the UI, doh!, and make sure switching tabs does replace what the user typed. r=ben, sr=hewitt.

This commit is contained in:
jaggernaut%netscape.com 2001-11-13 09:00:22 +00:00
Родитель 4d95884d35
Коммит 665f9f9052
2 изменённых файлов: 29 добавлений и 8 удалений

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

@ -180,7 +180,7 @@ Contributor(s): ______________________________________. -->
defaultSearchEngine="true" tabScrolling="true"
showCommentColumn="true"
tooltiptext="&locationBar.tooltip;"
oninput="window.XULBrowserWindow.userTyped=true;"
oninput="window.XULBrowserWindow.userTyped.value=true;"
ontextcommand="return handleURLBarCommand(userAction);"
ontextrevert="return handleURLBarRevert();"
onfocus="URLBarFocusHandler(event);"

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

@ -49,7 +49,27 @@ function nsBrowserStatusHandler()
nsBrowserStatusHandler.prototype =
{
userTyped : false,
userTyped :
{
_value : false,
browser : null,
get value() {
if (this.browser != getBrowser().mCurrentBrowser)
this._value = false;
return this._value;
},
set value(aValue) {
if (this._value != aValue) {
this._value = aValue;
this.browser = aValue ? getBrowser().mCurrentBrowser : null;
}
return aValue;
},
},
useRealProgressFlag : false,
totalRequests : 0,
@ -102,6 +122,7 @@ nsBrowserStatusHandler.prototype =
this.stopMenu = null;
this.stopContext = null;
this.statusTextField = null;
this.userTyped = null;
},
setJSStatus : function(status)
@ -253,11 +274,7 @@ nsBrowserStatusHandler.prototype =
onLocationChange : function(aWebProgress, aRequest, aLocation)
{
if (this.userTyped)
return;
var location = aLocation.spec;
domWindow = aWebProgress.DOMWindow;
if (this.hideAboutBlank) {
this.hideAboutBlank = false;
@ -269,8 +286,12 @@ nsBrowserStatusHandler.prototype =
// searched
// Update urlbar only if a new page was loaded on the primary content area
// Do not update urlbar if there was a subframe navigation
var domWindow = aWebProgress.DOMWindow;
if (domWindow == domWindow.top) {
this.urlBar.value = location;
if (!this.userTyped.value)
this.urlBar.value = location;
SetPageProxyState("valid", aLocation);
}
UpdateBackForwardButtons();
@ -298,7 +319,7 @@ nsBrowserStatusHandler.prototype =
{
// Reset so we can see if the user typed after the document load
// starting and the location changing.
this.userTyped = false;
this.userTyped.value = false;
const nsIChannel = Components.interfaces.nsIChannel;
var urlStr = aRequest.QueryInterface(nsIChannel).URI.spec;