diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 153f55b48caf..5974bc4ad345 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -13596,7 +13596,7 @@ static bool HasFullscreenSubDocument(Document& aDoc) { // Returns nullptr if a request for Fullscreen API is currently enabled // in the given document. Returns a static string indicates the reason // why it is not enabled otherwise. -static const char* GetFullscreenError(Document* aDoc, CallerType aCallerType) { +const char* Document::GetFullscreenError(CallerType aCallerType) { if (!StaticPrefs::full_screen_api_enabled()) { return "FullscreenDeniedDisabled"; } @@ -13607,13 +13607,18 @@ static const char* GetFullscreenError(Document* aDoc, CallerType aCallerType) { return nullptr; } - if (!aDoc->IsVisible()) { + if (!IsVisible()) { return "FullscreenDeniedHidden"; } + if (!FeaturePolicyUtils::IsFeatureAllowed(this, + NS_LITERAL_STRING("fullscreen"))) { + return "FullscreenDeniedFeaturePolicy"; + } + // Ensure that all containing elements are