Open Bug 1879215 Opened 1 year ago Updated 1 year ago

`AbortSignal.timeout()` can't be used from chrome code without a window

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

People

(Reporter: lina, Unassigned)

References

(Blocks 1 open bug)

Details

Over in bug 1878420, we'd like to replace some hand-written helpers in the Sync code with AbortSignal.any() and AbortSignal.timeout(). The Sync code is chrome JS, and doesn't have a window.

Unfortunately, it looks like trying to call AbortSignal.timeout() from a context where we don't have a window trips this check, and the method throws AbortSignal.timeout: Could not find window.

Would it be possible to make AbortSignal.timeout() usable in contexts without a window?

Type: task → defect
Type: defect → enhancement

You've done work on AbortSignal Kagami, do you have an opinion?

Flags: needinfo?(krosylight)

AFAICT that part of code briefly copied what the global scope setTimeout does. If there's any other setTimeout infra that works outside window, I don't see why we shouldn't use it there. In that case "what do we use in chrome context currently?" would be the question.

Flags: needinfo?(krosylight)

Hmm, we also have NS_NewTimer(). Maybe we can use that.

You need to log in before you can comment on or make changes to this bug.