Skip to content

xst: clearTimeout crashes #1490

@ChALkeR

Description

@ChALkeR

Build environment: macOS
Moddable SDK version:

~/.jsvu/bin/xs -v
XS 16.8.1, slot 32 bytes, ID 4 bytes

Description
clearTimeout crashes:

  1. on undefined
  2. when called on the timeout id from that timeout callback
    In this case not clearTimeout() crashes, but internal handler -- see example 3

Case 2 is not catchable and crashes the process

Steps to Reproduce

  1. ~/.jsvu/bin/xs -e 'clearTimeout(undefined)'
  2. ~/.jsvu/bin/xs -e 'x=setTimeout(()=>clearTimeout(x), 100)'
  3. ~/.jsvu/bin/xs -e 'x=setTimeout(()=>{clearTimeout(x);print("cleared")}, 100)'

Expected behavior
It should do nothing if there is no timeout to remove

https://www.w3.org/TR/2011/WD-html5-20110525/timers.html#dom-windowtimers-cleartimeout

If handle does not identify an entry in the list of active timeouts of the WindowTimers object on which the method was invoked, the method does nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedissue reported has been reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions