Bug 1657071 - Restrict getGamepads() to secure contexts for Beta r=kip

release SecureContext restriction to 81 beta channel.

Differential Revision: https://phabricator.services.mozilla.com/D85830
This commit is contained in:
Marcos Cáceres 2020-08-07 02:30:25 +00:00
Родитель 41ea5830c7
Коммит 62d3c9edb3
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -1490,7 +1490,7 @@ void Navigator::GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads,
if (!mGamepadSecureContextWarningShown && !win->IsSecureContext()) { if (!mGamepadSecureContextWarningShown && !win->IsSecureContext()) {
mGamepadSecureContextWarningShown = true; mGamepadSecureContextWarningShown = true;
auto msg = auto msg =
u"The Gamepad API is only available in " u"The Gamepad API will only be available in "
"secure contexts (e.g., https). Please see " "secure contexts (e.g., https). Please see "
"https://hacks.mozilla.org/2020/07/securing-gamepad-api/ for more " "https://hacks.mozilla.org/2020/07/securing-gamepad-api/ for more "
"info."_ns; "info."_ns;
@ -1498,11 +1498,14 @@ void Navigator::GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads,
msg, nsIScriptError::warningFlag, "DOM"_ns, win->GetExtantDoc()); msg, nsIScriptError::warningFlag, "DOM"_ns, win->GetExtantDoc());
} }
#ifdef NIGHTLY_BUILD #ifdef EARLY_BETA_OR_EARLIER
if (!win->IsSecureContext()) { if (!win->IsSecureContext()) {
return; return;
} }
#endif
#ifdef NIGHTLY_BUILD
// We will move this into Beta in Firefox 82
if (!FeaturePolicyUtils::IsFeatureAllowed(win->GetExtantDoc(), if (!FeaturePolicyUtils::IsFeatureAllowed(win->GetExtantDoc(),
u"gamepad"_ns)) { u"gamepad"_ns)) {
aRv.ThrowSecurityError( aRv.ThrowSecurityError(