Bug 1945081 - Window's indexed getter should not expose shadow DOM iframe, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D240390
This commit is contained in:
Olli Pettay
2025-03-06 12:08:48 +00:00
parent 44b61dcf56
commit 420e8abf0f
6 changed files with 75 additions and 6 deletions

View File

@@ -752,6 +752,10 @@ static bool OwnerAllowsFullscreen(const Element& aEmbedder) {
void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
mEmbeddedByThisProcess = true;
if (RefPtr<WindowContext> parent = GetParentWindowContext()) {
parent->ClearLightDOMChildren();
}
// Update embedder-element-specific fields in a shared transaction.
// Don't do this when clearing our embedder, as we're being destroyed either
// way.
@@ -1220,6 +1224,21 @@ Span<RefPtr<BrowsingContext>> BrowsingContext::NonSyntheticChildren() const {
return Span<RefPtr<BrowsingContext>>();
}
BrowsingContext* BrowsingContext::NonSyntheticLightDOMChildAt(
uint32_t aIndex) const {
if (WindowContext* current = mCurrentWindowContext) {
return current->NonSyntheticLightDOMChildAt(aIndex);
}
return nullptr;
}
uint32_t BrowsingContext::NonSyntheticLightDOMChildrenCount() const {
if (WindowContext* current = mCurrentWindowContext) {
return current->NonSyntheticLightDOMChildrenCount();
}
return 0;
}
void BrowsingContext::GetWindowContexts(
nsTArray<RefPtr<WindowContext>>& aWindows) {
aWindows.AppendElements(mWindowContexts);