Re: [w3c/gamepad] getGamepad() check if doc is fully active (PR #157)

@reillyeon approved this pull request.



> @@ -1112,10 +1112,15 @@ <h3>
           The {{Navigator/getGamepads()}} method steps are:
         </p>
         <ol>
-          <li>If the [=current settings object=]'s [=environment settings
-          object / responsible document=] is not [=allowed to use=] the
-          `"gamepad"` permission, then [=exception/throw=] a
-          {{"SecurityError"}} {{DOMException}} and abort these steps.
+          <li>Let |doc| be the [=current settings object=]'s [=environment
+          settings object / responsible document=].
+          </li>
+          <li>If |doc| is `null` or |doc| is not [=Document/fully active=],
+          then return an empty [=list=].

Right now it seems like Chromium returns null, though that behavior seems accidental. The code probably intended to return a GamepadList with no gamepads populated (which is different from an empty list). I like the approach specified here better.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/157#pullrequestreview-806585100

Received on Monday, 15 November 2021 21:57:27 UTC