diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 6f6fa7066cf..d0901337aaa 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6225,7 +6225,7 @@ nsGlobalWindow::GetMainWidget() } nsIWidget* -nsGlobalWindow::GetNearestWidget() +nsGlobalWindow::GetNearestWidget() const { nsIDocShell* docShell = GetDocShell(); NS_ENSURE_TRUE(docShell, nullptr); @@ -6666,8 +6666,16 @@ nsGlobalWindow::FullScreen() const nsCOMPtr rootItem; mDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); if (rootItem == mDocShell) { - // We are the root window. Return our internal value. - return mFullScreen; + if (!XRE_IsContentProcess()) { + // We are the root window. Return our internal value. + return mFullScreen; + } + if (nsCOMPtr widget = GetNearestWidget()) { + // We are in content process, figure out the value from + // the sizemode of the puppet widget. + return widget->SizeMode() == nsSizeMode_Fullscreen; + } + return false; } nsCOMPtr window = rootItem->GetWindow(); diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 164517b9db7..42d52f7ed71 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1509,7 +1509,7 @@ public: bool WindowExists(const nsAString& aName, bool aLookForCallerOnJSStack); already_AddRefed GetMainWidget(); - nsIWidget* GetNearestWidget(); + nsIWidget* GetNearestWidget() const; void Freeze() { diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index a67bac99b2a..c6e9fabe753 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -368,7 +368,7 @@ public: /** * Get the docshell in this window. */ - nsIDocShell *GetDocShell() + nsIDocShell *GetDocShell() const { if (mOuterWindow) { return mOuterWindow->mDocShell;