diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 65310db85584..006eec5f90cc 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index fdb9bb62fc82..a11bde11f228 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -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); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 42ffaec92703..8257979f25d9 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -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 browserChrome3 = do_GetInterface(mTreeOwner); - if (browserChrome3) { - nsCOMPtr linkNode = do_QueryInterface(aContent); - nsAutoString oldTarget(aTargetSpec); - rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI, - linkNode, mIsAppTab, target); - } - - if (NS_FAILED(rv)) - target = aTargetSpec; - nsCOMPtr ev = - new OnLinkClickEvent(this, aContent, aURI, target.get(), + new OnLinkClickEvent(this, aContent, aURI, aTargetSpec, aPostDataStream, aHeadersDataStream); return NS_DispatchToCurrentThread(ev); } diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 317f766a48a7..a6c33f149c16 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -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 diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index e5a72e5813e8..788be5c5ef2a 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -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)] diff --git a/embedding/browser/webBrowser/Makefile.in b/embedding/browser/webBrowser/Makefile.in index 10a56f9671c3..b068d4c210d5 100644 --- a/embedding/browser/webBrowser/Makefile.in +++ b/embedding/browser/webBrowser/Makefile.in @@ -78,7 +78,6 @@ XPIDLSRCS = \ nsIEmbeddingSiteWindow2.idl \ nsIContextMenuListener2.idl \ nsIWebBrowserChrome2.idl \ - nsIWebBrowserChrome3.idl \ $(NULL) CPPSRCS = \ diff --git a/embedding/browser/webBrowser/nsIWebBrowserChrome3.idl b/embedding/browser/webBrowser/nsIWebBrowserChrome3.idl deleted file mode 100644 index b15bf12335e2..000000000000 --- a/embedding/browser/webBrowser/nsIWebBrowserChrome3.idl +++ /dev/null @@ -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 - * - * 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); -}; diff --git a/toolkit/components/help/content/help.js b/toolkit/components/help/content/help.js index 4a49bfb9b7c7..f17403b17bd4 100644 --- a/toolkit/components/help/content/help.js +++ b/toolkit/components/help/content/help.js @@ -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() { diff --git a/toolkit/content/Services.jsm b/toolkit/content/Services.jsm index 86ad255edd2e..4d6a82866bf2 100644 --- a/toolkit/content/Services.jsm +++ b/toolkit/content/Services.jsm @@ -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"); diff --git a/toolkit/content/tests/chrome/findbar_window.xul b/toolkit/content/tests/chrome/findbar_window.xul index 911b3e9cf85d..33729245b7e4 100644 --- a/toolkit/content/tests/chrome/findbar_window.xul +++ b/toolkit/content/tests/chrome/findbar_window.xul @@ -76,9 +76,7 @@ setOverLink: function(aStatusText, aLink) { gStatusText = aStatusText; - }, - - onBeforeLinkTraversal: function() { } + } }; function ok(condition, message) { diff --git a/xpfe/appshell/public/nsIXULBrowserWindow.idl b/xpfe/appshell/public/nsIXULBrowserWindow.idl index d787d9405a0e..37a8676aa99f 100644 --- a/xpfe/appshell/public/nsIXULBrowserWindow.idl +++ b/xpfe/appshell/public/nsIXULBrowserWindow.idl @@ -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); }; diff --git a/xpfe/appshell/src/nsContentTreeOwner.cpp b/xpfe/appshell/src/nsContentTreeOwner.cpp index f6c21a0a86de..3794e06d4b99 100644 --- a/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -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 xulBrowserWindow; - mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow)); - - if (xulBrowserWindow) - return xulBrowserWindow->OnBeforeLinkTraversal(originalTarget, linkURI, - linkNode, isAppTab, _retval); - - _retval = originalTarget; - return NS_OK; -} - //***************************************************************************** // nsContentTreeOwner::nsIWebBrowserChrome2 //***************************************************************************** diff --git a/xpfe/appshell/src/nsContentTreeOwner.h b/xpfe/appshell/src/nsContentTreeOwner.h index 31d462a52e51..efc4e54b339f 100644 --- a/xpfe/appshell/src/nsContentTreeOwner.h +++ b/xpfe/appshell/src/nsContentTreeOwner.h @@ -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: