зеркало из https://github.com/mozilla/gecko-dev.git
Bug 104778, part 2: also remember what the user typed when loading a page in the
current tab fails. r=Neil, sr=bryner
This commit is contained in:
Родитель
5b55589ce4
Коммит
aff0118706
|
@ -596,6 +596,7 @@ function Startup()
|
|||
|
||||
if (uriToLoad != "about:blank") {
|
||||
gURLBar.value = uriToLoad;
|
||||
getBrowser().userTypedValue = uriToLoad;
|
||||
if ("arguments" in window && window.arguments.length >= 3) {
|
||||
loadURI(uriToLoad, window.arguments[2]);
|
||||
} else {
|
||||
|
@ -1271,7 +1272,7 @@ function BrowserCloseWindow()
|
|||
function loadURI(uri, referrer)
|
||||
{
|
||||
try {
|
||||
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, referrer, null, null);
|
||||
getBrowser().loadURI(uri, referrer);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,6 +298,10 @@ nsBrowserStatusHandler.prototype =
|
|||
|
||||
var browser = getBrowser().selectedBrowser;
|
||||
if (aWebProgress.DOMWindow == content) {
|
||||
// The document loaded correctly, clear the value if we should
|
||||
if (browser.userTypedClear)
|
||||
browser.userTypedValue = null;
|
||||
|
||||
var userTypedValue = browser.userTypedValue;
|
||||
if (userTypedValue === null) {
|
||||
this.urlBar.value = location;
|
||||
|
@ -372,9 +376,12 @@ nsBrowserStatusHandler.prototype =
|
|||
|
||||
startDocumentLoad : function(aRequest)
|
||||
{
|
||||
// Reset so we can see if the user typed between the document load
|
||||
// starting and the location changing.
|
||||
getBrowser().userTypedValue = null;
|
||||
// It's okay to clear what the user typed when we start
|
||||
// loading a document. If the user types, this flag gets
|
||||
// set to false, if the document load ends without an
|
||||
// onLocationChange, this flag also gets set to false
|
||||
// (so we keep it while switching tabs after failed load
|
||||
getBrowser().userTypedClear = true;
|
||||
|
||||
const nsIChannel = Components.interfaces.nsIChannel;
|
||||
var urlStr = aRequest.QueryInterface(nsIChannel).URI.spec;
|
||||
|
@ -388,6 +395,10 @@ nsBrowserStatusHandler.prototype =
|
|||
|
||||
endDocumentLoad : function(aRequest, aStatus)
|
||||
{
|
||||
// The document is done loading, it's okay to clear
|
||||
// the value again.
|
||||
getBrowser().userTypedClear = false;
|
||||
|
||||
const nsIChannel = Components.interfaces.nsIChannel;
|
||||
var urlStr = aRequest.QueryInterface(nsIChannel).originalURI.spec;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче