72d64d
diff -up firefox-78.9.0/widget/gtk/nsWindow.cpp.D110204-fscreen firefox-78.9.0/widget/gtk/nsWindow.cpp
72d64d
--- firefox-78.9.0/widget/gtk/nsWindow.cpp.D110204-fscreen	2021-03-30 13:28:56.212009697 +0200
72d64d
+++ firefox-78.9.0/widget/gtk/nsWindow.cpp	2021-03-30 13:37:41.925850585 +0200
72d64d
@@ -139,6 +139,7 @@ using namespace mozilla::widget;
72d64d
 
72d64d
 #include <dlfcn.h>
72d64d
 #include "nsPresContext.h"
72d64d
+#include "nsIBrowserHandler.h"
72d64d
 
72d64d
 using namespace mozilla;
72d64d
 using namespace mozilla::gfx;
72d64d
@@ -416,6 +417,7 @@ nsWindow::nsWindow() {
72d64d
   mRetryPointerGrab = false;
72d64d
   mWindowType = eWindowType_child;
72d64d
   mSizeState = nsSizeMode_Normal;
72d64d
+  mPendingFullscreen = false;
72d64d
   mBoundsAreValid = true;
72d64d
   mAspectRatio = 0.0f;
72d64d
   mAspectRatioSaved = 0.0f;
72d64d
@@ -3887,6 +3889,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
72d64d
       }
72d64d
     }
72d64d
   }
72d64d
+
72d64d
+  // Hack to ensure window switched to fullscreen - avoid to fail when starting
72d64d
+  // in kiosk mode
72d64d
+  if (mPendingFullscreen &&
72d64d
+      !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
72d64d
+    LOG(
72d64d
+        ("  Window should be fullscreen, but it's not, retrying set to "
72d64d
+         "fullscreen.\n"));
72d64d
+    MakeFullScreen(true);
72d64d
+  } else {
72d64d
+    LOG(("  Window successfully switched to fullscreen, happy now\n"));
72d64d
+    mPendingFullscreen = false;
72d64d
+  }
72d64d
 }
72d64d
 
72d64d
 void nsWindow::ThemeChanged() {
72d64d
@@ -6010,6 +6025,19 @@ nsresult nsWindow::MakeFullScreen(bool a
72d64d
       }
72d64d
     }
72d64d
 
72d64d
+    // if in kiosk, ensure the fullscreen is called
72d64d
+    nsCOMPtr<nsIBrowserHandler> browserHandler =
72d64d
+        do_GetService("@mozilla.org/browser/clh;1");
72d64d
+    if (browserHandler) {
72d64d
+      bool isKiosk;
72d64d
+      browserHandler->GetKiosk(&isKiosk);
72d64d
+      if (isKiosk) {
72d64d
+        LOG(("  is kiosk, ensure the window switch to fullscreen\n"));
72d64d
+        mPendingFullscreen = true;
72d64d
+      }
72d64d
+    } else {
72d64d
+      LOG(("  Cannot find the browserHandler service.\n"));
72d64d
+    }
72d64d
     gtk_window_fullscreen(GTK_WINDOW(mShell));
72d64d
   } else {
72d64d
     mSizeMode = mLastSizeMode;
72d64d
diff -up firefox-78.9.0/widget/gtk/nsWindow.h.D110204-fscreen firefox-78.9.0/widget/gtk/nsWindow.h
72d64d
--- firefox-78.9.0/widget/gtk/nsWindow.h.D110204-fscreen	2021-03-15 16:52:42.000000000 +0100
72d64d
+++ firefox-78.9.0/widget/gtk/nsWindow.h	2021-03-30 13:28:56.237009784 +0200
72d64d
@@ -703,6 +703,7 @@ class nsWindow final : public nsBaseWidg
72d64d
   nsRect mPreferredPopupRect;
72d64d
   bool mPreferredPopupRectFlushed;
72d64d
   bool mWaitingForMoveToRectCB;
72d64d
+  bool mPendingFullscreen;
72d64d
   LayoutDeviceIntRect mPendingSizeRect;
72d64d
 
72d64d
   /**