Bug 1542790 - Part 2: Use BC::GetParent and BC::GetTop for local windows, r=peterv

This is required to support getting the `parent` and `top` properties from
within remote subframes.

Differential Revision: https://phabricator.services.mozilla.com/D26559

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-04-17 00:53:09 +00:00
Родитель 7d3df12687
Коммит 4ebea6d3b6
2 изменённых файлов: 8 добавлений и 13 удалений

Просмотреть файл

@ -630,6 +630,10 @@ void BrowsingContext::Blur(ErrorResult& aError) {
}
Nullable<WindowProxyHolder> BrowsingContext::GetTop(ErrorResult& aError) {
if (mClosed) {
return nullptr;
}
// We never return null or throw an error, but the implementation in
// nsGlobalWindow does and we need to use the same signature.
return WindowProxyHolder(Top());

Просмотреть файл

@ -2944,13 +2944,8 @@ bool nsPIDOMWindowOuter::GetServiceWorkersTestingEnabled() {
}
Nullable<WindowProxyHolder> nsGlobalWindowOuter::GetParentOuter() {
nsPIDOMWindowOuter* parent = GetScriptableParent();
BrowsingContext* parentBC;
if (!parent || !(parentBC = parent->GetBrowsingContext())) {
return nullptr;
}
return WindowProxyHolder(parentBC);
BrowsingContext* bc = GetBrowsingContext();
return bc ? bc->GetParent(IgnoreErrors()) : nullptr;
}
/**
@ -3954,12 +3949,8 @@ uint32_t nsGlobalWindowOuter::Length() {
}
Nullable<WindowProxyHolder> nsGlobalWindowOuter::GetTopOuter() {
nsCOMPtr<nsPIDOMWindowOuter> top = GetScriptableTop();
BrowsingContext* topBC;
if (!top || !(topBC = top->GetBrowsingContext())) {
return nullptr;
}
return WindowProxyHolder(topBC);
BrowsingContext* bc = GetBrowsingContext();
return bc ? bc->GetTop(IgnoreErrors()) : nullptr;
}
already_AddRefed<BrowsingContext> nsGlobalWindowOuter::GetChildWindow(