Bug 104778: Remember what user typed when switching tabs.

Bug 103720: prefill URI when opening new tab.
r=varga, sr=ben
This commit is contained in:
jaggernaut%netscape.com 2007-03-31 23:07:37 +00:00
Родитель 0a4dae3ceb
Коммит d44d1fe9a1
1 изменённых файлов: 33 добавлений и 15 удалений

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

@ -161,12 +161,14 @@
<!-- A web progress listener object definition for a given tab. -->
<method name="mTabProgressListener">
<parameter name="aTab"/>
<parameter name="aBrowser"/>
<parameter name="aStartsBlank"/>
<body>
<![CDATA[
return ({
mTabBrowser: this,
mTab: aTab,
mBrowser: aBrowser,
mBlank: aStartsBlank,
mIcon: "",
@ -194,8 +196,16 @@
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");
@ -204,6 +214,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)
@ -708,7 +719,9 @@
}
// Wire up a progress listener to our filter.
const listener = this.mTabProgressListener(this.mCurrentTab, false);
const listener = this.mTabProgressListener(this.mCurrentTab,
this.mCurrentBrowser,
false);
filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[0] = listener;
]]>
@ -747,7 +760,6 @@
b.setAttribute("type", "content");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
//b.setAttribute("src", "");
this.mPanelContainer.appendChild(b);
@ -760,7 +772,7 @@
// wire up a progress listener for the new browser object.
var position = this.mTabContainer.childNodes.length-1;
var tabListener = this.mTabProgressListener(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);
@ -768,9 +780,11 @@
this.mTabListeners[position] = tabListener;
this.mTabFilters[position] = filter;
if (!blank)
if (!blank) {
b.loadURIWithFlags(aURI, nsIWebNavigation.LOAD_FLAGS_NONE,
aReferrerURI, null, null);
b.userTypedValue = aURI;
}
return t;
]]>
@ -1297,6 +1311,10 @@
onget="return this.mCurrentBrowser.securityUI;"
readonly="true"/>
<property name="userTypedValue"
onget="return this.mCurrentBrowser.userTypedValue;"
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
<constructor>
<![CDATA[
this.mCurrentBrowser = this.mPanelContainer.firstChild;