Loading browser/app/profile/firefox.js +8 −0 Original line number Diff line number Diff line Loading @@ -534,6 +534,14 @@ pref("privacy.panicButton.enabled", true); pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols // The privacy.thirdparty.isolate pref determines whether // an isolated DOM Storage map and image cache are // maintained for each URL bar domain. // 0 - No isolation // 1 - Enable isolation in private windows // 2 - Enable isolation everywhere pref("privacy.thirdparty.isolate", 1); // simple gestures support pref("browser.gesture.swipe.left", "Browser:BackOrBackDuplicate"); pref("browser.gesture.swipe.right", "Browser:ForwardOrForwardDuplicate"); Loading dom/base/ThirdPartyUtil.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ThirdPartyUtil.h" #include "mozilla/Preferences.h" #include "nsNetUtil.h" #include "nsIServiceManager.h" #include "nsIHttpChannelInternal.h" Loading Loading @@ -491,6 +492,39 @@ ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI, return NS_OK; } // Returns true if First Party Isolation is currently active for the given nsIChannel. // Depends on Preference setting and possibly the state of Private Browsing mode. bool ThirdPartyUtil::IsFirstPartyIsolationActive(nsIChannel *aChannel, nsIDocument *aDoc) { int32_t isolationState = mozilla::Preferences::GetInt("privacy.thirdparty.isolate"); if (isolationState == 1) { if (!aChannel && aDoc) { // No channel passed directly. Can we get a channel from aDoc? aChannel = aDoc->GetChannel(); } return aChannel && NS_UsePrivateBrowsing(aChannel); } else { // (isolationState == 0) || (isolationState == 2) return (isolationState == 2); } } // Produces a URI that uniquely identifies the first party to which // image cache and dom storage objects should be isolated. If isolation // is deactivated, then aOutput will return null. // Not scriptable due to the use of an nsIDocument parameter. NS_IMETHODIMP ThirdPartyUtil::GetFirstPartyIsolationURI(nsIChannel *aChannel, nsIDocument *aDoc, nsIURI **aOutput) { bool isolationActive = IsFirstPartyIsolationActive(aChannel, aDoc); if (isolationActive) { return GetFirstPartyURI(aChannel, aDoc, aOutput); } else { // We return a null pointer when isolation is off. *aOutput = nullptr; return NS_OK; } } // Not scriptable due to the use of an nsIDocument parameter. NS_IMETHODIMP ThirdPartyUtil::GetFirstPartyURI(nsIChannel *aChannel, Loading dom/base/ThirdPartyUtil.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ private: nsresult IsThirdPartyInternal(const nsCString& aFirstDomain, nsIURI* aSecondURI, bool* aResult); bool IsFirstPartyIsolationActive(nsIChannel* aChannel, nsIDocument* aDoc); bool SchemeIsWhiteListed(nsIURI *aURI); static nsresult GetOriginatingURI(nsIChannel *aChannel, nsIURI **aURI); nsresult GetFirstPartyURIInternal(nsIChannel *aChannel, nsIDocument *aDoc, Loading netwerk/base/mozIThirdPartyUtil.idl +23 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,29 @@ interface mozIThirdPartyUtil : nsISupports [noscript] nsIURI getFirstPartyURI(in nsIChannel aChannel, in nsIDocument aDoc); /** * getFirstPartyIsolationURI * * If first-party isolation is active, then * obtains the top-level url bar URI for either a channel or a document. * Otherwise returns null. * Either parameter may be null (but not both). * * @param aChannel * An arbitrary channel for some content element of a first party * load. Can be null. * * @param aDoc * An arbitrary third party document. Can be null. * * @return the first party url bar URI for the load. * * @throws if the URI cannot be obtained or the URI lacks a hostname and the * URI's scheme is not white listed. */ [noscript] nsIURI getFirstPartyIsolationURI(in nsIChannel aChannel, in nsIDocument aDoc); /** * getFirstPartyURIFromChannel * Loading Loading
browser/app/profile/firefox.js +8 −0 Original line number Diff line number Diff line Loading @@ -534,6 +534,14 @@ pref("privacy.panicButton.enabled", true); pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols // The privacy.thirdparty.isolate pref determines whether // an isolated DOM Storage map and image cache are // maintained for each URL bar domain. // 0 - No isolation // 1 - Enable isolation in private windows // 2 - Enable isolation everywhere pref("privacy.thirdparty.isolate", 1); // simple gestures support pref("browser.gesture.swipe.left", "Browser:BackOrBackDuplicate"); pref("browser.gesture.swipe.right", "Browser:ForwardOrForwardDuplicate"); Loading
dom/base/ThirdPartyUtil.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ThirdPartyUtil.h" #include "mozilla/Preferences.h" #include "nsNetUtil.h" #include "nsIServiceManager.h" #include "nsIHttpChannelInternal.h" Loading Loading @@ -491,6 +492,39 @@ ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI, return NS_OK; } // Returns true if First Party Isolation is currently active for the given nsIChannel. // Depends on Preference setting and possibly the state of Private Browsing mode. bool ThirdPartyUtil::IsFirstPartyIsolationActive(nsIChannel *aChannel, nsIDocument *aDoc) { int32_t isolationState = mozilla::Preferences::GetInt("privacy.thirdparty.isolate"); if (isolationState == 1) { if (!aChannel && aDoc) { // No channel passed directly. Can we get a channel from aDoc? aChannel = aDoc->GetChannel(); } return aChannel && NS_UsePrivateBrowsing(aChannel); } else { // (isolationState == 0) || (isolationState == 2) return (isolationState == 2); } } // Produces a URI that uniquely identifies the first party to which // image cache and dom storage objects should be isolated. If isolation // is deactivated, then aOutput will return null. // Not scriptable due to the use of an nsIDocument parameter. NS_IMETHODIMP ThirdPartyUtil::GetFirstPartyIsolationURI(nsIChannel *aChannel, nsIDocument *aDoc, nsIURI **aOutput) { bool isolationActive = IsFirstPartyIsolationActive(aChannel, aDoc); if (isolationActive) { return GetFirstPartyURI(aChannel, aDoc, aOutput); } else { // We return a null pointer when isolation is off. *aOutput = nullptr; return NS_OK; } } // Not scriptable due to the use of an nsIDocument parameter. NS_IMETHODIMP ThirdPartyUtil::GetFirstPartyURI(nsIChannel *aChannel, Loading
dom/base/ThirdPartyUtil.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ private: nsresult IsThirdPartyInternal(const nsCString& aFirstDomain, nsIURI* aSecondURI, bool* aResult); bool IsFirstPartyIsolationActive(nsIChannel* aChannel, nsIDocument* aDoc); bool SchemeIsWhiteListed(nsIURI *aURI); static nsresult GetOriginatingURI(nsIChannel *aChannel, nsIURI **aURI); nsresult GetFirstPartyURIInternal(nsIChannel *aChannel, nsIDocument *aDoc, Loading
netwerk/base/mozIThirdPartyUtil.idl +23 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,29 @@ interface mozIThirdPartyUtil : nsISupports [noscript] nsIURI getFirstPartyURI(in nsIChannel aChannel, in nsIDocument aDoc); /** * getFirstPartyIsolationURI * * If first-party isolation is active, then * obtains the top-level url bar URI for either a channel or a document. * Otherwise returns null. * Either parameter may be null (but not both). * * @param aChannel * An arbitrary channel for some content element of a first party * load. Can be null. * * @param aDoc * An arbitrary third party document. Can be null. * * @return the first party url bar URI for the load. * * @throws if the URI cannot be obtained or the URI lacks a hostname and the * URI's scheme is not white listed. */ [noscript] nsIURI getFirstPartyIsolationURI(in nsIChannel aChannel, in nsIDocument aDoc); /** * getFirstPartyURIFromChannel * Loading