Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ContextMasquerade

Mask object for context masquerade. It is used to artificially restrict the capabilities of context instances. It is intended to simplify cross-browser testing without actually using different browsers.

A mask can be instantiated in four different ways:

  1. by creating the object and explicitly configuring all values as required.
  2. from a preset identifier (all presets are stored in assets/masquerade.json).
  3. from an extension hash
  4. from GET parameters, either 'msqrd_p=' or 'msqrd_h='.

Intended use; when the context's static masquerade is set, all subsequent instances apply that mask:

Context.masquerade = ContextMasquerade.fromHash('288M01-o');

Hierarchy

  • ContextMasquerade

Index

Constructors

constructor

Properties

Protected _backend

_backend: string
see

backend

Protected _extensionsConceal

_extensionsConceal: string[] = ...

Protected _extensionsStrive

_extensionsStrive: string[] = ...

Protected _functionsUndefine

_functionsUndefine: string[] = ...

Static Protected Readonly MASQUERADE_JSON

MASQUERADE_JSON: Preset[] = ...
see

presets

Accessors

backend

  • get backend(): string

extensionsConceal

  • get extensionsConceal(): string[]
  • Extensions that the context should conceal support of. This only affects supported extensions, which will be reported to be not supported.

    Returns string[]

extensionsStrive

  • get extensionsStrive(): string[]
  • Extensions that the context should strive to support. The support can only go as far as the extensions are actually supported.

    Returns string[]

functionsUndefine

  • get functionsUndefine(): string[]
  • Functions that the context should delete during construction. Since WebGL context functions cannot be deleted they are undefined instead.

    Returns string[]

Methods

Static fromGET

  • Tries to generate a mask based on GET parameters: if msqrd_h is present, its value is interpreted as extensions hash and a mask is generated from hash. If no hash was found, presence of msqrd_p is evaluated and if found, a mask is generated from preset identifier.

    Returns undefined | ContextMasquerade

Static fromHash

  • Generates a mask based on an extensions hash (encoding backend and extensions_strive). If extensions are strived for, all extensions that are not explicitly mentioned will be added to the list of concealed extensions.

    Parameters

    • hash: string

      Hash that is to be decoded for backend and extensions data.

    Returns ContextMasquerade

Static fromPreset

  • Creates a context mask based on a preset. Note that the presence of an extensions_hash overrides the backend, extensions_strive, as well as extensions_conceal. Only the functions_undefine will be preserved in that case.

    Parameters

    • identifier: string

      Name of a preset as specified in masquerade.json.

    Returns ContextMasquerade

Static presets