Backed out changeset ecd1948992eb

This commit is contained in:
Robert O'Callahan 2010-10-29 16:07:46 +13:00
Родитель 28e7c9718a
Коммит ea93b2367b
13 изменённых файлов: 8 добавлений и 177 удалений

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

@ -3985,27 +3985,6 @@ var XULBrowserWindow = {
encodeURIComponent);
gURLBar.setOverLink(link);
},
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
// Don't modify non-default targets or targets that aren't in top-level app
// tab docshells (isAppTab will be false for app tab subframes).
if (originalTarget != "" || !isAppTab)
return originalTarget;
let docURI = linkNode.ownerDocument.documentURIObject;
try {
let docURIDomain = Services.eTLD.getBaseDomain(docURI, 0);
let linkURIDomain = Services.eTLD.getBaseDomain(linkURI, 0);
// External links from within app tabs should always open in new tabs
// instead of replacing the app tab's page (Bug 575561)
if (docURIDomain != linkURIDomain)
return "_blank";
} catch(e) {
// If getBaseDomain fails, we return originalTarget below.
}
return originalTarget;
},
onLinkIconAvailable: function (aIconURL) {
if (gProxyFavIcon && gBrowser.userTypedValue === null)

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

@ -191,8 +191,6 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = true;
let event = document.createEvent("Events");
event.initEvent("TabPinned", true, false);
aTab.dispatchEvent(event);
@ -212,8 +210,6 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = false;
let event = document.createEvent("Events");
event.initEvent("TabUnpinned", true, false);
aTab.dispatchEvent(event);

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

@ -159,7 +159,7 @@
#include "nsIController.h"
#include "nsPICommandUpdater.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIWebBrowserChrome3.h"
#include "nsIWebBrowserChrome2.h"
#include "nsITabChild.h"
#include "nsIStrictTransportSecurityService.h"
@ -711,7 +711,6 @@ nsDocShell::nsDocShell():
mAllowKeywordFixup(PR_FALSE),
mIsOffScreenBrowser(PR_FALSE),
mIsActive(PR_TRUE),
mIsAppTab(PR_FALSE),
mFiredUnloadEvent(PR_FALSE),
mEODForCurrentDocument(PR_FALSE),
mURIResultedInDocument(PR_FALSE),
@ -4803,20 +4802,6 @@ nsDocShell::GetIsActive(PRBool *aIsActive)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetIsAppTab(PRBool aIsAppTab)
{
mIsAppTab = aIsAppTab;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetIsAppTab(PRBool *aIsAppTab)
{
*aIsAppTab = mIsAppTab;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetVisibility(PRBool aVisibility)
{
@ -11326,22 +11311,8 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
return NS_OK;
}
nsresult rv = NS_ERROR_FAILURE;
nsAutoString target;
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
if (browserChrome3) {
nsCOMPtr<nsIDOMNode> linkNode = do_QueryInterface(aContent);
nsAutoString oldTarget(aTargetSpec);
rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI,
linkNode, mIsAppTab, target);
}
if (NS_FAILED(rv))
target = aTargetSpec;
nsCOMPtr<nsIRunnable> ev =
new OnLinkClickEvent(this, aContent, aURI, target.get(),
new OnLinkClickEvent(this, aContent, aURI, aTargetSpec,
aPostDataStream, aHeadersDataStream);
return NS_DispatchToCurrentThread(ev);
}

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

@ -790,7 +790,6 @@ protected:
PRPackedBool mAllowKeywordFixup;
PRPackedBool mIsOffScreenBrowser;
PRPackedBool mIsActive;
PRPackedBool mIsAppTab;
// This boolean is set to true right before we fire pagehide and generally
// unset when we embed a new content viewer. While it's true no navigation

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

@ -71,7 +71,7 @@ interface nsIPrincipal;
interface nsIWebBrowserPrint;
interface nsIVariant;
[scriptable, uuid(98cdbcc4-2d81-4191-a63f-b6c52085edbc)]
[scriptable, uuid(74470127-87eb-4f79-8293-1616fe9cb689)]
interface nsIDocShell : nsISupports
{
/**
@ -529,17 +529,11 @@ interface nsIDocShell : nsISupports
*/
attribute boolean isActive;
/**
* The ID of the docshell in the session history.
*/
readonly attribute unsigned long long historyID;
/**
* Sets whether a docshell is an app tab. An app tab docshell may behave
* differently than a non-app tab docshell in some cases, such as when
* handling link clicks. Docshells are not app tabs unless told otherwise.
*/
attribute boolean isAppTab;
};
[uuid(5f7a2184-31b6-4d67-9c75-0c17477766e2)]

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

@ -78,7 +78,6 @@ XPIDLSRCS = \
nsIEmbeddingSiteWindow2.idl \
nsIContextMenuListener2.idl \
nsIWebBrowserChrome2.idl \
nsIWebBrowserChrome3.idl \
$(NULL)
CPPSRCS = \

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

@ -1,65 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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/
*
* 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.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Margaret Leibovic <margaret.leibovic@gmail.com>
*
* 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 ***** */
#include "nsIWebBrowserChrome2.idl"
#include "nsIURI.idl"
#include "nsIDOMNode.idl"
/**
* nsIWebBrowserChrome3 is an extension to nsIWebBrowserChrome2.
*/
[scriptable, uuid(7f2aa813-b250-4e46-afeb-97b1e91bc9a5)]
interface nsIWebBrowserChrome3 : nsIWebBrowserChrome2
{
/**
* Determines the appropriate target for a link.
*
* @param originalTarget
* The original link target.
* @param linkURI
* Link destination URI.
* @param aDOMNode
* Link DOM node.
* @param isAppTab
* Whether or not the link is in an app tab.
* @returns A new link target, if appropriate.
* Otherwise returns originalTarget.
*/
AString onBeforeLinkTraversal(in AString originalTarget,
in nsIURI linkURI,
in nsIDOMNode linkNode,
in PRBool isAppTab);
};

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

@ -562,8 +562,7 @@ nsHelpStatusHandler.prototype = {
setJSStatus : function(status) {},
setJSDefaultStatus : function(status) {},
setOverLink : function(link, context) {},
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {}
setOverLink : function(link, context) {}
}
function UpdateBackForwardButtons() {

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

@ -130,7 +130,3 @@ XPCOMUtils.defineLazyServiceGetter(Services, "strings",
XPCOMUtils.defineLazyServiceGetter(Services, "urlFormatter",
"@mozilla.org/toolkit/URLFormatterService;1",
"nsIURLFormatter");
XPCOMUtils.defineLazyServiceGetter(Services, "eTLD",
"@mozilla.org/network/effective-tld-service;1",
"nsIEffectiveTLDService");

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

@ -76,9 +76,7 @@
setOverLink: function(aStatusText, aLink) {
gStatusText = aStatusText;
},
onBeforeLinkTraversal: function() { }
}
};
function ok(condition, message) {

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

@ -38,8 +38,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIURI.idl"
#include "nsIDOMNode.idl"
interface nsIRequest;
interface nsIDOMElement;
@ -67,13 +65,5 @@ interface nsIXULBrowserWindow : nsISupports
* over.
*/
void setOverLink(in AString link, in nsIDOMElement element);
/**
* Determines the appropriate target for a link.
*/
AString onBeforeLinkTraversal(in AString originalTarget,
in nsIURI linkURI,
in nsIDOMNode linkNode,
in PRBool isAppTab);
};

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

@ -124,7 +124,6 @@ NS_INTERFACE_MAP_BEGIN(nsContentTreeOwner)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome3)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
// NOTE: This is using aggregation because there are some properties and
@ -431,29 +430,6 @@ nsContentTreeOwner::GetPersistence(PRBool* aPersistPosition,
return NS_OK;
}
//*****************************************************************************
// nsContentTreeOwner::nsIWebBrowserChrome3
//*****************************************************************************
NS_IMETHODIMP nsContentTreeOwner::OnBeforeLinkTraversal(const nsAString &originalTarget,
nsIURI *linkURI,
nsIDOMNode *linkNode,
PRBool isAppTab,
nsAString &_retval)
{
NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
if (xulBrowserWindow)
return xulBrowserWindow->OnBeforeLinkTraversal(originalTarget, linkURI,
linkNode, isAppTab, _retval);
_retval = originalTarget;
return NS_OK;
}
//*****************************************************************************
// nsContentTreeOwner::nsIWebBrowserChrome2
//*****************************************************************************

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

@ -49,7 +49,7 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebBrowserChrome3.h"
#include "nsIWebBrowserChrome2.h"
#include "nsIWindowProvider.h"
class nsXULWindow;
@ -58,7 +58,7 @@ class nsSiteWindow2;
class nsContentTreeOwner : public nsIDocShellTreeOwner,
public nsIBaseWindow,
public nsIInterfaceRequestor,
public nsIWebBrowserChrome3,
public nsIWebBrowserChrome2,
public nsIWindowProvider
{
friend class nsXULWindow;
@ -72,7 +72,6 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROME2
NS_DECL_NSIWEBBROWSERCHROME3
NS_DECL_NSIWINDOWPROVIDER
protected: