зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1258925 - [e10s] Browser window is resized when click. r=gabor
Adds a new IPC message to the PBrowser protocol exposing the number of tabs in the current window to the content process. This allows the content process to reject window.resize* calls in cases where there is more than one tab in the window. --HG-- extra : histedit_source : dfa6b7b71882a1583cbbe90c2a7327cb212ed15d
This commit is contained in:
Родитель
6004e70ecd
Коммит
50fdb00a05
|
@ -4157,6 +4157,10 @@ var XULBrowserWindow = {
|
|||
elt.hidePopup();
|
||||
},
|
||||
|
||||
getTabCount: function () {
|
||||
return gBrowser.tabs.length;
|
||||
},
|
||||
|
||||
updateStatusField: function () {
|
||||
var text, type, types = ["overLink"];
|
||||
if (this._busyUI)
|
||||
|
|
|
@ -6434,13 +6434,23 @@ nsGlobalWindow::CanMoveResizeWindows(bool aCallerIsChrome)
|
|||
}
|
||||
|
||||
// Ignore the request if we have more than one tab in the window.
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner = GetTreeOwner();
|
||||
if (treeOwner) {
|
||||
uint32_t itemCount;
|
||||
if (NS_SUCCEEDED(treeOwner->GetTargetableShellCount(&itemCount)) &&
|
||||
itemCount > 1) {
|
||||
return false;
|
||||
uint32_t itemCount = 0;
|
||||
if (XRE_IsContentProcess()) {
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsITabChild> child = docShell->GetTabChild();
|
||||
if (child) {
|
||||
child->SendGetTabCount(&itemCount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner = GetTreeOwner();
|
||||
if (treeOwner) {
|
||||
treeOwner->GetTargetableShellCount(&itemCount);
|
||||
}
|
||||
}
|
||||
if (itemCount > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ interface nsITabChild : nsISupports
|
|||
|
||||
[notxpcom] void sendRequestFocus(in boolean canFocus);
|
||||
|
||||
[notxpcom] void sendGetTabCount(out uint32_t tabCount);
|
||||
|
||||
[noscript, notxpcom] void enableDisableCommands(in AString action,
|
||||
in CommandsArrayRef enabledCommands,
|
||||
in CommandsArrayRef disabledCommands);
|
||||
|
|
|
@ -470,6 +470,8 @@ parent:
|
|||
bool aLongTap,
|
||||
uint64_t aObserverId);
|
||||
async ClearNativeTouchSequence(uint64_t aObserverId);
|
||||
|
||||
sync GetTabCount() returns (uint32_t value);
|
||||
child:
|
||||
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
|
||||
|
||||
|
|
|
@ -2727,6 +2727,12 @@ TabChild::SendRequestFocus(bool aCanFocus)
|
|||
PBrowserChild::SendRequestFocus(aCanFocus);
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::SendGetTabCount(uint32_t* tabCount)
|
||||
{
|
||||
PBrowserChild::SendGetTabCount(tabCount);
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::EnableDisableCommands(const nsAString& aAction,
|
||||
nsTArray<nsCString>& aEnabledCommands,
|
||||
|
|
|
@ -3244,6 +3244,20 @@ TabParent::AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvGetTabCount(uint32_t* aValue)
|
||||
{
|
||||
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow = GetXULBrowserWindow();
|
||||
NS_ENSURE_TRUE(xulBrowserWindow, false);
|
||||
|
||||
uint32_t tabCount;
|
||||
nsresult rv = xulBrowserWindow->GetTabCount(&tabCount);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
*aValue = tabCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
|
||||
{
|
||||
|
|
|
@ -582,6 +582,8 @@ protected:
|
|||
const int32_t& aX, const int32_t& aY,
|
||||
const int32_t& aCx, const int32_t& aCy) override;
|
||||
|
||||
virtual bool RecvGetTabCount(uint32_t* aValue) override;
|
||||
|
||||
virtual bool RecvAudioChannelActivityNotification(const uint32_t& aAudioChannel,
|
||||
const bool& aActive) override;
|
||||
|
||||
|
|
|
@ -67,5 +67,10 @@ interface nsIXULBrowserWindow : nsISupports
|
|||
*/
|
||||
void showTooltip(in long x, in long y, in AString tooltip, in AString direction);
|
||||
void hideTooltip();
|
||||
|
||||
/**
|
||||
* Return the number of tabs in this window.
|
||||
*/
|
||||
uint32_t getTabCount();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче