Module org.htmlunit

Class AbortSignal

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class AbortSignal extends EventTarget
The JavaScript object AbortSignal.
Author:
Ronald Brill
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, LEGACY_CONST, PERMANENT, READONLY, STRICTLY_READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds an algorithm that is run when this signal is aborted.
    any(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Returns a signal that is aborted when any of the given signals is aborted.
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Creates a signal that is aborted when any of the given signals is aborted (like AbortSignal.any()); used e.g. for the signal of a Request.
    org.htmlunit.corejs.javascript.Function
    Returns the onabort event handler.
    Returns the abort reason (undefined if not aborted).
    boolean
    Returns whether the signal is aborted.
    jsAbort(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Returns a signal that is already aborted.
    void
    JavaScript constructor; like the browsers, an AbortSignal can't be created by script.
    void
    Removes an algorithm added by addAbortAlgorithm(Runnable).
    void
    setOnabort(Object handler)
    Sets the onabort event handler.
    void
    Aborts this signal: sets the reason (an AbortError if undefined), runs the abort algorithms, fires the abort event and aborts the dependent signals.
    void
    Throws the abort reason if the signal is aborted.
    timeout(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Returns a signal that is aborted with a TimeoutError after the given time.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Constructor Details

    • AbortSignal

      public AbortSignal()
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor; like the browsers, an AbortSignal can't be created by script.
      Overrides:
      jsConstructor in class EventTarget
    • isAborted

      public boolean isAborted()
      Returns whether the signal is aborted.
      Returns:
      whether the signal is aborted
    • getReason

      public Object getReason()
      Returns the abort reason (undefined if not aborted).
      Returns:
      the abort reason
    • throwIfAborted

      public void throwIfAborted()
      Throws the abort reason if the signal is aborted.
    • getOnabort

      public org.htmlunit.corejs.javascript.Function getOnabort()
      Returns the onabort event handler.
      Returns:
      the handler
    • setOnabort

      public void setOnabort(Object handler)
      Sets the onabort event handler.
      Parameters:
      handler - the handler
    • jsAbort

      public static AbortSignal jsAbort(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Returns a signal that is already aborted.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - this object
      args - the arguments (the optional reason)
      funObj - the function
      Returns:
      the aborted signal
    • timeout

      public static AbortSignal timeout(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Returns a signal that is aborted with a TimeoutError after the given time.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - this object
      args - the arguments (the time in milliseconds)
      funObj - the function
      Returns:
      the signal
    • any

      public static AbortSignal any(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Returns a signal that is aborted when any of the given signals is aborted.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - this object
      args - the arguments (the signals)
      funObj - the function
      Returns:
      the signal
    • createDependentSignal

      public static AbortSignal createDependentSignal(HtmlUnitScriptable owner, List<AbortSignal> signals)
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Creates a signal that is aborted when any of the given signals is aborted (like AbortSignal.any()); used e.g. for the signal of a Request.
      Parameters:
      owner - the object used for the scope and the prototype of the new signal
      signals - the signals
      Returns:
      the new signal
      See Also:
    • addAbortAlgorithm

      public void addAbortAlgorithm(Runnable algorithm)
      Adds an algorithm that is run when this signal is aborted.
      Parameters:
      algorithm - the algorithm
    • removeAbortAlgorithm

      public void removeAbortAlgorithm(Runnable algorithm)
      Removes an algorithm added by addAbortAlgorithm(Runnable).
      Parameters:
      algorithm - the algorithm
    • signalAbort

      public void signalAbort(Object reason)
      Aborts this signal: sets the reason (an AbortError if undefined), runs the abort algorithms, fires the abort event and aborts the dependent signals.
      Parameters:
      reason - the reason
      See Also: