зеркало из https://github.com/mozilla/pjs.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:
Родитель
d44d1fe9a1
Коммит
48731e93e1
|
@ -199,11 +199,13 @@
|
|||
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
|
||||
// Reset so we can see if the user typed between the document
|
||||
// load starting and the location changing.
|
||||
// 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
|
||||
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
||||
this.mBrowser.userTypedValue = null;
|
||||
this.mBrowser.userTypedClear = true;
|
||||
|
||||
if (!this.mBlank) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
|
@ -217,6 +219,11 @@
|
|||
}
|
||||
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
// The document is done loading, it's okay to clear
|
||||
// the value again.
|
||||
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
||||
this.mBrowser.userTypedClear = false;
|
||||
|
||||
if (this.mBlank)
|
||||
this.mBlank = false;
|
||||
|
||||
|
@ -261,6 +268,10 @@
|
|||
this.mTabBrowser.forwardBrowserGroup = [];
|
||||
}
|
||||
|
||||
// The document loaded correctly, clear the value if we should
|
||||
if (this.mBrowser.userTypedClear)
|
||||
this.mBrowser.userTypedValue = null;
|
||||
|
||||
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||
var p = this.mTabBrowser.mProgressListeners[i];
|
||||
|
@ -474,6 +485,11 @@
|
|||
var loc = this.mCurrentBrowser.currentURI;
|
||||
var webProgress = this.mCurrentBrowser.webProgress;
|
||||
var securityUI = this.mCurrentBrowser.securityUI;
|
||||
// Remember the current clear state, then set it to false
|
||||
// so we don't clear the userTypedValue when just switching
|
||||
// tabs. Set it back to its old state after we're done.
|
||||
var userTypedClear = this.mCurrentBrowser.userTypedClear;
|
||||
this.mCurrentBrowser.userTypedClear = false;
|
||||
var i, p;
|
||||
for (i = 0; i < this.mProgressListeners.length; i++) {
|
||||
p = this.mProgressListeners[i];
|
||||
|
@ -486,6 +502,7 @@
|
|||
p.onLinkIconAvailable(listener.mIcon);
|
||||
}
|
||||
}
|
||||
this.mCurrentBrowser.userTypedClear = userTypedClear;
|
||||
|
||||
// Update the window title.
|
||||
this.updateTitlebar();
|
||||
|
@ -781,9 +798,11 @@
|
|||
this.mTabFilters[position] = filter;
|
||||
|
||||
if (!blank) {
|
||||
b.loadURIWithFlags(aURI, nsIWebNavigation.LOAD_FLAGS_NONE,
|
||||
aReferrerURI, null, null);
|
||||
// pretend the user typed this so it'll be available till
|
||||
// the document successfully loads
|
||||
b.userTypedValue = aURI;
|
||||
|
||||
b.loadURI(aURI, aReferrerURI);
|
||||
}
|
||||
|
||||
return t;
|
||||
|
@ -1311,6 +1330,10 @@
|
|||
onget="return this.mCurrentBrowser.securityUI;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="userTypedClear"
|
||||
onget="return this.mCurrentBrowser.userTypedClear;"
|
||||
onset="return this.mCurrentBrowser.userTypedClear = val;"/>
|
||||
|
||||
<property name="userTypedValue"
|
||||
onget="return this.mCurrentBrowser.userTypedValue;"
|
||||
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче