2002-08-10 06:53:22 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
2005-02-01 17:07:35 +00:00
|
|
|
<!-- ***** BEGIN LICENSE BLOCK *****
|
|
|
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2002-08-10 06:53:22 +00:00
|
|
|
-
|
2005-02-01 17:07:35 +00:00
|
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
- the License. You may obtain a copy of the License at
|
|
|
|
- http://www.mozilla.org/MPL/
|
2002-08-10 06:53:22 +00:00
|
|
|
-
|
2005-02-01 17:07:35 +00:00
|
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
- for the specific language governing rights and limitations under the
|
|
|
|
- License.
|
2002-08-10 06:53:22 +00:00
|
|
|
-
|
2005-02-01 17:07:35 +00:00
|
|
|
- The Original Code is this file as it was released on March 28, 2001.
|
|
|
|
-
|
|
|
|
- The Initial Developer of the Original Code is
|
|
|
|
- David Hyatt.
|
|
|
|
- Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
- the Initial Developer. All Rights Reserved.
|
2002-08-10 06:53:22 +00:00
|
|
|
-
|
|
|
|
- Contributor(s):
|
|
|
|
- David Hyatt <hyatt@netscape.com> (Original Author of <tabbrowser>)
|
|
|
|
-
|
2005-02-01 17:07:35 +00:00
|
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
|
|
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
- in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
- of those above. If you wish to allow use of your version of this file only
|
|
|
|
- under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
- use your version of this file under the terms of the MPL, indicate your
|
|
|
|
- decision by deleting the provisions above and replace them with the notice
|
|
|
|
- and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
- the provisions above, a recipient may use your version of this file under
|
|
|
|
- the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
-
|
|
|
|
- ***** END LICENSE BLOCK ***** -->
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
<!DOCTYPE bindings [
|
|
|
|
<!ENTITY % tabBrowserDTD SYSTEM "chrome://global/locale/tabbrowser.dtd" >
|
|
|
|
%tabBrowserDTD;
|
|
|
|
]>
|
|
|
|
|
|
|
|
<bindings id="tabBrowserBindings"
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl">
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<binding id="tabbrowser">
|
|
|
|
<resources>
|
|
|
|
<stylesheet src="chrome://global/skin/browser.css"/>
|
|
|
|
</resources>
|
|
|
|
|
|
|
|
<content>
|
|
|
|
<xul:stringbundle src="chrome://global/locale/tabbrowser.properties"/>
|
2004-12-01 20:33:16 +00:00
|
|
|
<xul:tabbox flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown"
|
2002-08-10 06:53:22 +00:00
|
|
|
onselect="if (!('updateCurrentBrowser' in this.parentNode) || event.target.localName != 'tabpanels') return; this.parentNode.updateCurrentBrowser();">
|
|
|
|
<xul:hbox class="tabbrowser-strip chromeclass-toolbar" collapsed="true" tooltip="_child" context="_child">
|
|
|
|
<xul:tooltip onpopupshowing="event.preventBubble(); if (document.tooltipNode.hasAttribute('label')) { this.setAttribute('label', document.tooltipNode.getAttribute('label')); return true; } return false;"/>
|
|
|
|
<xul:menupopup onpopupshowing="this.parentNode.parentNode.parentNode.updatePopupMenu(this);">
|
|
|
|
<xul:menuitem label="&newTab.label;" accesskey="&newTab.accesskey;"
|
|
|
|
xbl:inherits="oncommand=onnewtab"/>
|
|
|
|
<xul:menuseparator/>
|
|
|
|
<xul:menuitem label="&reloadTab.label;" accesskey="&reloadTab.accesskey;"
|
|
|
|
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
|
|
|
|
tabbrowser.reloadTab(tabbrowser.mContextTab);"/>
|
|
|
|
<xul:menuitem label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
|
|
|
|
tbattr="tabbrowser-multiple"
|
|
|
|
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
|
|
|
|
tabbrowser.reloadAllTabs(tabbrowser.mContextTab);"/>
|
2003-08-07 19:01:27 +00:00
|
|
|
<xul:menuitem label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
|
|
|
|
tbattr="tabbrowser-multiple"
|
|
|
|
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
|
|
|
|
tabbrowser.removeAllTabsBut(tabbrowser.mContextTab);"/>
|
2002-08-10 06:53:22 +00:00
|
|
|
<xul:menuseparator/>
|
|
|
|
<xul:menuitem label="&closeTab.label;" accesskey="&closeTab.accesskey;"
|
|
|
|
tbattr="tabbrowser-multiple"
|
|
|
|
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
|
|
|
|
tabbrowser.removeTab(tabbrowser.mContextTab);"/>
|
|
|
|
</xul:menupopup>
|
|
|
|
|
|
|
|
<xul:tabs class="tabbrowser-tabs" closebutton="true" flex="1"
|
2003-12-16 00:16:19 +00:00
|
|
|
setfocus="false"
|
2002-08-10 06:53:22 +00:00
|
|
|
onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
|
|
|
|
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode);
|
|
|
|
event.stopPropagation();"
|
|
|
|
ondragdrop="nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode);
|
|
|
|
event.stopPropagation();"
|
|
|
|
xbl:inherits="onnewtab"
|
2004-09-19 17:31:28 +00:00
|
|
|
ondblclick="this.parentNode.parentNode.parentNode.onTabBarDblClick(event);"
|
2002-08-10 06:53:22 +00:00
|
|
|
onclosetab="var node = this.parentNode;
|
|
|
|
while (node.localName != 'tabbrowser')
|
|
|
|
node = node.parentNode;
|
|
|
|
node.removeCurrentTab();">
|
2004-12-05 22:03:50 +00:00
|
|
|
<xul:tab selected="true" validate="never"
|
2002-08-10 06:53:22 +00:00
|
|
|
onerror="this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image'));
|
|
|
|
this.removeAttribute('image');"
|
|
|
|
maxwidth="250" width="0" minwidth="30" flex="100"
|
|
|
|
class="tabbrowser-tab" label="&untitledTab;" crop="end"/>
|
|
|
|
</xul:tabs>
|
|
|
|
</xul:hbox>
|
2004-12-05 22:03:50 +00:00
|
|
|
<xul:tabpanels flex="1" class="plain" selectedIndex="0">
|
2004-12-01 04:48:44 +00:00
|
|
|
<xul:vbox flex="1">
|
|
|
|
<xul:browsermessage hidden="true" type="top"/>
|
|
|
|
<xul:browser flex="1" type="content-primary" message="true" disablehistory="true" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/>
|
|
|
|
<xul:browsermessage hidden="true" type="bottom"/>
|
|
|
|
</xul:vbox>
|
2002-08-10 06:53:22 +00:00
|
|
|
</xul:tabpanels>
|
|
|
|
</xul:tabbox>
|
|
|
|
<children/>
|
|
|
|
</content>
|
|
|
|
<implementation>
|
|
|
|
<field name="mPrefs" readonly="true">
|
|
|
|
Components.classes['@mozilla.org/preferences-service;1']
|
|
|
|
.getService(Components.interfaces.nsIPrefService)
|
|
|
|
.getBranch(null);
|
|
|
|
</field>
|
2005-02-06 20:33:26 +00:00
|
|
|
<field name="mURIFixup" readonly="true">
|
|
|
|
Components.classes["@mozilla.org/docshell/urifixup;1"]
|
|
|
|
.getService(Components.interfaces.nsIURIFixup);
|
|
|
|
</field>
|
2002-08-10 06:53:22 +00:00
|
|
|
<field name="mTabBox">
|
|
|
|
document.getAnonymousNodes(this)[1]
|
|
|
|
</field>
|
|
|
|
<field name="mStrip">
|
|
|
|
this.mTabBox.firstChild
|
|
|
|
</field>
|
|
|
|
<field name="mTabContainer">
|
|
|
|
this.mStrip.childNodes[2]
|
|
|
|
</field>
|
|
|
|
<field name="mPanelContainer">
|
|
|
|
this.mTabBox.childNodes[1]
|
|
|
|
</field>
|
|
|
|
<field name="mStringBundle">
|
|
|
|
document.getAnonymousNodes(this)[0]
|
|
|
|
</field>
|
|
|
|
<field name="mCurrentTab">
|
|
|
|
null
|
|
|
|
</field>
|
|
|
|
<field name="mCurrentBrowser">
|
|
|
|
null
|
|
|
|
</field>
|
|
|
|
<field name="mProgressListeners">
|
|
|
|
null
|
|
|
|
</field>
|
|
|
|
<field name="mTabListeners">
|
|
|
|
new Array()
|
|
|
|
</field>
|
|
|
|
<field name="mTabFilters">
|
|
|
|
new Array()
|
|
|
|
</field>
|
|
|
|
<field name="mTabbedMode">
|
|
|
|
false
|
|
|
|
</field>
|
|
|
|
<field name="mIsBusy">
|
|
|
|
false
|
|
|
|
</field>
|
|
|
|
<field name="mMissedIconCache">
|
|
|
|
null
|
|
|
|
</field>
|
|
|
|
<field name="mContextTab">
|
|
|
|
null
|
|
|
|
</field>
|
2004-11-03 17:06:21 +00:00
|
|
|
<field name="mModalDialogShowing">
|
|
|
|
false
|
|
|
|
</field>
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
<method name="getBrowserAtIndex">
|
|
|
|
<parameter name="aIndex"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mPanelContainer.childNodes[aIndex].firstChild.nextSibling;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="getBrowserIndexForDocument">
|
|
|
|
<parameter name="aDocument"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
for (var i = 0; i < this.mPanelContainer.childNodes.length; i++) {
|
|
|
|
if (this.getBrowserAtIndex(i).contentDocument == aDocument) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="getMessageForBrowser">
|
|
|
|
<parameter name="aBrowser"/>
|
|
|
|
<parameter name="aTopBottom"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return aBrowser[aTopBottom == "top" ? "previousSibling" : "nextSibling"];
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="showMessage">
|
|
|
|
<parameter name="aBrowser"/>
|
|
|
|
<parameter name="aIconURL"/>
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<parameter name="aButtonLabel"/>
|
|
|
|
<parameter name="aDocShell"/>
|
|
|
|
<parameter name="aSource"/>
|
|
|
|
<parameter name="aPopup"/>
|
|
|
|
<parameter name="aTopBottom"/>
|
|
|
|
<parameter name="aShowCloseButton"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var message = this.getMessageForBrowser(aBrowser, aTopBottom);
|
|
|
|
message.image = aIconURL;
|
|
|
|
message.text = aMessage;
|
|
|
|
message.buttonText = aButtonLabel;
|
|
|
|
message.hidden = false;
|
|
|
|
if (aSource) {
|
|
|
|
message.source = aSource;
|
|
|
|
message.popup = null;
|
|
|
|
}
|
|
|
|
else if (aPopup) {
|
|
|
|
message.popup = aPopup;
|
|
|
|
message.source = null;
|
|
|
|
}
|
|
|
|
message.docShell = aDocShell;
|
|
|
|
message.closeButton = aShowCloseButton;
|
|
|
|
aBrowser.isShowingMessage = true;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="hideMessage">
|
|
|
|
<parameter name="aBrowser"/>
|
|
|
|
<parameter name="aTopBottom"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (aTopBottom != "both")
|
|
|
|
this.getMessageForBrowser(aBrowser, aTopBottom).hidden = true;
|
|
|
|
else {
|
|
|
|
this.getMessageForBrowser(aBrowser, "top").hidden = true;
|
|
|
|
this.getMessageForBrowser(aBrowser, "bottom").hidden = true;
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2002-08-10 06:53:22 +00:00
|
|
|
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
<!-- A web progress listener object definition for a given tab. -->
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="mTabProgressListener">
|
|
|
|
<parameter name="aTab"/>
|
2003-12-05 05:55:54 +00:00
|
|
|
<parameter name="aBrowser"/>
|
2002-08-10 06:53:22 +00:00
|
|
|
<parameter name="aStartsBlank"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return ({
|
2003-12-05 05:55:54 +00:00
|
|
|
mTabBrowser: this,
|
2002-08-10 06:53:22 +00:00
|
|
|
mTab: aTab,
|
2003-12-05 05:55:54 +00:00
|
|
|
mBrowser: aBrowser,
|
2002-08-10 06:53:22 +00:00
|
|
|
mBlank: aStartsBlank,
|
2004-12-01 04:48:44 +00:00
|
|
|
mIcon: null,
|
|
|
|
mLastURI: null,
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
onProgressChange : function (aWebProgress, aRequest,
|
|
|
|
aCurSelfProgress, aMaxSelfProgress,
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
aCurTotalProgress, aMaxTotalProgress)
|
|
|
|
{
|
2002-08-10 06:53:22 +00:00
|
|
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
|
|
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mTabBrowser.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onProgressChange(aWebProgress, aRequest,
|
|
|
|
aCurSelfProgress, aMaxSelfProgress,
|
|
|
|
aCurTotalProgress, aMaxTotalProgress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
|
|
|
|
{
|
|
|
|
if (!aRequest)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var oldBlank = this.mBlank;
|
|
|
|
|
|
|
|
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
|
|
|
const nsIChannel = Components.interfaces.nsIChannel;
|
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
if (aStateFlags & nsIWebProgressListener.STATE_START)
|
|
|
|
this.mBrowser.mFavIconURL = null;
|
|
|
|
|
2004-12-01 16:21:02 +00:00
|
|
|
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
2003-12-05 05:55:54 +00:00
|
|
|
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
2004-07-24 00:24:30 +00:00
|
|
|
// 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
|
2003-12-05 05:55:54 +00:00
|
|
|
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
2004-07-24 00:24:30 +00:00
|
|
|
this.mBrowser.userTypedClear = true;
|
2003-12-05 05:55:54 +00:00
|
|
|
|
|
|
|
if (!this.mBlank) {
|
|
|
|
this.mTab.setAttribute("busy", "true");
|
|
|
|
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
|
2004-12-01 16:21:02 +00:00
|
|
|
this.mTab.removeAttribute("image");
|
2004-12-01 04:48:44 +00:00
|
|
|
this.mIcon = null;
|
2003-12-05 05:55:54 +00:00
|
|
|
|
|
|
|
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
|
|
|
this.mTabBrowser.mIsBusy = true;
|
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
|
|
|
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
2004-07-24 00:24:30 +00:00
|
|
|
// The document is done loading, it's okay to clear
|
|
|
|
// the value again.
|
|
|
|
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
|
|
|
this.mBrowser.userTypedClear = false;
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (this.mBlank)
|
|
|
|
this.mBlank = false;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
this.mTab.removeAttribute("busy");
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var location = aRequest.QueryInterface(nsIChannel).URI;
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
// For keyword URIs clear the user typed value since they will be changed into real URIs
|
|
|
|
if (location.scheme == "keyword")
|
|
|
|
this.mBrowser.userTypedValue = null;
|
|
|
|
|
|
|
|
if (this.mTabBrowser.shouldLoadFavIcon(location)) {
|
|
|
|
if (this.mIcon)
|
|
|
|
this.mTab.setAttribute("image", this.mIcon);
|
|
|
|
else
|
|
|
|
this.mTabBrowser.loadFavIcon(location, "image", this.mTab);
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
|
|
|
|
this.mTabBrowser.setTabTitle(this.mTab);
|
|
|
|
|
|
|
|
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
|
|
|
this.mTabBrowser.mIsBusy = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!oldBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
|
|
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mTabBrowser.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
|
|
|
}
|
|
|
|
}
|
2004-12-01 16:21:02 +00:00
|
|
|
},
|
2002-08-10 06:53:22 +00:00
|
|
|
|
2004-12-01 16:21:02 +00:00
|
|
|
onLocationChange : function(aWebProgress, aRequest, aLocation)
|
|
|
|
{
|
2004-07-24 00:24:30 +00:00
|
|
|
// The document loaded correctly, clear the value if we should
|
|
|
|
if (this.mBrowser.userTypedClear)
|
|
|
|
this.mBrowser.userTypedValue = null;
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
|
|
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mTabBrowser.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onLocationChange(aWebProgress, aRequest, aLocation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2004-12-01 16:21:02 +00:00
|
|
|
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
|
|
|
|
{
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
if (this.mBlank)
|
2002-08-10 06:53:22 +00:00
|
|
|
return;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
|
|
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mTabBrowser.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
onSecurityChange : function(aWebProgress, aRequest, aState)
|
|
|
|
{
|
2002-08-10 06:53:22 +00:00
|
|
|
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
|
|
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mTabBrowser.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onSecurityChange(aWebProgress, aRequest, aState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
QueryInterface : function(aIID)
|
|
|
|
{
|
|
|
|
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
|
|
|
|
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
|
|
|
|
aIID.equals(Components.interfaces.nsISupports))
|
|
|
|
return this;
|
|
|
|
throw Components.results.NS_NOINTERFACE;
|
|
|
|
}
|
2004-12-01 16:21:02 +00:00
|
|
|
});
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2004-12-01 04:48:44 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="buildFavIconString">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var end = (aURI.port == -1) ? "/favicon.ico" : (":" + aURI.port + "/favicon.ico");
|
|
|
|
return aURI.scheme + "://" + aURI.host + end;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="shouldLoadFavIcon">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return (aURI && this.mPrefs.getBoolPref("browser.chrome.site_icons") &&
|
2004-12-01 16:21:02 +00:00
|
|
|
this.mPrefs.getBoolPref("browser.chrome.favicons") &&
|
2002-08-10 06:53:22 +00:00
|
|
|
("schemeIs" in aURI) && (aURI.schemeIs("http") || aURI.schemeIs("https")));
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="loadFavIcon">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<parameter name="aAttr"/>
|
|
|
|
<parameter name="aElt"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var iconURL = this.buildFavIconString(aURI);
|
2004-12-01 04:48:44 +00:00
|
|
|
if (!this.isFavIconKnownMissing(iconURL))
|
2002-08-10 06:53:22 +00:00
|
|
|
aElt.setAttribute(aAttr, iconURL);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="addToMissedIconCache">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
var entry = this.openCacheEntry(aURI, Components.interfaces.nsICache.ACCESS_READ_WRITE);
|
|
|
|
if (!entry)
|
|
|
|
return;
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (entry.accessGranted == Components.interfaces.nsICache.ACCESS_WRITE)
|
|
|
|
// It's a new entry. Just write a bit of metadata in to the entry.
|
|
|
|
entry.setMetaDataElement("Icon", "Missed");
|
|
|
|
entry.markValid();
|
|
|
|
entry.close();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
<method name="openCacheEntry">
|
|
|
|
<parameter name="key"/>
|
|
|
|
<parameter name="access"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
try {
|
|
|
|
if (!this.mMissedIconCache) {
|
|
|
|
var cacheService = Components.classes['@mozilla.org/network/cache-service;1'].getService(Components.interfaces.nsICacheService);
|
|
|
|
this.mMissedIconCache = cacheService.createSession("MissedIconCache", Components.interfaces.nsICache.STORE_ANYWHERE, true);
|
|
|
|
if (!this.mMissedIconCache)
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return this.mMissedIconCache.openCacheEntry(key, access, true);
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
<method name="isFavIconKnownMissing">
|
|
|
|
<parameter name="key"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var e = this.openCacheEntry(key, Components.interfaces.nsICache.ACCESS_READ);
|
|
|
|
if (e) {
|
|
|
|
e.close();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="updateTitlebar">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var newTitle = "";
|
|
|
|
var docTitle;
|
|
|
|
if (this.docShell.contentViewer)
|
2004-09-29 00:36:32 +00:00
|
|
|
docTitle = this.contentTitle;
|
2004-12-01 04:48:44 +00:00
|
|
|
|
2004-12-01 19:15:37 +00:00
|
|
|
if (!docTitle)
|
|
|
|
docTitle = this.ownerDocument.documentElement.getAttribute("titledefault");
|
2004-10-03 16:13:33 +00:00
|
|
|
|
|
|
|
var modifier = this.ownerDocument.documentElement.getAttribute("titlemodifier");
|
2002-08-10 06:53:22 +00:00
|
|
|
if (docTitle) {
|
|
|
|
newTitle += this.ownerDocument.documentElement.getAttribute("titlepreface");
|
|
|
|
newTitle += docTitle;
|
2004-10-03 16:13:33 +00:00
|
|
|
var sep = this.ownerDocument.documentElement.getAttribute("titlemenuseparator");
|
|
|
|
if (modifier)
|
|
|
|
newTitle += sep;
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
2003-08-12 02:19:28 +00:00
|
|
|
newTitle += modifier;
|
2004-12-01 11:42:34 +00:00
|
|
|
this.ownerDocument.title = newTitle;
|
2004-12-01 04:48:44 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="updatePopupMenu">
|
|
|
|
<parameter name="aPopupMenu"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2004-12-01 19:15:37 +00:00
|
|
|
this.mContextTab = document.popupNode;
|
2002-08-10 06:53:22 +00:00
|
|
|
var disabled = this.mPanelContainer.childNodes.length == 1;
|
|
|
|
var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple");
|
|
|
|
for (var i = 0; i < menuItems.length; i++)
|
|
|
|
menuItems[i].setAttribute("disabled", disabled);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="updateCurrentBrowser">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2004-12-01 04:48:44 +00:00
|
|
|
var newBrowser = this.getBrowserAtIndex(this.mPanelContainer.selectedIndex);
|
2002-10-11 21:58:14 +00:00
|
|
|
if (this.mCurrentBrowser == newBrowser)
|
|
|
|
return;
|
|
|
|
|
2003-12-16 00:16:19 +00:00
|
|
|
if (this.mCurrentBrowser) {
|
|
|
|
this.mCurrentBrowser.focusedWindow = document.commandDispatcher.focusedWindow;
|
|
|
|
this.mCurrentBrowser.focusedElement = document.commandDispatcher.focusedElement;
|
2004-12-01 18:48:25 +00:00
|
|
|
if (this.mCurrentBrowser.focusedElement) {
|
|
|
|
// Clear focus outline before we draw on top of it
|
|
|
|
this.mCurrentBrowser.focusedElement.blur();
|
|
|
|
}
|
|
|
|
this.mCurrentBrowser.setAttribute("type", "content");
|
2003-12-16 00:16:19 +00:00
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
|
2002-10-11 22:16:19 +00:00
|
|
|
var updatePageReport = false;
|
|
|
|
if ((this.mCurrentBrowser.pageReport && !newBrowser.pageReport) ||
|
|
|
|
(!this.mCurrentBrowser.pageReport && newBrowser.pageReport))
|
|
|
|
updatePageReport = true;
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
newBrowser.setAttribute("type", "content-primary");
|
|
|
|
this.mCurrentBrowser = newBrowser;
|
|
|
|
this.mCurrentTab = this.selectedTab;
|
2004-12-01 04:48:44 +00:00
|
|
|
|
2002-10-11 22:16:19 +00:00
|
|
|
if (updatePageReport)
|
|
|
|
this.mCurrentBrowser.updatePageReport();
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
// Update the URL bar.
|
|
|
|
var loc = this.mCurrentBrowser.currentURI;
|
2002-10-11 22:16:19 +00:00
|
|
|
if (!loc)
|
|
|
|
loc = ({ spec: "" });
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var webProgress = this.mCurrentBrowser.webProgress;
|
|
|
|
var securityUI = this.mCurrentBrowser.securityUI;
|
2004-07-24 00:24:30 +00:00
|
|
|
// 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;
|
2002-08-10 06:53:22 +00:00
|
|
|
var i, p;
|
|
|
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
|
|
|
p = this.mProgressListeners[i];
|
|
|
|
if (p) {
|
|
|
|
p.onLocationChange(webProgress, null, loc);
|
|
|
|
if (securityUI)
|
|
|
|
p.onSecurityChange(webProgress, null, securityUI.state);
|
|
|
|
var listener = this.mTabListeners[this.mPanelContainer.selectedIndex];
|
2004-12-01 04:48:44 +00:00
|
|
|
if (listener.mIcon) {
|
|
|
|
if (this.isFavIconKnownMissing(listener.mIcon))
|
|
|
|
listener.mIcon = null;
|
2004-12-07 21:39:08 +00:00
|
|
|
else if ('onLinkIconAvailable' in p)
|
2004-12-01 04:48:44 +00:00
|
|
|
p.onLinkIconAvailable(newBrowser, listener.mIcon);
|
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
}
|
2004-07-24 00:24:30 +00:00
|
|
|
this.mCurrentBrowser.userTypedClear = userTypedClear;
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
this._fastFind.setDocShell(this.mCurrentBrowser.docShell);
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
// Update the window title.
|
|
|
|
this.updateTitlebar();
|
2004-12-01 16:21:02 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
// If the new tab is busy, and our current state is not busy, then
|
|
|
|
// we need to fire a start to all progress listeners.
|
|
|
|
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
|
|
|
if (this.mCurrentTab.hasAttribute("busy") && !this.mIsBusy) {
|
|
|
|
this.mIsBusy = true;
|
|
|
|
webProgress = this.mCurrentBrowser.webProgress;
|
|
|
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
|
|
|
p = this.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onStateChange(webProgress, null, nsIWebProgressListener.STATE_START | nsIWebProgressListener.STATE_IS_NETWORK, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the new tab is not busy, and our current state is busy, then
|
|
|
|
// we need to fire a stop to all progress listeners.
|
|
|
|
if (!this.mCurrentTab.hasAttribute("busy") && this.mIsBusy) {
|
|
|
|
this.mIsBusy = false;
|
|
|
|
webProgress = this.mCurrentBrowser.webProgress;
|
|
|
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
|
|
|
p = this.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
p.onStateChange(webProgress, null, nsIWebProgressListener.STATE_STOP | nsIWebProgressListener.STATE_IS_NETWORK, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-01 18:48:25 +00:00
|
|
|
if (document.commandDispatcher.focusedElement &&
|
|
|
|
document.commandDispatcher.focusedElement.parentNode ==
|
|
|
|
this.mCurrentTab.parentNode) {
|
|
|
|
// The focus is on a tab in the same tab panel
|
|
|
|
return; // If focus was on a tab, switching tabs focuses the new tab
|
2003-12-16 00:16:19 +00:00
|
|
|
}
|
|
|
|
|
2004-12-01 18:48:25 +00:00
|
|
|
var whatToFocus = window.content;
|
|
|
|
|
2003-12-16 00:16:19 +00:00
|
|
|
// Focus the previously focused element or window
|
|
|
|
if (newBrowser.focusedElement) {
|
2004-12-01 18:48:25 +00:00
|
|
|
if (newBrowser.focusedElement.parentNode !=
|
|
|
|
this.mCurrentTab.parentNode) {
|
|
|
|
// Focus the remembered element unless it's in the current tab panel
|
|
|
|
whatToFocus = newBrowser.focusedElement;
|
2003-12-16 00:16:19 +00:00
|
|
|
}
|
|
|
|
}
|
2004-12-01 18:48:25 +00:00
|
|
|
else if (newBrowser.focusedWindow) {
|
|
|
|
whatToFocus = newBrowser.focusedWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setFocus(element) {
|
|
|
|
document.commandDispatcher.suppressFocusScroll = true;
|
|
|
|
Components.lookupMethod(element, "focus").call(element);
|
2004-12-02 22:07:37 +00:00
|
|
|
document.commandDispatcher.suppressFocusScroll = false;
|
2004-12-01 18:48:25 +00:00
|
|
|
}
|
|
|
|
|
2004-12-02 22:07:37 +00:00
|
|
|
// Use setTimeout to avoid focus outline ghosting.
|
|
|
|
setTimeout(setFocus, 0, whatToFocus);
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onTabClick">
|
|
|
|
<parameter name="event"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (event.button != 1 || event.target.localName != 'tab' ||
|
|
|
|
this.mPrefs.getBoolPref("middlemouse.contentLoadURL"))
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
return;
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
this.removeTab(event.target);
|
|
|
|
event.stopPropagation();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onLinkAdded">
|
|
|
|
<parameter name="event"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2004-05-13 18:34:18 +00:00
|
|
|
// mechanism for reading properties of the underlying XPCOM object
|
|
|
|
// (ignoring potential getters/setters added by malicious content)
|
|
|
|
var safeGetProperty = function(obj, propname) {
|
|
|
|
return Components.lookupMethod(obj, propname).call(obj);
|
|
|
|
};
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var tabBrowser = this.parentNode.parentNode;
|
|
|
|
if (!tabBrowser.mPrefs.getBoolPref("browser.chrome.site_icons"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!event.target.rel.match((/(?:^|\s)icon(?:\s|$)/i)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We have an icon.
|
|
|
|
var href = event.target.href;
|
|
|
|
if (!href)
|
|
|
|
return;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2004-07-29 23:49:31 +00:00
|
|
|
const nsIContentPolicy = Components.interfaces.nsIContentPolicy;
|
2004-05-13 18:34:18 +00:00
|
|
|
try {
|
|
|
|
var contentPolicy =
|
|
|
|
Components.classes['@mozilla.org/layout/content-policy;1']
|
2004-07-29 23:49:31 +00:00
|
|
|
.getService(nsIContentPolicy);
|
2004-05-13 18:34:18 +00:00
|
|
|
} catch(e) {
|
2002-08-10 06:53:22 +00:00
|
|
|
return; // Refuse to load if we can't do a security check.
|
2004-05-13 18:34:18 +00:00
|
|
|
}
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2004-05-13 18:34:18 +00:00
|
|
|
// Verify that the load of this icon is legal.
|
|
|
|
// We check first with the security manager
|
|
|
|
const secMan =
|
|
|
|
Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
|
|
|
.getService(Components.interfaces.nsIScriptSecurityManager);
|
|
|
|
|
|
|
|
// Get the IOService so we can make URIs
|
|
|
|
const ioService =
|
|
|
|
Components.classes["@mozilla.org/network/io-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIIOService);
|
|
|
|
|
|
|
|
const targetDoc = safeGetProperty(event.target, "ownerDocument");
|
2002-08-10 06:53:22 +00:00
|
|
|
// Make a URI out of our href.
|
2004-05-13 18:34:18 +00:00
|
|
|
var docCharset = safeGetProperty(targetDoc, "characterSet");
|
|
|
|
var uri = ioService.newURI(href, docCharset, null);
|
|
|
|
|
|
|
|
var origURIStr = safeGetProperty(targetDoc, "documentURI");
|
|
|
|
var origURI = ioService.newURI(origURIStr, docCharset, null);
|
|
|
|
|
|
|
|
const nsIScriptSecMan =
|
|
|
|
Components.interfaces.nsIScriptSecurityManager;
|
|
|
|
|
|
|
|
try {
|
|
|
|
secMan.checkLoadURI(origURI, uri, nsIScriptSecMan.STANDARD);
|
|
|
|
} catch(e) {
|
|
|
|
return;
|
|
|
|
}
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2004-05-13 18:34:18 +00:00
|
|
|
// Security says okay, now ask content policy
|
2004-07-29 23:49:31 +00:00
|
|
|
if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_IMAGE,
|
|
|
|
uri, origURI, event.target,
|
|
|
|
safeGetProperty(event.target, "type"),
|
|
|
|
null) != nsIContentPolicy.ACCEPT)
|
|
|
|
return;
|
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
var browserIndex = tabBrowser.getBrowserIndexForDocument(targetDoc);
|
2004-07-29 23:49:31 +00:00
|
|
|
// no browser? no favicon.
|
|
|
|
if (browserIndex == -1)
|
2002-08-10 06:53:22 +00:00
|
|
|
return;
|
|
|
|
|
2004-07-29 23:49:31 +00:00
|
|
|
var listener = tabBrowser.mTabListeners[browserIndex];
|
|
|
|
// there's no tab listener for non-tabbed mode browser 0
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
if (tabBrowser.isFavIconKnownMissing(href)) {
|
|
|
|
if (listener)
|
|
|
|
listener.mIcon = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-07-29 23:49:31 +00:00
|
|
|
if (listener)
|
|
|
|
listener.mIcon = href;
|
|
|
|
|
|
|
|
if (tabBrowser.mProgressListeners) {
|
2004-12-01 04:48:44 +00:00
|
|
|
var targetBrowser = tabBrowser.getBrowserAtIndex(browserIndex);
|
2002-08-10 06:53:22 +00:00
|
|
|
for (i = 0; i < tabBrowser.mProgressListeners.length; i++) {
|
|
|
|
var p = tabBrowser.mProgressListeners[i];
|
2004-12-07 21:39:08 +00:00
|
|
|
if (p && 'onLinkIconAvailable' in p)
|
2004-07-29 23:49:31 +00:00
|
|
|
p.onLinkIconAvailable(targetBrowser, href);
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onTitleChanged">
|
|
|
|
<parameter name="evt"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (evt.target != this.contentDocument)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var i = 0;
|
2004-12-01 04:48:44 +00:00
|
|
|
for ( ; i < this.parentNode.parentNode.childNodes.length; i++) {
|
|
|
|
if (this.parentNode.parentNode.childNodes[i].firstChild.nextSibling == this)
|
2002-08-10 06:53:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
var tabBrowser = this.parentNode.parentNode.parentNode.parentNode;
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
var tab = tabBrowser.mTabContainer.childNodes[i];
|
|
|
|
tabBrowser.setTabTitle(tab);
|
|
|
|
|
|
|
|
if (tab == tabBrowser.mCurrentTab)
|
|
|
|
tabBrowser.updateTitlebar();
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
]]>
|
2002-08-10 06:53:22 +00:00
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="setTabTitle">
|
|
|
|
<parameter name="aTab"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var browser = this.getBrowserForTab(aTab);
|
|
|
|
var crop = "end";
|
2005-02-06 20:33:26 +00:00
|
|
|
var title = browser.contentDocument.__proto__.__lookupGetter__('title').call(browser.contentDocument);
|
|
|
|
|
|
|
|
if (!title) {
|
|
|
|
if (browser.currentURI.spec) {
|
|
|
|
try {
|
|
|
|
title = this.mURIFixup.createExposableURI(browser.currentURI).spec;
|
|
|
|
} catch(ex) {
|
|
|
|
title = browser.currentURI.spec;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (title && title != "about:blank") {
|
|
|
|
// At this point, we now have a URI.
|
|
|
|
// Let's try to unescape it using a character set
|
|
|
|
// in case the URI is not ASCII.
|
|
|
|
try {
|
|
|
|
var characterSet = Components.lookupMethod(browser.contentDocument, 'characterSet')
|
|
|
|
.call(browser.contentDocument);
|
|
|
|
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
|
|
|
.getService(Components.interfaces.nsITextToSubURI);
|
|
|
|
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
|
|
|
|
} catch(ex) { /* Do nothing. */ }
|
|
|
|
|
|
|
|
crop = "center";
|
|
|
|
|
|
|
|
} else // Still no title? Fall back to our untitled string.
|
|
|
|
title = this.mStringBundle.getString("tabs.untitled");
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aTab.label = title;
|
|
|
|
aTab.setAttribute("crop", crop);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="setStripVisibilityTo">
|
|
|
|
<parameter name="aShow"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
this.mStrip.collapsed = !aShow;
|
|
|
|
if (aShow) {
|
|
|
|
// XXXdwh temporary unclean dependency on specific menu items in navigator.xul
|
|
|
|
document.getElementById("menu_closeWindow").hidden = false;
|
|
|
|
document.getElementById("menu_close").setAttribute("label", this.mStringBundle.getString("tabs.closeTab"));
|
|
|
|
if (!this.mTabbedMode)
|
|
|
|
this.enterTabbedMode();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// XXXdwh temporary unclean dependency on specific menu items in navigator.xul
|
|
|
|
document.getElementById("menu_closeWindow").hidden = true;
|
|
|
|
document.getElementById("menu_close").setAttribute("label", this.mStringBundle.getString("tabs.close"));
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="getStripVisibility">
|
|
|
|
<body>
|
|
|
|
return !this.mStrip.collapsed;
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="enterTabbedMode">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
this.mTabbedMode = true; // Welcome to multi-tabbed mode.
|
|
|
|
|
2002-10-11 22:16:19 +00:00
|
|
|
// Get the first tab all hooked up with a title listener and popup blocking listener.
|
2002-08-10 06:53:22 +00:00
|
|
|
this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
this.setTabTitle(this.mCurrentTab);
|
|
|
|
|
|
|
|
// Hook up our favicon.
|
|
|
|
var uri = this.mCurrentBrowser.currentURI;
|
|
|
|
if (this.shouldLoadFavIcon(uri))
|
|
|
|
this.loadFavIcon(uri, "image", this.mCurrentTab);
|
|
|
|
|
|
|
|
var filter;
|
|
|
|
if (this.mTabFilters.length > 0) {
|
|
|
|
// Use the filter hooked up in our addProgressListener
|
|
|
|
filter = this.mTabFilters[0];
|
|
|
|
} else {
|
|
|
|
// create a filter and hook it up to our first browser
|
|
|
|
filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
|
|
|
.createInstance(Components.interfaces.nsIWebProgress);
|
|
|
|
this.mTabFilters[0] = filter;
|
|
|
|
this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove all our progress listeners from the active browser's filter.
|
|
|
|
if (this.mProgressListeners) {
|
|
|
|
for (var i = 0; i < this.mProgressListeners.length; i++) {
|
|
|
|
var p = this.mProgressListeners[i];
|
|
|
|
if (p)
|
|
|
|
filter.removeProgressListener(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wire up a progress listener to our filter.
|
2004-12-01 16:21:02 +00:00
|
|
|
const listener = this.mTabProgressListener(this.mCurrentTab,
|
|
|
|
this.mCurrentBrowser,
|
|
|
|
false);
|
2002-08-10 06:53:22 +00:00
|
|
|
filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
this.mTabListeners[0] = listener;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
<method name="_createMessage">
|
|
|
|
<parameter name="aType"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var message = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
|
|
"browsermessage");
|
|
|
|
message.hidden = true;
|
|
|
|
message.setAttribute("type", aType);
|
|
|
|
return message;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
<method name="addTab">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<parameter name="aReferrerURI"/>
|
2003-07-26 06:42:50 +00:00
|
|
|
<parameter name="aCharset"/>
|
2004-04-20 09:45:12 +00:00
|
|
|
<parameter name="aPostData"/>
|
2002-08-10 06:53:22 +00:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this.mTabbedMode)
|
|
|
|
this.enterTabbedMode();
|
|
|
|
|
|
|
|
var t = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
|
|
"tab");
|
|
|
|
|
2004-12-01 16:21:02 +00:00
|
|
|
var blank = (aURI == "about:blank");
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (blank)
|
|
|
|
t.setAttribute("label", this.mStringBundle.getString("tabs.untitled"));
|
|
|
|
else
|
|
|
|
t.setAttribute("label", aURI);
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
t.setAttribute("crop", "end");
|
|
|
|
t.maxWidth = 250;
|
|
|
|
t.minWidth = 30;
|
|
|
|
t.width = 0;
|
|
|
|
t.setAttribute("flex", "100");
|
|
|
|
t.setAttribute("validate", "never");
|
|
|
|
t.setAttribute("onerror", "this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image')); this.removeAttribute('image');");
|
|
|
|
this.mTabContainer.appendChild(t);
|
|
|
|
|
2004-12-01 16:21:02 +00:00
|
|
|
var b = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
|
|
"browser");
|
2002-08-10 06:53:22 +00:00
|
|
|
b.setAttribute("type", "content");
|
2004-12-01 04:48:44 +00:00
|
|
|
b.setAttribute("message", "true");
|
2002-08-10 06:53:22 +00:00
|
|
|
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
|
|
|
|
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
|
2003-02-10 11:19:52 +00:00
|
|
|
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
|
2004-12-05 22:03:50 +00:00
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
// Add the Message and the Browser to the box
|
|
|
|
var vbox = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
|
|
"vbox");
|
|
|
|
vbox.setAttribute("flex", "1");
|
|
|
|
vbox.appendChild(this._createMessage("top"));
|
|
|
|
vbox.appendChild(b);
|
|
|
|
vbox.appendChild(this._createMessage("bottom"));
|
|
|
|
b.setAttribute("flex", "1");
|
|
|
|
this.mPanelContainer.appendChild(vbox);
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
b.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (this.mStrip.collapsed)
|
|
|
|
this.setStripVisibilityTo(true);
|
|
|
|
|
|
|
|
this.mPrefs.setBoolPref("browser.tabs.forceHide", false);
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
// wire up a progress listener for the new browser object.
|
|
|
|
var position = this.mTabContainer.childNodes.length-1;
|
2003-12-05 05:55:54 +00:00
|
|
|
var tabListener = this.mTabProgressListener(t, b, blank);
|
2002-08-10 06:53:22 +00:00
|
|
|
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
|
|
|
.createInstance(Components.interfaces.nsIWebProgress);
|
|
|
|
filter.addProgressListener(tabListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
b.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
this.mTabListeners[position] = tabListener;
|
|
|
|
this.mTabFilters[position] = filter;
|
2004-12-01 04:48:44 +00:00
|
|
|
|
|
|
|
b._fastFind = this.fastFind;
|
2002-08-10 06:53:22 +00:00
|
|
|
|
2004-04-20 09:45:12 +00:00
|
|
|
if (!blank) {
|
2004-07-24 00:24:30 +00:00
|
|
|
// pretend the user typed this so it'll be available till
|
|
|
|
// the document successfully loads
|
|
|
|
b.userTypedValue = aURI;
|
|
|
|
|
2004-04-20 09:45:12 +00:00
|
|
|
if (aPostData === undefined)
|
|
|
|
aPostData = null;
|
2002-08-10 06:53:22 +00:00
|
|
|
b.loadURIWithFlags(aURI, nsIWebNavigation.LOAD_FLAGS_NONE,
|
2004-12-26 16:59:02 +00:00
|
|
|
aReferrerURI, aCharset, aPostData);
|
2004-04-20 09:45:12 +00:00
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
return t;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
<method name="warnAboutClosingTabs">
|
|
|
|
<parameter name="aAll"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var numTabs = this.mTabContainer.childNodes.length;
|
|
|
|
var reallyClose = true;
|
|
|
|
if (numTabs <= 1)
|
|
|
|
return reallyClose;
|
|
|
|
|
|
|
|
const pref = "browser.tabs.warnOnClose";
|
|
|
|
var shouldPrompt = this.mPrefs.getBoolPref(pref);
|
|
|
|
var reallyClose = true;
|
|
|
|
|
|
|
|
if (shouldPrompt) {
|
|
|
|
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPromptService);
|
|
|
|
|
|
|
|
//default to true: if it were false, we wouldn't get this far
|
|
|
|
var warnOnClose = { value:true };
|
|
|
|
var bundle = this.mStringBundle;
|
|
|
|
var tabsToClose = numTabs; //number of tabs to be removed
|
|
|
|
if (!aAll)
|
|
|
|
--tabsToClose;
|
|
|
|
|
|
|
|
var messageKey = (tabsToClose == 1) ? "tabs.closeWarningOne" : "tabs.closeWarningMultiple";
|
|
|
|
var closeKey = (tabsToClose == 1) ? "tabs.closeButtonOne" : "tabs.closeButtonMultiple";
|
|
|
|
var buttonPressed = promptService.confirmEx(window,
|
|
|
|
bundle.getString('tabs.closeWarningTitle'),
|
|
|
|
bundle.getFormattedString(messageKey, [tabsToClose]),
|
|
|
|
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0)
|
|
|
|
+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
|
|
|
|
bundle.getString(closeKey),
|
|
|
|
null, null,
|
|
|
|
bundle.getString('tabs.closeWarningPromptMe'),
|
|
|
|
warnOnClose);
|
|
|
|
reallyClose = (buttonPressed == 0);
|
|
|
|
// don't set the pref unless they press OK and it's false
|
|
|
|
if (reallyClose && !warnOnClose.value)
|
|
|
|
this.mPrefs.setBoolPref(pref, false);
|
|
|
|
}
|
|
|
|
return reallyClose;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2003-08-05 07:19:24 +00:00
|
|
|
<method name="removeAllTabsBut">
|
|
|
|
<parameter name="aTab"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2004-12-01 04:48:44 +00:00
|
|
|
if (this.warnAboutClosingTabs(false)) {
|
|
|
|
if (aTab.localName != "tab")
|
|
|
|
aTab = this.mCurrentTab;
|
|
|
|
else
|
|
|
|
this.mTabContainer.selectedItem = aTab;
|
|
|
|
|
|
|
|
var childNodes = this.mTabContainer.childNodes;
|
2003-08-05 07:19:24 +00:00
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
for (var i = childNodes.length - 1; i >= 0; --i) {
|
|
|
|
if (childNodes[i] != aTab)
|
|
|
|
this.removeTab(childNodes[i]);
|
|
|
|
}
|
|
|
|
}
|
2004-02-19 21:52:31 +00:00
|
|
|
}
|
2003-08-05 07:19:24 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="removeCurrentTab">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.removeTab(this.mCurrentTab);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="removeTab">
|
|
|
|
<parameter name="aTab"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (aTab.localName != "tab")
|
|
|
|
aTab = this.mCurrentTab;
|
|
|
|
|
|
|
|
var l = this.mTabContainer.childNodes.length;
|
|
|
|
if (l == 1) {
|
2004-12-01 04:48:44 +00:00
|
|
|
if (!this.mPrefs.getBoolPref("browser.tabs.autoHide")) {
|
|
|
|
// blank the tab
|
|
|
|
this.loadURI("about:blank");
|
|
|
|
return;
|
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
// hide the tab bar
|
|
|
|
this.mPrefs.setBoolPref("browser.tabs.forceHide", true);
|
|
|
|
this.setStripVisibilityTo(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-02-19 21:52:31 +00:00
|
|
|
var ds = this.getBrowserForTab(aTab).docShell;
|
|
|
|
|
|
|
|
if (ds.contentViewer && !ds.contentViewer.permitUnload())
|
|
|
|
return;
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
if (l == 2) {
|
|
|
|
var autohide = this.mPrefs.getBoolPref("browser.tabs.autoHide");
|
|
|
|
if (autohide)
|
|
|
|
this.setStripVisibilityTo(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
var index = -1;
|
|
|
|
if (this.mCurrentTab == aTab)
|
|
|
|
index = this.mPanelContainer.selectedIndex;
|
|
|
|
else {
|
|
|
|
// Find and locate the tab in our list.
|
|
|
|
for (var i = 0; i < l; i++)
|
|
|
|
if (this.mTabContainer.childNodes[i] == aTab)
|
|
|
|
index = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove the tab's filter and progress listener.
|
|
|
|
const filter = this.mTabFilters[index];
|
2004-12-01 04:48:44 +00:00
|
|
|
var oldBrowser = this.getBrowserAtIndex(index);
|
2002-08-10 06:53:22 +00:00
|
|
|
oldBrowser.webProgress.removeProgressListener(filter);
|
|
|
|
filter.removeProgressListener(this.mTabListeners[index]);
|
|
|
|
this.mTabFilters.splice(index, 1);
|
|
|
|
this.mTabListeners.splice(index, 1);
|
|
|
|
|
2002-10-11 22:16:19 +00:00
|
|
|
// Remove our title change and blocking listeners
|
2002-08-10 06:53:22 +00:00
|
|
|
oldBrowser.removeEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
// We are no longer the primary content area.
|
|
|
|
oldBrowser.setAttribute("type", "content");
|
|
|
|
|
|
|
|
// Now select the new tab before nuking the old one.
|
|
|
|
var currentIndex = this.mPanelContainer.selectedIndex;
|
2003-07-23 14:24:05 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var newIndex = -1;
|
|
|
|
if (currentIndex > index)
|
|
|
|
newIndex = currentIndex-1;
|
|
|
|
else if (currentIndex < index)
|
|
|
|
newIndex = currentIndex;
|
2002-10-03 21:15:51 +00:00
|
|
|
else if (index == l - 1)
|
2002-08-10 06:53:22 +00:00
|
|
|
newIndex = index-1;
|
|
|
|
else
|
|
|
|
newIndex = index;
|
|
|
|
|
|
|
|
var oldTab = aTab;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
// clean up the before/afterselected attributes before removing the tab
|
|
|
|
oldTab.selected = false;
|
|
|
|
|
2005-02-21 22:50:07 +00:00
|
|
|
// Because of the way XBL works (fields just set JS
|
|
|
|
// properties on the element) and the code we have in place
|
|
|
|
// to preserve the JS objects for any elements that have
|
|
|
|
// JS properties set on them, the browser element won't be
|
|
|
|
// destroyed until the document goes away. So we force a
|
|
|
|
// cleanup ourselves.
|
|
|
|
// This has to hapen before we remove the child so that the
|
|
|
|
// XBL implementation of nsIObserver still works. But
|
|
|
|
// clearing focusedWindow happens below because it gets
|
|
|
|
// reset by updateCurrentBrowser.
|
2002-10-11 22:16:19 +00:00
|
|
|
oldBrowser.destroy();
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
this.mTabContainer.removeChild(oldTab);
|
2004-12-01 04:48:44 +00:00
|
|
|
this.mPanelContainer.removeChild(this.mPanelContainer.childNodes[index]);
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
this.selectedTab = this.mTabContainer.childNodes[newIndex];
|
2002-10-11 21:58:14 +00:00
|
|
|
this.mPanelContainer.selectedIndex = newIndex;
|
2002-10-11 22:16:19 +00:00
|
|
|
|
2002-10-11 21:58:14 +00:00
|
|
|
this.updateCurrentBrowser();
|
2005-02-21 22:50:07 +00:00
|
|
|
|
|
|
|
// see comment above destroy above
|
|
|
|
oldBrowser.focusedWindow = null;
|
2002-10-11 22:16:19 +00:00
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="reloadAllTabs">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var l = this.mPanelContainer.childNodes.length;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
for (var i = 0; i < l; i++) {
|
|
|
|
try {
|
2004-12-01 04:48:44 +00:00
|
|
|
this.getBrowserAtIndex(i).reload();
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
} catch (e) {
|
|
|
|
// ignore failure to reload so others will be reloaded
|
|
|
|
}
|
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="reloadTab">
|
|
|
|
<parameter name="aTab"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
if (aTab.localName != "tab")
|
|
|
|
aTab = this.mCurrentTab;
|
|
|
|
|
|
|
|
this.getBrowserForTab(aTab).reload();
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2004-09-19 17:31:28 +00:00
|
|
|
<method name="onTabBarDblClick">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (aEvent.originalTarget.localName != 'tab' && aEvent.button == 0)
|
|
|
|
this.selectedTab = this.addTab();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<method name="addProgressListener">
|
|
|
|
<parameter name="aListener"/>
|
|
|
|
<parameter name="aMask"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this.mProgressListeners) {
|
|
|
|
this.mProgressListeners = [];
|
|
|
|
const autoHide = this.mPrefs.getBoolPref("browser.tabs.autoHide");
|
|
|
|
const forceHide = this.mPrefs.getBoolPref("browser.tabs.forceHide");
|
|
|
|
if (!autoHide && !forceHide)
|
|
|
|
this.setStripVisibilityTo(true);
|
|
|
|
|
|
|
|
// Hook up a listener for <link>s.
|
|
|
|
this.mPanelContainer.addEventListener("DOMLinkAdded", this.onLinkAdded, false);
|
|
|
|
}
|
|
|
|
|
2004-05-06 17:19:00 +00:00
|
|
|
if (!this.mTabbedMode && this.mProgressListeners.length == 1) {
|
|
|
|
// If we are adding a 2nd progress listener, we need to enter tabbed mode
|
|
|
|
// because the browser status filter can only handle one progress listener.
|
|
|
|
// In tabbed mode, mTabProgressListener is used which will iterate over all listeners.
|
|
|
|
this.enterTabbedMode();
|
|
|
|
}
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
this.mProgressListeners.push(aListener);
|
|
|
|
|
|
|
|
if (!this.mTabbedMode) {
|
2004-05-06 17:19:00 +00:00
|
|
|
// If someone does this:
|
|
|
|
// addProgressListener, removeProgressListener, addProgressListener
|
|
|
|
// don't create a new filter; reuse the existing filter.
|
|
|
|
if (this.mTabFilters.length == 0) {
|
|
|
|
// hook a filter up to our first browser
|
|
|
|
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
|
|
|
.createInstance(Components.interfaces.nsIWebProgress);
|
|
|
|
this.mTabFilters[0] = filter;
|
|
|
|
this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
|
|
|
|
// Directly hook the listener up to the filter for better performance
|
|
|
|
this.mTabFilters[0].addProgressListener(aListener, aMask);
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="removeProgressListener">
|
|
|
|
<parameter name="aListener"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this.mProgressListeners) return;
|
|
|
|
for (var i = 0; i < this.mProgressListeners.length; i++) {
|
|
|
|
if (this.mProgressListeners[i] == aListener) {
|
|
|
|
this.mProgressListeners[i] = null;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.mTabbedMode)
|
|
|
|
// Don't forget to remove it from the filter we hooked it up to
|
|
|
|
this.mTabFilters[0].removeProgressListener(aListener);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="getBrowserForTab">
|
|
|
|
<parameter name="aTab"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (this.mCurrentTab == aTab)
|
|
|
|
return this.mCurrentBrowser;
|
|
|
|
|
|
|
|
for (var i = 0; i < this.mTabContainer.childNodes.length; i++) {
|
|
|
|
if (this.mTabContainer.childNodes[i] == aTab) {
|
2004-12-01 04:48:44 +00:00
|
|
|
return this.getBrowserAtIndex(i);
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2004-02-19 21:52:31 +00:00
|
|
|
<property name="tabContainer">
|
|
|
|
<getter>
|
|
|
|
return this.mTabContainer;
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<property name="selectedTab">
|
|
|
|
<getter>
|
|
|
|
return this.mTabBox.selectedTab;
|
|
|
|
</getter>
|
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
|
|
|
// Update the tab
|
|
|
|
this.mTabBox.selectedTab = val;
|
|
|
|
return val;
|
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<property name="selectedBrowser"
|
|
|
|
onget="return this.mCurrentBrowser;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
|
|
|
|
<property name="browsers"
|
2004-12-01 04:48:44 +00:00
|
|
|
onget="return this.mPanelContainer.getElementsByTagName('browser');"
|
2002-08-10 06:53:22 +00:00
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<!-- Drag and drop observer API -->
|
|
|
|
<!--<method name="onDragStart">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<parameter name="aXferData"/>
|
|
|
|
<parameter name="aDragAction"/>
|
|
|
|
<body/>
|
|
|
|
</method>-->
|
|
|
|
|
|
|
|
<method name="onDragOver">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<parameter name="aFlavour"/>
|
|
|
|
<parameter name="aDragSession"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return; // Just having this makes our feedback correct.
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onDrop">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<parameter name="aXferData"/>
|
|
|
|
<parameter name="aDragSession"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var url = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
|
|
|
|
|
2005-02-05 09:09:20 +00:00
|
|
|
// valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
|
|
|
|
// Also disallow dropping javascript: or data: urls--bail out
|
|
|
|
if (!url || !url.length || url.indexOf(" ", 0) != -1 ||
|
|
|
|
/^\s*(javascript|data):/.test(url))
|
2002-08-10 06:53:22 +00:00
|
|
|
return;
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var bgLoad = this.mPrefs.getBoolPref("browser.tabs.loadInBackground");
|
|
|
|
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
var tab = null;
|
|
|
|
if (aEvent.originalTarget.localName != "tab") {
|
2002-08-10 06:53:22 +00:00
|
|
|
// We're adding a new tab.
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
tab = this.addTab(getShortcutOrURI(url));
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
else {
|
2002-08-10 06:53:22 +00:00
|
|
|
// Load in an existing tab.
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
tab = aEvent.originalTarget;
|
|
|
|
this.getBrowserForTab(tab).loadURI(getShortcutOrURI(url));
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry.
tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang.
not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames
bug 203960, go back group
bug 104778, remember what user typed when switching tabs.
bug 103720, prefill URI when opening new tab.
2003-08-17 11:11:42 +00:00
|
|
|
if (this.mCurrentTab != tab && !bgLoad)
|
|
|
|
this.selectedTab = tab;
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="getSupportedFlavours">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var flavourSet = new FlavourSet();
|
|
|
|
flavourSet.appendFlavour("text/x-moz-url");
|
|
|
|
flavourSet.appendFlavour("text/unicode");
|
|
|
|
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
|
|
|
return flavourSet;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<!-- BEGIN FORWARDED BROWSER PROPERTIES. IF YOU ADD A PROPERTY TO THE BROWSER ELEMENT
|
|
|
|
MAKE SURE TO ADD IT HERE AS WELL. -->
|
|
|
|
<property name="canGoBack"
|
|
|
|
onget="return this.mCurrentBrowser.canGoBack;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="canGoForward"
|
|
|
|
onget="return this.mCurrentBrowser.canGoForward;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<method name="goBack">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.goBack();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="goForward">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.goForward();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="reload">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.reload();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="reloadWithFlags">
|
|
|
|
<parameter name="aFlags"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.reloadWithFlags(aFlags);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="stop">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.stop();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<!-- throws exception for unknown schemes -->
|
|
|
|
<method name="loadURI">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<parameter name="aReferrerURI"/>
|
2003-07-26 06:42:50 +00:00
|
|
|
<parameter name="aCharset"/>
|
2002-08-10 06:53:22 +00:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2003-07-26 06:42:50 +00:00
|
|
|
return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset);
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<!-- throws exception for unknown schemes -->
|
|
|
|
<method name="loadURIWithFlags">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<parameter name="aFlags"/>
|
|
|
|
<parameter name="aReferrerURI"/>
|
2003-07-26 06:42:50 +00:00
|
|
|
<parameter name="aCharset"/>
|
2002-08-10 06:53:22 +00:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2003-07-26 06:42:50 +00:00
|
|
|
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset);
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="goHome">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.goHome();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<property name="homePage">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.homePage;
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
|
|
|
this.mCurrentBrowser.homePage = val;
|
|
|
|
return val;
|
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<method name="gotoIndex">
|
|
|
|
<parameter name="aIndex"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.gotoIndex(aIndex);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2003-02-01 09:11:13 +00:00
|
|
|
|
|
|
|
<method name="attachFormFill">
|
|
|
|
<body><![CDATA[
|
2004-12-01 04:48:44 +00:00
|
|
|
for (var i = 0; i < this.mPanelContainer.childNodes.length; ++i) {
|
|
|
|
var cb = this.getBrowserAtIndex(i);
|
2003-08-11 03:57:20 +00:00
|
|
|
cb.attachFormFill();
|
|
|
|
}
|
2003-02-01 09:11:13 +00:00
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="detachFormFill">
|
|
|
|
<body><![CDATA[
|
2004-12-01 04:48:44 +00:00
|
|
|
for (var i = 0; i < this.mPanelContainer.childNodes.length; ++i) {
|
|
|
|
var cb = this.getBrowserAtIndex(i);
|
2003-08-11 03:57:20 +00:00
|
|
|
cb.detachFormFill();
|
|
|
|
}
|
2003-02-01 09:11:13 +00:00
|
|
|
]]></body>
|
|
|
|
</method>
|
2002-08-10 06:53:22 +00:00
|
|
|
|
2002-10-11 22:16:19 +00:00
|
|
|
<property name="pageReport"
|
|
|
|
onget="return this.mCurrentBrowser.pageReport;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<property name="currentURI"
|
|
|
|
onget="return this.mCurrentBrowser.currentURI;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
<field name="_fastFind">null</field>
|
|
|
|
<property name="fastFind"
|
|
|
|
readonly="true">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this._fastFind) {
|
|
|
|
this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
|
|
|
|
.createInstance(Components.interfaces.nsITypeAheadFind);
|
|
|
|
this._fastFind.init(this.docShell);
|
|
|
|
}
|
|
|
|
return this._fastFind;
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<property name="findString"
|
|
|
|
onget="return this.mCurrentBrowser.findString;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<property name="docShell"
|
|
|
|
onget="return this.mCurrentBrowser.docShell"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="webNavigation"
|
|
|
|
onget="return this.mCurrentBrowser.webNavigation"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="webBrowserFind"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.mCurrentBrowser.webBrowserFind"/>
|
|
|
|
|
|
|
|
<property name="webProgress"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.mCurrentBrowser.webProgress"/>
|
|
|
|
|
|
|
|
<property name="contentWindow"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.mCurrentBrowser.contentWindow"/>
|
|
|
|
|
|
|
|
<property name="sessionHistory"
|
|
|
|
onget="return this.mCurrentBrowser.sessionHistory;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="markupDocumentViewer"
|
|
|
|
onget="return this.mCurrentBrowser.markupDocumentViewer;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentViewerEdit"
|
|
|
|
onget="return this.mCurrentBrowser.contentViewerEdit;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentViewerFile"
|
|
|
|
onget="return this.mCurrentBrowser.contentViewerFile;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="documentCharsetInfo"
|
|
|
|
onget="return this.mCurrentBrowser.documentCharsetInfo;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentDocument"
|
|
|
|
onget="return this.mCurrentBrowser.contentDocument;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2004-09-29 00:36:32 +00:00
|
|
|
<property name="contentTitle"
|
|
|
|
onget="return this.mCurrentBrowser.contentTitle;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<property name="securityUI"
|
|
|
|
onget="return this.mCurrentBrowser.securityUI;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2003-11-20 09:48:16 +00:00
|
|
|
<method name="find">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.find();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="findAgain">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.findAgain();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="findPrevious">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.mCurrentBrowser.findPrevious();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2004-12-01 04:48:44 +00:00
|
|
|
<field name="_keyEventHandler" readonly="true">
|
|
|
|
<![CDATA[({
|
|
|
|
tabbrowser: this,
|
|
|
|
handleEvent: function handleEvent(aEvent) {
|
|
|
|
if (!aEvent.isTrusted) {
|
|
|
|
// Don't let untrusted events mess with tabs.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-12-05 21:49:44 +00:00
|
|
|
#ifndef XP_MACOSX
|
2004-12-01 04:48:44 +00:00
|
|
|
if (aEvent.ctrlKey && aEvent.keyCode == KeyEvent.DOM_VK_F4 && this.tabbrowser.mTabBox.handleCtrlPageUpDown)
|
|
|
|
this.tabbrowser.removeCurrentTab();
|
2004-12-05 21:49:44 +00:00
|
|
|
#endif
|
2004-12-01 04:48:44 +00:00
|
|
|
}
|
|
|
|
})]]>
|
|
|
|
</field>
|
2003-11-20 09:48:16 +00:00
|
|
|
|
|
|
|
<property name="canFindAgain"
|
|
|
|
onget="return this.mCurrentBrowser.canFindAgain;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2004-07-24 00:24:30 +00:00
|
|
|
<property name="userTypedClear"
|
|
|
|
onget="return this.mCurrentBrowser.userTypedClear;"
|
|
|
|
onset="return this.mCurrentBrowser.userTypedClear = val;"/>
|
|
|
|
|
2003-12-05 05:55:54 +00:00
|
|
|
<property name="userTypedValue"
|
|
|
|
onget="return this.mCurrentBrowser.userTypedValue;"
|
|
|
|
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
|
|
|
|
|
2004-11-03 17:06:21 +00:00
|
|
|
<property name="forceSyncURLBarUpdate"
|
|
|
|
onget="return this.mModalDialogShowing;"/>
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
2004-12-01 04:48:44 +00:00
|
|
|
this.mCurrentBrowser = this.getBrowserAtIndex(0);
|
2003-12-05 05:55:54 +00:00
|
|
|
this.mCurrentTab = this.mTabContainer.firstChild;
|
2004-12-01 18:48:25 +00:00
|
|
|
this.mTabBox.handleCtrlTab = !/Mac/.test(navigator.platform);
|
2004-12-01 04:48:44 +00:00
|
|
|
document.addEventListener("keypress", this._keyEventHandler, false);
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
|
|
|
<destructor>
|
|
|
|
<![CDATA[
|
|
|
|
for (var i = 0; i < this.mTabListeners.length; ++i) {
|
2004-12-01 04:48:44 +00:00
|
|
|
this.getBrowserAtIndex(i).webProgress.removeProgressListener(this.mTabFilters[i]);
|
2002-08-10 06:53:22 +00:00
|
|
|
this.mTabFilters[i].removeProgressListener(this.mTabListeners[i]);
|
|
|
|
this.mTabFilters[i] = null;
|
|
|
|
this.mTabListeners[i] = null;
|
2004-12-01 04:48:44 +00:00
|
|
|
this.getBrowserAtIndex(i).removeEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
this.mPanelContainer.removeEventListener("DOMLinkAdded", this.onLinkAdded, false);
|
2004-12-01 04:48:44 +00:00
|
|
|
document.removeEventListener("keypress", this._keyEventHandler, false);
|
2002-08-10 06:53:22 +00:00
|
|
|
]]>
|
|
|
|
</destructor>
|
|
|
|
</implementation>
|
|
|
|
|
|
|
|
<handlers>
|
|
|
|
<handler event="DOMWindowClose">
|
|
|
|
<![CDATA[
|
2004-10-26 00:13:50 +00:00
|
|
|
if (!event.isTrusted)
|
|
|
|
return;
|
|
|
|
|
2004-12-01 04:48:44 +00:00
|
|
|
const browsers = this.mPanelContainer.childNodes;
|
|
|
|
if (browsers.length == 1) {
|
|
|
|
// There's only one browser left. If a window is being
|
|
|
|
// closed and the window is *not* the window in the
|
|
|
|
// browser that's still around, prevent the event's default
|
|
|
|
// action to prevent closing a window that's being closed
|
|
|
|
// already.
|
|
|
|
if (this.getBrowserAtIndex(0).contentWindow != event.target)
|
|
|
|
event.preventDefault();
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
return;
|
2004-12-01 04:48:44 +00:00
|
|
|
}
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
var i = 0;
|
|
|
|
for (; i < browsers.length; ++i) {
|
2004-12-01 04:48:44 +00:00
|
|
|
if (this.getBrowserAtIndex(i).contentWindow == event.target) {
|
|
|
|
this.removeTab(this.mTabContainer.childNodes[i]);
|
|
|
|
event.preventDefault();
|
|
|
|
|
2002-08-10 06:53:22 +00:00
|
|
|
break;
|
2004-12-01 04:48:44 +00:00
|
|
|
}
|
2002-08-10 06:53:22 +00:00
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</handler>
|
2004-11-03 17:06:21 +00:00
|
|
|
<handler event="DOMWillOpenModalDialog">
|
|
|
|
<![CDATA[
|
|
|
|
if (!event.isTrusted)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We're about to open a modal dialog, make sure the opening
|
|
|
|
// tab is brought to the front.
|
|
|
|
|
2005-01-06 16:13:51 +00:00
|
|
|
var targetTop = new XPCNativeWrapper(event.target, "top").top;
|
|
|
|
|
2004-11-03 17:06:21 +00:00
|
|
|
for (var i = 0; i < browsers.length; ++i) {
|
2005-01-06 16:13:51 +00:00
|
|
|
if (this.getBrowserAtIndex(i).contentWindow == targetTop) {
|
2004-11-03 17:06:21 +00:00
|
|
|
this.mModalDialogShowing = true;
|
|
|
|
this.selectedTab = this.mTabContainer.childNodes[i];
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</handler>
|
|
|
|
<handler event="DOMModalDialogClosed">
|
|
|
|
<![CDATA[
|
|
|
|
if (!event.isTrusted)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.mModalDialogShowing = false;
|
|
|
|
]]>
|
|
|
|
</handler>
|
2002-08-10 06:53:22 +00:00
|
|
|
</handlers>
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|