зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1717726 - Add a debug-only assertion disallowing remote <browser>s or <iframe>s inside nsDeckFrame. r=tnikkel
The background to have this assertion is that nsDeckFrame::HideBox calls PresShell::ClearMouseCapture and ClearMouseCapture checks whether the being-hidden panel has a content capturing mouse events or not but the check doesn't work if the content is in a remote process. In our current mozilla-central tree, there is no such nsDeckFrame other than our browser's tab. In the case of our browser's tab when switching tabs, i.e. hiding an active tab, clearing the mouse capturing state has (should have) worked since E10S (Note for Fission cases it has worked since bug 1680405). So, because nsDeckFrame will be obsoleted sooner or later, we disallow the situation for other cases instead of adding special handling for the other case. Differential Revision: https://phabricator.services.mozilla.com/D119067
This commit is contained in:
Родитель
66148df97a
Коммит
523a115dcc
|
@ -217,6 +217,14 @@ nsDeckFrame::DoXULLayout(nsBoxLayoutState& aState) {
|
|||
// do a normal layout
|
||||
nsresult rv = nsBoxFrame::DoXULLayout(aState);
|
||||
|
||||
// <deck> and <tabpanels> other than our browser's tab shouldn't have any
|
||||
// <browser> or <iframe> to avoid running into troubles with Fission.
|
||||
MOZ_ASSERT((mContent->IsXULElement(nsGkAtoms::tabpanels) &&
|
||||
mContent->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::id, u"tabbrowser-tabpanels"_ns,
|
||||
eCaseMatters)) ||
|
||||
!HasPossiblyRemoteContents());
|
||||
|
||||
// run though each child. Hide all but the selected one
|
||||
nsIFrame* box = nsIFrame::GetChildXULBox(this);
|
||||
|
||||
|
@ -236,3 +244,21 @@ nsDeckFrame::DoXULLayout(nsBoxLayoutState& aState) {
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool nsDeckFrame::HasPossiblyRemoteContents() const {
|
||||
auto hasRemoteOrMayChangeRemoteNessAttribute =
|
||||
[](dom::Element& aElement) -> bool {
|
||||
return (aElement.AttrValueIs(kNameSpaceID_None, nsGkAtoms::remote,
|
||||
nsGkAtoms::_true, eCaseMatters) ||
|
||||
aElement.HasAttribute(u"maychangeremoteness"_ns));
|
||||
};
|
||||
|
||||
for (nsIContent* node = mContent; node; node = node->GetNextNode(mContent)) {
|
||||
if ((node->IsXULElement(nsGkAtoms::browser) ||
|
||||
node->IsHTMLElement(nsGkAtoms::iframe)) &&
|
||||
hasRemoteOrMayChangeRemoteNessAttribute(*(node->AsElement()))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,11 @@ class nsDeckFrame final : public nsBoxFrame {
|
|||
|
||||
nsIFrame* GetSelectedBox();
|
||||
|
||||
// Returns whether this frame has any <browser> or <iframe> elements.
|
||||
// Note that this function traverses down all descendants so this function
|
||||
// should be used only in debug builds.
|
||||
bool HasPossiblyRemoteContents() const;
|
||||
|
||||
protected:
|
||||
void IndexChanged();
|
||||
int32_t GetSelectedIndex();
|
||||
|
|
Загрузка…
Ссылка в новой задаче