Bug 1719285 - Make nsFrameLoader::GetExistingDocShell returning nsDocShell; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D119183
This commit is contained in:
Edgar Chen 2021-07-06 13:30:08 +00:00
Родитель cd0b84af3a
Коммит cc5d17fb0c
3 изменённых файлов: 6 добавлений и 8 удалений

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

@ -1561,10 +1561,8 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_ERROR_DOM_SECURITY_ERR;
}
RefPtr<nsDocShell> ourDocshell =
static_cast<nsDocShell*>(GetExistingDocShell());
RefPtr<nsDocShell> otherDocshell =
static_cast<nsDocShell*>(aOther->GetExistingDocShell());
RefPtr<nsDocShell> ourDocshell = GetExistingDocShell();
RefPtr<nsDocShell> otherDocshell = aOther->GetExistingDocShell();
if (!ourDocshell || !otherDocshell) {
// How odd
return NS_ERROR_NOT_IMPLEMENTED;
@ -3371,7 +3369,7 @@ already_AddRefed<Promise> nsFrameLoader::PrintPreview(
sourceWindow =
nsGlobalWindowOuter::Cast(aSourceBrowsingContext->GetDOMWindow());
} else {
auto* ourDocshell = static_cast<nsDocShell*>(GetExistingDocShell());
nsDocShell* ourDocshell = GetExistingDocShell();
if (NS_WARN_IF(!ourDocshell)) {
promise->MaybeRejectWithNotSupportedError("No print preview docShell");
return promise.forget();

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

@ -137,7 +137,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
void StartDestroy(bool aForProcessSwitch);
void DestroyDocShell();
void DestroyComplete();
nsIDocShell* GetExistingDocShell() const { return mDocShell; }
nsDocShell* GetExistingDocShell() const { return mDocShell; }
mozilla::dom::InProcessBrowserChildMessageManager*
GetBrowserChildMessageManager() const {
return mChildMessageManager;

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

@ -244,8 +244,8 @@ nsresult nsGenericHTMLFrameElement::AfterSetAttr(
if (aName == nsGkAtoms::scrolling) {
if (mFrameLoader) {
ScrollbarPreference pref = MapScrollingAttribute(aValue);
if (nsIDocShell* docshell = mFrameLoader->GetExistingDocShell()) {
nsDocShell::Cast(docshell)->SetScrollbarPreference(pref);
if (nsDocShell* docshell = mFrameLoader->GetExistingDocShell()) {
docshell->SetScrollbarPreference(pref);
} else if (auto* child = mFrameLoader->GetBrowserBridgeChild()) {
// NOTE(emilio): We intentionally don't deal with the
// GetBrowserParent() case, and only deal with the fission iframe