Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GamepadHapticActuator promises issues #200

Open
gterzian opened this issue Apr 12, 2024 · 0 comments · May be fixed by #201
Open

GamepadHapticActuator promises issues #200

gterzian opened this issue Apr 12, 2024 · 0 comments · May be fixed by #201
Assignees
Labels

Comments

@gterzian
Copy link

gterzian commented Apr 12, 2024

There appear to be a couple of issues with the steps of playEffect() and reset() of the GamepadHapticActuator Interface :

playEffect:

  • "completed" promise can be wrong one if called multiple time: a second call will set the promise to null and queue a "preempted" task, but then immediately set the promise to a new one. The "completed" task for the first call would then run and resolve the second promise. Solution: like in reset, check for promise equality.
  • 8.2 checks for promise in parallel steps: unnecessary and reading the internal slot should be done in a task.

reset:

  • step 4.4. resolves a promise right on the parallel steps: it should do this inside a task. Also, it is conditional on step 4, so it appears that calling reset() when there is no running effect will never resolve the returned promise. Perhaps it should be rejected immediately in that case?
  • step 4.3.1 reads slot from parallel step: move it below to inside the task.

Also it's not clear to me how to compute "are still the same" for two promises, so the spec could be explicit about it and add a generational counter internal slot, that would be passed around to parallel steps by cloning it to a variable and back to queued tasks for comparison with the internal slot.

@gterzian gterzian changed the title GamepadHapticActuator promises race conditions GamepadHapticActuator promises issues Apr 12, 2024
@nondebug nondebug linked a pull request Apr 27, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants