mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1268749 part 4 - Hide unprefixed Fullscreen API from content when disabled. r=smaug
MozReview-Commit-ID: KpjNFYYyCWh --HG-- extra : rebase_source : 43eebf0398c3accbe2f901d482f9d4399bdf03e6
This commit is contained in:
parent
25d88bda72
commit
eb882bc07f
@ -264,6 +264,7 @@ nsString* nsContentUtils::sModifierSeparator = nullptr;
|
||||
|
||||
bool nsContentUtils::sInitialized = false;
|
||||
bool nsContentUtils::sIsFullScreenApiEnabled = false;
|
||||
bool nsContentUtils::sIsUnprefixedFullscreenApiEnabled = false;
|
||||
bool nsContentUtils::sTrustedFullScreenOnly = true;
|
||||
bool nsContentUtils::sIsCutCopyAllowed = true;
|
||||
bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
|
||||
@ -539,6 +540,9 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsFullScreenApiEnabled,
|
||||
"full-screen-api.enabled");
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsUnprefixedFullscreenApiEnabled,
|
||||
"full-screen-api.unprefix.enabled");
|
||||
|
||||
Preferences::AddBoolVarCache(&sTrustedFullScreenOnly,
|
||||
"full-screen-api.allow-trusted-requests-only");
|
||||
|
||||
|
@ -1912,6 +1912,12 @@ public:
|
||||
*/
|
||||
static bool IsFullScreenApiEnabled();
|
||||
|
||||
/**
|
||||
* Returns true if the unprefixed fullscreen API is enabled.
|
||||
*/
|
||||
static bool IsUnprefixedFullscreenApiEnabled()
|
||||
{ return sIsUnprefixedFullscreenApiEnabled; }
|
||||
|
||||
/**
|
||||
* Returns true if requests for full-screen are allowed in the current
|
||||
* context. Requests are only allowed if the user initiated them (like with
|
||||
@ -2661,6 +2667,7 @@ private:
|
||||
static bool sIsHandlingKeyBoardEvent;
|
||||
static bool sAllowXULXBL_for_file;
|
||||
static bool sIsFullScreenApiEnabled;
|
||||
static bool sIsUnprefixedFullscreenApiEnabled;
|
||||
static bool sTrustedFullScreenOnly;
|
||||
static bool sIsCutCopyAllowed;
|
||||
static uint32_t sHandlingInputTimeout;
|
||||
|
@ -11680,6 +11680,14 @@ nsresult nsDocument::RemoteFrameFullscreenReverted()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsDocument::IsUnprefixedFullscreenEnabled(JSContext* aCx, JSObject* aObject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return nsContentUtils::IsCallerChrome() ||
|
||||
nsContentUtils::IsUnprefixedFullscreenApiEnabled();
|
||||
}
|
||||
|
||||
static void
|
||||
ReleaseVRDeviceProxyRef(void *, nsIAtom*, void *aPropertyValue, void *)
|
||||
{
|
||||
|
@ -1236,6 +1236,8 @@ public:
|
||||
//
|
||||
already_AddRefed<nsSimpleContentList> BlockedTrackingNodes() const;
|
||||
|
||||
static bool IsUnprefixedFullscreenEnabled(JSContext* aCx, JSObject* aObject);
|
||||
|
||||
// Do the "fullscreen element ready check" from the fullscreen spec.
|
||||
// It returns true if the given element is allowed to go into fullscreen.
|
||||
bool FullscreenElementReadyCheck(Element* aElement, bool aWasCallerChrome);
|
||||
|
@ -224,13 +224,16 @@ partial interface Document {
|
||||
partial interface Document {
|
||||
// Note: Per spec the 'S' in these two is lowercase, but the "Moz"
|
||||
// versions hve it uppercase.
|
||||
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
readonly attribute boolean fullscreenEnabled;
|
||||
[BinaryName="fullscreenEnabled", Deprecated="PrefixedFullscreenAPI"]
|
||||
readonly attribute boolean mozFullScreenEnabled;
|
||||
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
readonly attribute Element? fullscreenElement;
|
||||
[BinaryName="fullscreenElement", Deprecated="PrefixedFullscreenAPI"]
|
||||
readonly attribute Element? mozFullScreenElement;
|
||||
|
||||
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
void exitFullscreen();
|
||||
[BinaryName="exitFullscreen", Deprecated="PrefixedFullscreenAPI"]
|
||||
void mozCancelFullScreen();
|
||||
|
@ -259,7 +259,7 @@ partial interface Element {
|
||||
* The options parameter is non-standard. In Gecko, it can be:
|
||||
* a RequestFullscreenOptions object
|
||||
*/
|
||||
[Throws, UnsafeInPrerendering]
|
||||
[Throws, UnsafeInPrerendering, Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
void requestFullscreen(optional any options);
|
||||
[Throws, UnsafeInPrerendering, BinaryName="requestFullscreen", Deprecated="PrefixedFullscreenAPI"]
|
||||
void mozRequestFullScreen(optional any options);
|
||||
|
@ -118,7 +118,9 @@ interface GlobalEventHandlers {
|
||||
attribute EventHandler onlostpointercapture;
|
||||
|
||||
// Fullscreen events handlers
|
||||
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
attribute EventHandler onfullscreenchange;
|
||||
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
|
||||
attribute EventHandler onfullscreenerror;
|
||||
attribute EventHandler onmozfullscreenchange;
|
||||
attribute EventHandler onmozfullscreenerror;
|
||||
|
Loading…
Reference in New Issue
Block a user