зеркало из https://github.com/mozilla/gecko-dev.git
bug 1257287 - add nsIDocShell.tabChild r=smaug
This commit is contained in:
Родитель
2c05850952
Коммит
a6f221b6a2
|
@ -499,7 +499,7 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
||||||
if (IPCAccessibilityActive()) {
|
if (IPCAccessibilityActive()) {
|
||||||
nsIDocShell* docShell = aDocument->GetDocShell();
|
nsIDocShell* docShell = aDocument->GetDocShell();
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
nsCOMPtr<nsITabChild> tabChild = do_GetInterface(docShell);
|
nsCOMPtr<nsITabChild> tabChild = docShell->GetTabChild();
|
||||||
|
|
||||||
// XXX We may need to handle the case that we don't have a tab child
|
// XXX We may need to handle the case that we don't have a tab child
|
||||||
// differently. It may be that this will cause us to fail to notify
|
// differently. It may be that this will cause us to fail to notify
|
||||||
|
|
|
@ -1047,14 +1047,8 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
||||||
return treeOwner->QueryInterface(aIID, aSink);
|
return treeOwner->QueryInterface(aIID, aSink);
|
||||||
}
|
}
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsITabChild))) {
|
} else if (aIID.Equals(NS_GET_IID(nsITabChild))) {
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
*aSink = GetTabChild().take();
|
||||||
nsresult rv = GetTreeOwner(getter_AddRefs(treeOwner));
|
return *aSink ? NS_OK : NS_ERROR_FAILURE;
|
||||||
if (NS_SUCCEEDED(rv) && treeOwner) {
|
|
||||||
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(treeOwner);
|
|
||||||
if (ir) {
|
|
||||||
return ir->GetInterface(aIID, aSink);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIContentFrameMessageManager))) {
|
} else if (aIID.Equals(NS_GET_IID(nsIContentFrameMessageManager))) {
|
||||||
nsCOMPtr<nsITabChild> tabChild =
|
nsCOMPtr<nsITabChild> tabChild =
|
||||||
do_GetInterface(static_cast<nsIDocShell*>(this));
|
do_GetInterface(static_cast<nsIDocShell*>(this));
|
||||||
|
@ -14364,3 +14358,18 @@ nsDocShell::GetEditingSession(nsIEditingSession** aEditSession)
|
||||||
mEditorData->GetEditingSession(aEditSession);
|
mEditorData->GetEditingSession(aEditSession);
|
||||||
return *aEditSession ? NS_OK : NS_ERROR_FAILURE;
|
return *aEditSession ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocShell::GetScriptableTabChild(nsITabChild** aTabChild)
|
||||||
|
{
|
||||||
|
*aTabChild = GetTabChild().take();
|
||||||
|
return *aTabChild ? NS_OK : NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsITabChild>
|
||||||
|
nsDocShell::GetTabChild()
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIDocShellTreeOwner> owner(mTreeOwner);
|
||||||
|
nsCOMPtr<nsITabChild> tc = do_GetInterface(owner);
|
||||||
|
return tc.forget();
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ interface nsIPrivacyTransitionObserver;
|
||||||
interface nsIReflowObserver;
|
interface nsIReflowObserver;
|
||||||
interface nsIScrollObserver;
|
interface nsIScrollObserver;
|
||||||
interface nsITabParent;
|
interface nsITabParent;
|
||||||
|
interface nsITabChild;
|
||||||
|
native TabChildRef(already_AddRefed<nsITabChild>);
|
||||||
|
|
||||||
typedef unsigned long nsLoadFlags;
|
typedef unsigned long nsLoadFlags;
|
||||||
|
|
||||||
|
@ -1097,4 +1099,10 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
* The editing session for this docshell.
|
* The editing session for this docshell.
|
||||||
*/
|
*/
|
||||||
readonly attribute nsIEditingSession editingSession;
|
readonly attribute nsIEditingSession editingSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tab child for this docshell.
|
||||||
|
*/
|
||||||
|
[binaryname(ScriptableTabChild)] readonly attribute nsITabChild tabChild;
|
||||||
|
[noscript,notxpcom,nostdcall] TabChildRef GetTabChild();
|
||||||
};
|
};
|
||||||
|
|
|
@ -303,7 +303,8 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
|
||||||
|
|
||||||
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
|
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
|
||||||
|
|
||||||
nsCOMPtr<nsITabChild> tabChild = do_GetInterface(rootDocShell);
|
nsCOMPtr<nsITabChild> tabChild =
|
||||||
|
rootDocShell ? rootDocShell->GetTabChild() : nullptr;
|
||||||
if (tabChild) {
|
if (tabChild) {
|
||||||
nsCOMPtr<nsIContentFrameMessageManager> mm;
|
nsCOMPtr<nsIContentFrameMessageManager> mm;
|
||||||
tabChild->GetMessageManager(getter_AddRefs(mm));
|
tabChild->GetMessageManager(getter_AddRefs(mm));
|
||||||
|
|
|
@ -869,9 +869,11 @@ nsFocusManager::WindowShown(mozIDOMWindowProxy* aWindow, bool aNeedsFocus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsCOMPtr<nsITabChild> child = do_GetInterface(window->GetDocShell())) {
|
if (nsIDocShell* docShell = window->GetDocShell()) {
|
||||||
bool active = static_cast<TabChild*>(child.get())->ParentIsActive();
|
if (nsCOMPtr<nsITabChild> child = docShell->GetTabChild()) {
|
||||||
ActivateOrDeactivate(window, active);
|
bool active = static_cast<TabChild*>(child.get())->ParentIsActive();
|
||||||
|
ActivateOrDeactivate(window, active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFocusedWindow != window)
|
if (mFocusedWindow != window)
|
||||||
|
@ -1632,7 +1634,7 @@ nsFocusManager::Blur(nsPIDOMWindowOuter* aWindowToClear,
|
||||||
if (aAdjustWidgets && objectFrame && !sTestMode) {
|
if (aAdjustWidgets && objectFrame && !sTestMode) {
|
||||||
if (XRE_IsContentProcess()) {
|
if (XRE_IsContentProcess()) {
|
||||||
// set focus to the top level window via the chrome process.
|
// set focus to the top level window via the chrome process.
|
||||||
nsCOMPtr<nsITabChild> tabChild = do_GetInterface(docShell);
|
nsCOMPtr<nsITabChild> tabChild = docShell->GetTabChild();
|
||||||
if (tabChild) {
|
if (tabChild) {
|
||||||
static_cast<TabChild*>(tabChild.get())->SendDispatchFocusToTopLevelWindow();
|
static_cast<TabChild*>(tabChild.get())->SendDispatchFocusToTopLevelWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9061,9 +9061,12 @@ nsresult
|
||||||
nsGlobalWindow::UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason)
|
nsGlobalWindow::UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason)
|
||||||
{
|
{
|
||||||
// If this is a child process, redirect to the parent process.
|
// If this is a child process, redirect to the parent process.
|
||||||
if (nsCOMPtr<nsITabChild> child = do_GetInterface(GetDocShell())) {
|
if (nsIDocShell* docShell = GetDocShell()) {
|
||||||
nsContentUtils::AddScriptRunner(new ChildCommandDispatcher(this, child, anAction));
|
if (nsCOMPtr<nsITabChild> child = docShell->GetTabChild()) {
|
||||||
return NS_OK;
|
nsContentUtils::AddScriptRunner(new ChildCommandDispatcher(this, child,
|
||||||
|
anAction));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPIDOMWindowOuter *rootWindow = nsGlobalWindow::GetPrivateRoot();
|
nsPIDOMWindowOuter *rootWindow = nsGlobalWindow::GetPrivateRoot();
|
||||||
|
@ -10685,7 +10688,8 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||||
ProcessHangMonitor::Get()) {
|
ProcessHangMonitor::Get()) {
|
||||||
ProcessHangMonitor::SlowScriptAction action;
|
ProcessHangMonitor::SlowScriptAction action;
|
||||||
RefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();
|
RefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();
|
||||||
nsCOMPtr<nsITabChild> child = do_GetInterface(GetDocShell());
|
nsIDocShell* docShell = GetDocShell();
|
||||||
|
nsCOMPtr<nsITabChild> child = docShell ? docShell->GetTabChild() : nullptr;
|
||||||
action = monitor->NotifySlowScript(child,
|
action = monitor->NotifySlowScript(child,
|
||||||
filename.get(),
|
filename.get(),
|
||||||
lineno);
|
lineno);
|
||||||
|
|
|
@ -981,7 +981,9 @@ EventStateManager::ExecuteAccessKey(nsTArray<uint32_t>& aAccessCharCodes,
|
||||||
if (focusChanged && aIsTrustedEvent) {
|
if (focusChanged && aIsTrustedEvent) {
|
||||||
// If this is a child process, inform the parent that we want the focus, but
|
// If this is a child process, inform the parent that we want the focus, but
|
||||||
// pass false since we don't want to change the window order.
|
// pass false since we don't want to change the window order.
|
||||||
nsCOMPtr<nsITabChild> child = do_GetInterface(mPresContext->GetDocShell());
|
nsIDocShell* docShell = mPresContext->GetDocShell();
|
||||||
|
nsCOMPtr<nsITabChild> child =
|
||||||
|
docShell ? docShell->GetTabChild() : nullptr;
|
||||||
if (child) {
|
if (child) {
|
||||||
child->SendRequestFocus(false);
|
child->SendRequestFocus(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,7 +512,11 @@ public:
|
||||||
static inline TabChild*
|
static inline TabChild*
|
||||||
GetFrom(nsIDocShell* aDocShell)
|
GetFrom(nsIDocShell* aDocShell)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
if (!aDocShell) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsITabChild> tc = aDocShell->GetTabChild();
|
||||||
return static_cast<TabChild*>(tc.get());
|
return static_cast<TabChild*>(tc.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,23 +73,20 @@ nsPrintingProxy::ShowPrintDialog(mozIDOMWindowProxy *parent,
|
||||||
NS_ENSURE_ARG(webBrowserPrint);
|
NS_ENSURE_ARG(webBrowserPrint);
|
||||||
NS_ENSURE_ARG(printSettings);
|
NS_ENSURE_ARG(printSettings);
|
||||||
|
|
||||||
// Get the root docshell owner of this nsIDOMWindow, which
|
// Get the TabChild for this nsIDOMWindow, which we can then pass up to
|
||||||
// should map to a TabChild, which we can then pass up to
|
|
||||||
// the parent.
|
// the parent.
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> pwin = nsPIDOMWindowOuter::From(parent);
|
nsCOMPtr<nsPIDOMWindowOuter> pwin = nsPIDOMWindowOuter::From(parent);
|
||||||
NS_ENSURE_STATE(pwin);
|
NS_ENSURE_STATE(pwin);
|
||||||
nsCOMPtr<nsIDocShell> docShell = pwin->GetDocShell();
|
nsCOMPtr<nsIDocShell> docShell = pwin->GetDocShell();
|
||||||
NS_ENSURE_STATE(docShell);
|
NS_ENSURE_STATE(docShell);
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
|
||||||
nsresult rv = docShell->GetTreeOwner(getter_AddRefs(owner));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsCOMPtr<nsITabChild> tabchild = do_GetInterface(owner);
|
nsCOMPtr<nsITabChild> tabchild = docShell->GetTabChild();
|
||||||
NS_ENSURE_STATE(tabchild);
|
NS_ENSURE_STATE(tabchild);
|
||||||
|
|
||||||
TabChild* pBrowser = static_cast<TabChild*>(tabchild.get());
|
TabChild* pBrowser = static_cast<TabChild*>(tabchild.get());
|
||||||
|
|
||||||
// Next, serialize the nsIWebBrowserPrint and nsIPrintSettings we were given.
|
// Next, serialize the nsIWebBrowserPrint and nsIPrintSettings we were given.
|
||||||
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIPrintOptions> po =
|
nsCOMPtr<nsIPrintOptions> po =
|
||||||
do_GetService("@mozilla.org/gfx/printsettings-service;1", &rv);
|
do_GetService("@mozilla.org/gfx/printsettings-service;1", &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -134,17 +131,13 @@ nsPrintingProxy::ShowProgress(mozIDOMWindowProxy* parent,
|
||||||
NS_ENSURE_ARG(printProgressParams);
|
NS_ENSURE_ARG(printProgressParams);
|
||||||
NS_ENSURE_ARG(notifyOnOpen);
|
NS_ENSURE_ARG(notifyOnOpen);
|
||||||
|
|
||||||
// Get the root docshell owner of this nsIDOMWindow, which
|
// Get the TabChild for this nsIDOMWindow, which we can then pass up to
|
||||||
// should map to a TabChild, which we can then pass up to
|
|
||||||
// the parent.
|
// the parent.
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> pwin = nsPIDOMWindowOuter::From(parent);
|
nsCOMPtr<nsPIDOMWindowOuter> pwin = nsPIDOMWindowOuter::From(parent);
|
||||||
NS_ENSURE_STATE(pwin);
|
NS_ENSURE_STATE(pwin);
|
||||||
nsCOMPtr<nsIDocShell> docShell = pwin->GetDocShell();
|
nsCOMPtr<nsIDocShell> docShell = pwin->GetDocShell();
|
||||||
NS_ENSURE_STATE(docShell);
|
NS_ENSURE_STATE(docShell);
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
nsCOMPtr<nsITabChild> tabchild = docShell->GetTabChild();
|
||||||
nsresult rv = docShell->GetTreeOwner(getter_AddRefs(owner));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr<nsITabChild> tabchild = do_GetInterface(owner);
|
|
||||||
TabChild* pBrowser = static_cast<TabChild*>(tabchild.get());
|
TabChild* pBrowser = static_cast<TabChild*>(tabchild.get());
|
||||||
|
|
||||||
RefPtr<PrintProgressDialogChild> dialogChild =
|
RefPtr<PrintProgressDialogChild> dialogChild =
|
||||||
|
@ -152,6 +145,7 @@ nsPrintingProxy::ShowProgress(mozIDOMWindowProxy* parent,
|
||||||
|
|
||||||
SendPPrintProgressDialogConstructor(dialogChild);
|
SendPPrintProgressDialogConstructor(dialogChild);
|
||||||
|
|
||||||
|
nsresult rv = NS_OK;
|
||||||
mozilla::Unused << SendShowProgress(pBrowser, dialogChild,
|
mozilla::Unused << SendShowProgress(pBrowser, dialogChild,
|
||||||
isForPrinting, notifyOnOpen, &rv);
|
isForPrinting, notifyOnOpen, &rv);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
|
|
@ -379,18 +379,13 @@ OfflineCacheUpdateChild::Schedule()
|
||||||
NS_ASSERTION(mWindow, "Window must be provided to the offline cache update child");
|
NS_ASSERTION(mWindow, "Window must be provided to the offline cache update child");
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> window = mWindow.forget();
|
nsCOMPtr<nsPIDOMWindowInner> window = mWindow.forget();
|
||||||
nsIDocShell *docshell = window->GetDocShell();
|
nsCOMPtr<nsIDocShell >docshell = window->GetDocShell();
|
||||||
|
if (!docshell) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(docshell);
|
|
||||||
if (!item) {
|
|
||||||
NS_WARNING("doc shell tree item is null");
|
NS_WARNING("doc shell tree item is null");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
nsCOMPtr<nsITabChild> tabchild = docshell->GetTabChild();
|
||||||
item->GetTreeOwner(getter_AddRefs(owner));
|
|
||||||
|
|
||||||
nsCOMPtr<nsITabChild> tabchild = do_GetInterface(owner);
|
|
||||||
// because owner implements nsITabChild, we can assume that it is
|
// because owner implements nsITabChild, we can assume that it is
|
||||||
// the one and only TabChild.
|
// the one and only TabChild.
|
||||||
TabChild* child = tabchild ? static_cast<TabChild*>(tabchild.get()) : nullptr;
|
TabChild* child = tabchild ? static_cast<TabChild*>(tabchild.get()) : nullptr;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче