зеркало из https://github.com/mozilla/gecko-dev.git
Bug 960783 - Add nsILoadContext flags for remote (out-of-process) windows (r=ehsan)
This commit is contained in:
Родитель
7c08b2051b
Коммит
84c750bcb9
|
@ -89,6 +89,26 @@ LoadContext::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadContext::GetUseRemoteTabs(bool* aUseRemoteTabs)
|
||||
{
|
||||
MOZ_ASSERT(mIsNotNull);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aUseRemoteTabs);
|
||||
|
||||
*aUseRemoteTabs = mUseRemoteTabs;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
|
||||
{
|
||||
MOZ_ASSERT(mIsNotNull);
|
||||
|
||||
// We shouldn't need this on parent...
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
, mAppId(aAppId)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
|
||||
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
|
||||
, mIsInBrowserElement(aInBrowser)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
|
@ -58,11 +59,13 @@ public:
|
|||
uint32_t aAppId,
|
||||
bool aIsContent,
|
||||
bool aUsePrivateBrowsing,
|
||||
bool aUseRemoteTabs,
|
||||
bool aIsInBrowserElement)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(aIsContent)
|
||||
, mUsePrivateBrowsing(aUsePrivateBrowsing)
|
||||
, mUseRemoteTabs(aUseRemoteTabs)
|
||||
, mIsInBrowserElement(aIsInBrowserElement)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
|
@ -75,6 +78,7 @@ public:
|
|||
, mAppId(aAppId)
|
||||
, mIsContent(false)
|
||||
, mUsePrivateBrowsing(false)
|
||||
, mUseRemoteTabs(false)
|
||||
, mIsInBrowserElement(false)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
|
@ -86,6 +90,7 @@ private:
|
|||
uint32_t mAppId;
|
||||
bool mIsContent;
|
||||
bool mUsePrivateBrowsing;
|
||||
bool mUseRemoteTabs;
|
||||
bool mIsInBrowserElement;
|
||||
#ifdef DEBUG
|
||||
bool mIsNotNull;
|
||||
|
|
|
@ -59,6 +59,7 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
|||
mIsPrivateBitValid = true;
|
||||
aLoadContext->GetIsContent(&mIsContent);
|
||||
aLoadContext->GetUsePrivateBrowsing(&mUsePrivateBrowsing);
|
||||
aLoadContext->GetUseRemoteTabs(&mUseRemoteTabs);
|
||||
aLoadContext->GetAppId(&mAppId);
|
||||
aLoadContext->GetIsInBrowserElement(&mIsInBrowserElement);
|
||||
} else {
|
||||
|
@ -68,6 +69,7 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
|||
// we won't be GetInterfaced to nsILoadContext
|
||||
mIsContent = true;
|
||||
mUsePrivateBrowsing = false;
|
||||
mUseRemoteTabs = false;
|
||||
mAppId = 0;
|
||||
mIsInBrowserElement = false;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
bool mIsPrivateBitValid;
|
||||
bool mIsContent;
|
||||
bool mUsePrivateBrowsing;
|
||||
bool mUseRemoteTabs;
|
||||
bool mIsInBrowserElement;
|
||||
uint32_t mAppId;
|
||||
};
|
||||
|
@ -70,6 +71,7 @@ struct ParamTraits<SerializedLoadContext>
|
|||
WriteParam(aMsg, aParam.mIsContent);
|
||||
WriteParam(aMsg, aParam.mIsPrivateBitValid);
|
||||
WriteParam(aMsg, aParam.mUsePrivateBrowsing);
|
||||
WriteParam(aMsg, aParam.mUseRemoteTabs);
|
||||
WriteParam(aMsg, aParam.mAppId);
|
||||
WriteParam(aMsg, aParam.mIsInBrowserElement);
|
||||
}
|
||||
|
@ -80,6 +82,7 @@ struct ParamTraits<SerializedLoadContext>
|
|||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) {
|
||||
return false;
|
||||
|
|
|
@ -829,6 +829,7 @@ nsDocShell::nsDocShell():
|
|||
mIsAppTab(false),
|
||||
mUseGlobalHistory(false),
|
||||
mInPrivateBrowsing(false),
|
||||
mUseRemoteTabs(false),
|
||||
mDeviceSizeIsPageSize(false),
|
||||
mCanExecuteScripts(false),
|
||||
mFiredUnloadEvent(false),
|
||||
|
@ -2245,6 +2246,22 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aUseRemoteTabs);
|
||||
|
||||
*aUseRemoteTabs = mUseRemoteTabs;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
|
||||
{
|
||||
mUseRemoteTabs = aUseRemoteTabs;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAffectPrivateSessionLifetime(bool aAffectLifetime)
|
||||
{
|
||||
|
|
|
@ -213,6 +213,8 @@ public:
|
|||
NS_IMETHOD GetUsePrivateBrowsing(bool*);
|
||||
NS_IMETHOD SetUsePrivateBrowsing(bool);
|
||||
NS_IMETHOD SetPrivateBrowsing(bool);
|
||||
NS_IMETHOD GetUseRemoteTabs(bool*);
|
||||
NS_IMETHOD SetRemoteTabs(bool);
|
||||
|
||||
// Restores a cached presentation from history (mLSHE).
|
||||
// This method swaps out the content viewer and simulates loads for
|
||||
|
@ -830,6 +832,7 @@ protected:
|
|||
bool mIsAppTab;
|
||||
bool mUseGlobalHistory;
|
||||
bool mInPrivateBrowsing;
|
||||
bool mUseRemoteTabs;
|
||||
bool mDeviceSizeIsPageSize;
|
||||
|
||||
// Because scriptability depends on the mAllowJavascript values of our
|
||||
|
|
|
@ -14,7 +14,7 @@ interface nsIDOMElement;
|
|||
* can be queried for various information about where the load is
|
||||
* happening.
|
||||
*/
|
||||
[scriptable, uuid(d0029474-0cc4-42fd-bb21-d9ff22f5293c)]
|
||||
[scriptable, uuid(852ed1f0-8ec0-11e3-baa8-0800200c9a66)]
|
||||
interface nsILoadContext : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -66,6 +66,11 @@ interface nsILoadContext : nsISupports
|
|||
*/
|
||||
attribute boolean usePrivateBrowsing;
|
||||
|
||||
/**
|
||||
* Attribute that determines if remote (out-of-process) tabs should be used.
|
||||
*/
|
||||
readonly attribute boolean useRemoteTabs;
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* De-XPCOMed getter to make call-sites cleaner.
|
||||
|
@ -75,6 +80,12 @@ interface nsILoadContext : nsISupports
|
|||
GetUsePrivateBrowsing(&usingPB);
|
||||
return usingPB;
|
||||
}
|
||||
|
||||
bool UseRemoteTabs() {
|
||||
bool usingRT;
|
||||
GetUseRemoteTabs(&usingRT);
|
||||
return usingRT;
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
|
@ -82,6 +93,11 @@ interface nsILoadContext : nsISupports
|
|||
*/
|
||||
[noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
|
||||
|
||||
/**
|
||||
* Set the remote tabs state of the load context, meant to be used internally.
|
||||
*/
|
||||
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
|
||||
|
||||
/**
|
||||
* Returns true iff the load is occurring inside a browser element.
|
||||
*/
|
||||
|
|
|
@ -696,6 +696,8 @@ TabChild::Init()
|
|||
MOZ_ASSERT(loadContext);
|
||||
loadContext->SetPrivateBrowsing(
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW);
|
||||
loadContext->SetRemoteTabs(
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW);
|
||||
|
||||
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
|
||||
NS_ENSURE_TRUE(webProgress, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -1919,6 +1919,7 @@ TabParent::GetLoadContext()
|
|||
OwnOrContainingAppId(),
|
||||
true /* aIsContent */,
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW,
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW,
|
||||
IsBrowserElement());
|
||||
mLoadContext = loadContext;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,9 @@ interface nsIWebBrowserChrome : nsISupports
|
|||
// Whether this was opened by nsGlobalWindow::ShowModalDialog.
|
||||
const unsigned long CHROME_MODAL_CONTENT_WINDOW = 0x00080000;
|
||||
|
||||
// Whether this window should use remote (out-of-process) tabs.
|
||||
const unsigned long CHROME_REMOTE_WINDOW = 0x00100000;
|
||||
|
||||
// Prevents new window animations on Mac OS X Lion. Ignored on other
|
||||
// platforms.
|
||||
const unsigned long CHROME_MAC_SUPPRESS_ANIMATION = 0x01000000;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsIWindowCreator.h"
|
||||
#include "nsIWindowCreator2.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
|
@ -834,17 +835,24 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
|||
}
|
||||
}
|
||||
|
||||
// We rely on CalculateChromeFlags to decide whether remote (out-of-process)
|
||||
// tabs should be used.
|
||||
bool isRemoteWindow =
|
||||
!!(chromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW);
|
||||
|
||||
if (isNewToplevelWindow) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> childRoot;
|
||||
newDocShellItem->GetRootTreeItem(getter_AddRefs(childRoot));
|
||||
nsCOMPtr<nsILoadContext> childContext = do_QueryInterface(childRoot);
|
||||
if (childContext) {
|
||||
childContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
|
||||
childContext->SetRemoteTabs(isRemoteWindow);
|
||||
}
|
||||
} else if (windowIsNew) {
|
||||
nsCOMPtr<nsILoadContext> childContext = do_QueryInterface(newDocShellItem);
|
||||
if (childContext) {
|
||||
childContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
|
||||
childContext->SetRemoteTabs(isRemoteWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1428,6 +1436,19 @@ uint32_t nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow *aParent,
|
|||
nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW : 0;
|
||||
}
|
||||
|
||||
// Determine whether the window should have remote tabs.
|
||||
if (isCallerChrome) {
|
||||
bool remote;
|
||||
if (Preferences::GetBool("browser.tabs.remote.autostart")) {
|
||||
remote = !WinHasOption(aFeatures, "non-remote", 0, &presenceFlag);
|
||||
} else {
|
||||
remote = WinHasOption(aFeatures, "remote", 0, &presenceFlag);
|
||||
}
|
||||
if (remote) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_REMOTE_WINDOW;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
|
|
|
@ -233,6 +233,18 @@ OfflineCacheUpdateParent::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetUseRemoteTabs(bool *aUseRemoteTabs)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::SetRemoteTabs(bool aUseRemoteTabs)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetIsInBrowserElement(bool *aIsInBrowserElement)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче