Bug 1870037 - Remove [SecureContext] from Gamepads r=webidl,smaug

Differential Revision: https://phabricator.services.mozilla.com/D201086
This commit is contained in:
Kagami Sascha Rosylight 2024-02-20 17:10:54 +00:00
Родитель 6f377ee497
Коммит 59b33b03ad
12 изменённых файлов: 26 добавлений и 43 удалений

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

@ -450,23 +450,23 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GainNode", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "Gamepad", insecureContext: false },
{ name: "Gamepad", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadAxisMoveEvent", insecureContext: false },
{ name: "GamepadAxisMoveEvent", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadButtonEvent", insecureContext: false },
{ name: "GamepadButtonEvent", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadButton", insecureContext: false },
{ name: "GamepadButton", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadEvent", insecureContext: false },
{ name: "GamepadEvent", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadHapticActuator", insecureContext: false },
{ name: "GamepadHapticActuator", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadLightIndicator", insecureContext: false, disabled: true },
{ name: "GamepadLightIndicator", insecureContext: true, disabled: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadPose", insecureContext: false },
{ name: "GamepadPose", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "GamepadTouch", insecureContext: false, disabled: true },
{ name: "GamepadTouch", insecureContext: true, disabled: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "Geolocation", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!

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

@ -10,8 +10,7 @@
*/
[Pref="dom.gamepad.enabled",
Exposed=Window,
SecureContext]
Exposed=Window]
interface GamepadButton {
readonly attribute boolean pressed;
readonly attribute boolean touched;
@ -35,8 +34,7 @@ enum GamepadMappingType {
};
[Pref="dom.gamepad.enabled",
Exposed=Window,
SecureContext]
Exposed=Window]
interface Gamepad {
/**
* An identifier, unique per type of device.

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

@ -5,7 +5,7 @@
*/
[Pref="dom.gamepad.non_standard_events.enabled",
Exposed=Window, SecureContext]
Exposed=Window]
interface GamepadAxisMoveEvent : GamepadEvent
{
constructor(DOMString type,

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

@ -5,8 +5,7 @@
*/
[Pref="dom.gamepad.non_standard_events.enabled",
Exposed=Window,
SecureContext]
Exposed=Window]
interface GamepadButtonEvent : GamepadEvent
{
constructor(DOMString type,

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

@ -8,8 +8,7 @@
*/
[Pref="dom.gamepad.enabled",
Exposed=Window,
SecureContext]
Exposed=Window]
interface GamepadEvent : Event
{
constructor(DOMString type, optional GamepadEventInit eventInitDict = {});

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

@ -13,8 +13,7 @@ enum GamepadHapticActuatorType {
[Pref="dom.gamepad.extensions.enabled",
HeaderFile="mozilla/dom/GamepadHapticActuator.h",
Exposed=Window,
SecureContext]
Exposed=Window]
interface GamepadHapticActuator
{
readonly attribute GamepadHapticActuatorType type;

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

@ -18,7 +18,7 @@ dictionary GamepadLightColor {
required octet blue;
};
[SecureContext, Pref="dom.gamepad.extensions.lightindicator",
[Pref="dom.gamepad.extensions.lightindicator",
Exposed=Window]
interface GamepadLightIndicator
{

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

@ -8,8 +8,7 @@
*/
[Pref="dom.gamepad.extensions.enabled",
Exposed=Window,
SecureContext]
Exposed=Window]
interface GamepadPose
{
readonly attribute boolean hasOrientation;

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

@ -7,7 +7,7 @@
* https://github.com/knyg/gamepad/blob/multitouch/extensions.html
*/
[SecureContext, Pref="dom.gamepad.extensions.multitouch",
[Pref="dom.gamepad.extensions.multitouch",
Exposed=Window]
interface GamepadTouch {
readonly attribute unsigned long touchId;

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

@ -211,7 +211,7 @@ partial interface Navigator {
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
partial interface Navigator {
[Throws, Pref="dom.gamepad.enabled", SecureContext]
[Throws, Pref="dom.gamepad.enabled"]
sequence<Gamepad?> getGamepads();
};
partial interface Navigator {

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

@ -1,3 +0,0 @@
[gamepad-secure-context.html]
[Gamepad API is not exposed in non-secure contexts]
expected: FAIL

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

@ -4,22 +4,14 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Old Firefox didn't expose them to non-secure contexts while Chrome and Safari always did
test(() => {
// To avoid breaking legacy apps getGamepads() should always be exposed on
// the navigator object, even in non-secure contexts.
assert_true("getGamepads" in Navigator.prototype, "in prototype");
assert_true("getGamepads" in navigator, "on instance");
assert_implements(Navigator.prototype.getGamepads, "in prototype");
assert_implements(navigator.getGamepads, "on instance");
// Calling navigator.getGamepads() should return an empty array even if
// there are connected gamepads.
assert_array_equals(navigator.getGamepads(), [],
"getGamepads returns an empty array");
// Gamepad API types should not be exposed in non-secure contexts.
assert_equals(typeof(Gamepad), "undefined", "Gamepad type is undefined");
assert_equals(typeof(GamepadButton), "undefined",
"GamepadButton type is undefined");
assert_equals(typeof(GamepadEvent), "undefined",
"GamepadEvent type is undefined");
// Gamepad API types should also be exposed in non-secure contexts.
assert_implements(window.Gamepad, "Gamepad interface is exposed");
assert_implements(window.GamepadButton, "GamepadButton interface is exposed");
assert_implements(window.GamepadEvent, "GamepadEvent interface is exposed");
}, "Gamepad API is not exposed in non-secure contexts");
</script>