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