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