WorkerNavigator

WinterCG WorkerNavigator + globalThis.navigator singleton.

Elide implements the WinterCG Minimum Common API’s navigator surface — the WorkerNavigator interface together with its four mixin contracts (NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorConcurrentHardware). A single immutable instance is exposed at globalThis.navigator and satisfies [SameObject] across reads.

Construction

WorkerNavigator is not constructible from JavaScript — both new WorkerNavigator() and plain-call WorkerNavigator() raise TypeError. The singleton is built once per realm during runtime initialisation and bound as a data property on globalThis.

Attributes

All attributes are readonly. Each value is computed once at runtime initialisation and never changes for the life of the realm.

AttributeTypeValue
appCodeNamestring"Mozilla" (spec-mandated constant)
appNamestring"Netscape" (spec-mandated constant)
productstring"Gecko" (spec-mandated constant)
appVersionstring5.0 (<platform> <arch>) Elide/<version>
userAgentstringMozilla/5.0 Elide/<version> (<platform> <arch>)
platformstringOne of linux, darwin, win32, freebsd, openbsd, sunos, derived from os.name; unknown for unrecognised systems
languagestringCanonical BCP-47 form of the JVM default locale (e.g. en-US); falls back to en-US if the JVM reports an empty tag
languagesFrozenArray<string>Frozen one-element array [language]. [SameObject] — identical reference on every read
onLinebooleantrue (HTML spec default for non-browser environments — Elide does not surface live network-state detection)
hardwareConcurrencynumberRuntime.getRuntime().availableProcessors(), never less than 1

The architecture-segment of appVersion and userAgent (x64 / arm64 / ia32) mirrors the mapping used by process.arch, so values stay consistent across the Elide globals.

Notes on the implementation

  • languages is built as a frozen Array (Object.freeze) at navigator-creation time. The array is cached on the instance so every read returns the same reference, in line with the spec’s [SameObject] annotation. Mutation attempts on the array (languages[0] = ..., languages.push(...)) silently fail in sloppy mode and throw TypeError in strict mode.
  • onLine is currently a static true. The HTML spec describes it as “the user agent’s online state” — there is no portable cross-platform mechanism to surface that from a JVM process, and true is the documented default for environments that cannot answer the question.
  • The interface is exposed via globalThis.navigator, and the WorkerNavigator constructor is also installed as a global (globalThis.WorkerNavigator), so it is available for instanceof checks. It is not constructible, however — new WorkerNavigator() throws (see above).