bug 203102 - Investigate/port patches for URL field... Tab browser should remember user's typed value when switching tabs. Also, prevent about:blank from showing up when it shouldn't. Based on a patch by Will Levine <yakgoatcamel@myrealbox.com> with some modifications.

This commit is contained in:
ben@bengoodger.com 2007-08-21 21:59:22 -07:00
parent 30f8ad8f4c
commit c7a7a3ea30

View File

@ -154,14 +154,15 @@
<!-- A web progress listener object definition for a given tab. -->
<method name="mTabProgressListener">
<parameter name="aTabBrowser"/>
<parameter name="aTab"/>
<parameter name="aBrowser"/>
<parameter name="aStartsBlank"/>
<body>
<![CDATA[
return ({
mTabBrowser: aTabBrowser,
mTabBrowser: this,
mTab: aTab,
mBrowser: aBrowser,
mBlank: aStartsBlank,
mIcon: "",
@ -189,8 +190,15 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
if (!this.mBlank && aStateFlags & nsIWebProgressListener.STATE_START &&
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.
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
this.mBrowser.userTypedValue = null;
if (!this.mBlank) {
this.mTab.setAttribute("busy", "true");
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
this.mTab.removeAttribute("image");
@ -199,6 +207,7 @@
if (this.mTabBrowser.mCurrentTab == this.mTab)
this.mTabBrowser.mIsBusy = true;
}
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
if (this.mBlank)
@ -666,7 +675,7 @@
}
// Wire up a progress listener to our filter.
const listener = (this.mTabProgressListener)(this, this.mCurrentTab, false);
const listener = this.mTabProgressListener(this.mCurrentTab, this.mCurrentBrowser, false);
filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[0] = listener;
]]>
@ -725,7 +734,7 @@
// wire up a progress listener for the new browser object.
var position = this.mTabContainer.childNodes.length-1;
var tabListener = (this.mTabProgressListener)(this, t, blank);
var tabListener = this.mTabProgressListener(t, b, blank);
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
.createInstance(Components.interfaces.nsIWebProgress);
filter.addProgressListener(tabListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
@ -1240,6 +1249,10 @@
onget="return this.mCurrentBrowser.canFindAgain;"
readonly="true"/>
<property name="userTypedValue"
onget="return this.mCurrentBrowser.userTypedValue;"
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
<constructor>
<![CDATA[
this.mCurrentBrowser = this.mPanelContainer.firstChild;