@fkn/lib/extension
Classes
Section titled “Classes”ExtensionOperationUnsupportedError
Section titled “ExtensionOperationUnsupportedError”Thrown when the extension is current but does not serve the operation being asked for.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ExtensionOperationUnsupportedError(operation, abi): ExtensionOperationUnsupportedError;Parameters
Section titled “Parameters”operation
Section titled “operation”string
number
Returns
Section titled “Returns”ExtensionOperationUnsupportedError
Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”readonly abi: number;readonly name: "ExtensionOperationUnsupportedError" = "ExtensionOperationUnsupportedError";Overrides
Section titled “Overrides”Error.nameoperation
Section titled “operation”readonly operation: string;ExtensionOutdatedError
Section titled “ExtensionOutdatedError”Thrown instead of the generic “not installed” message when the extension IS there and merely too old. Carries both numbers so an app can say which, and link its listing.
A named class rather than a message match: only the name survives a structured-clone hop, and the codebase has been bitten before by an error whose identity was its text.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ExtensionOutdatedError(abi, required): ExtensionOutdatedError;Parameters
Section titled “Parameters”number
required
Section titled “required”number
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”readonly abi: number;readonly name: "ExtensionOutdatedError" = "ExtensionOutdatedError";Overrides
Section titled “Overrides”Error.namerequired
Section titled “required”readonly required: number;Type Aliases
Section titled “Type Aliases”AttachFrameOptions
Section titled “AttachFrameOptions”type AttachFrameOptions = object;Properties
Section titled “Properties”domains?
Section titled “domains?”optional domains?: string[];iframe
Section titled “iframe”iframe: HTMLIFrameElement;lockdown?
Section titled “lockdown?”optional lockdown?: boolean;syncCookies?
Section titled “syncCookies?”optional syncCookies?: boolean;CookieDetails
Section titled “CookieDetails”type CookieDetails = object;Properties
Section titled “Properties”name: string;url: string;Executor
Section titled “Executor”type Executor = object;Properties
Section titled “Properties”execute
Section titled “execute”execute: (parts, operation, args) => Promise<unknown>;Parameters
Section titled “Parameters”operation
Section titled “operation”string
unknown[]
Returns
Section titled “Returns”Promise<unknown>
highlight
Section titled “highlight”highlight: (parts, on) => Promise<void>;Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”Promise<void>
stale?
Section titled “stale?”optional stale?: Promise<void>;ExtensionHandshake
Section titled “ExtensionHandshake”type ExtensionHandshake = | { status: "absent";} | { abi: number; operations: readonly string[] | null; status: "ok";} | { abi: number; operations: readonly string[] | null; required: number; status: "outdated";};Three answers, never a boolean.
operations is null when the extension announced no list, which is NOT the same as announcing an
empty one. A pre-versioning extension supports the whole original surface and simply cannot say so,
so an absent list has to read as “unknown, assume the old set” rather than “supports nothing”.
Reading it the other way would refuse every operation on every currently installed extension.
FetchInit
Section titled “FetchInit”type FetchInit = RequestInit & object;Type Declaration
Section titled “Type Declaration”reason?
Section titled “reason?”optional reason?: string;type Frame = FrameLocator<LocatorModules> & object;Type Declaration
Section titled “Type Declaration”goto()
Section titled “goto()”goto(url, options?): Promise<void>;Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”Promise<void>
url(): string;Returns
Section titled “Returns”string
type Gate = (request, tools) => void | Promise<void>;Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”void | Promise<void>
GateTools
Section titled “GateTools”type GateTools = object;Properties
Section titled “Properties”highlight
Section titled “highlight”highlight: (on) => Promise<void>;Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”Promise<void>
GotoOptions
Section titled “GotoOptions”type GotoOptions = object;Properties
Section titled “Properties”domains?
Section titled “domains?”optional domains?: string[];waitUntil?
Section titled “waitUntil?”optional waitUntil?: "documentstart" | "load";HeaderOperation
Section titled “HeaderOperation”type HeaderOperation = object;Properties
Section titled “Properties”header
Section titled “header”header: string;operation
Section titled “operation”operation: "set" | "remove";value?
Section titled “value?”optional value?: string;OperationRequest
Section titled “OperationRequest”type OperationRequest = object;Properties
Section titled “Properties”args: unknown[];operation
Section titled “operation”operation: string;parts: SelectorPart[];phase: "execute" | "ensure";PermissionGrant
Section titled “PermissionGrant”type PermissionGrant = object;Properties
Section titled “Properties”allow: boolean;key: PermissionScope;scope: string;PermissionRequest
Section titled “PermissionRequest”type PermissionRequest = object;Properties
Section titled “Properties”key: PermissionScope;reason?
Section titled “reason?”optional reason?: string;scope?
Section titled “scope?”optional scope?: string;RemoteVideoElement
Section titled “RemoteVideoElement”type RemoteVideoElement = EventTarget & object;Type Declaration
Section titled “Type Declaration”autoplay
Section titled “autoplay”autoplay: boolean;buffered
Section titled “buffered”readonly buffered: TimeRanges;currentSrc
Section titled “currentSrc”readonly currentSrc: string;currentTime
Section titled “currentTime”currentTime: number;disableRemotePlayback
Section titled “disableRemotePlayback”disableRemotePlayback: boolean;duration
Section titled “duration”readonly duration: number;readonly ended: boolean;readonly error: MediaError | null;HAVE_ENOUGH_DATA
Section titled “HAVE_ENOUGH_DATA”readonly HAVE_ENOUGH_DATA: 4;HAVE_FUTURE_DATA
Section titled “HAVE_FUTURE_DATA”readonly HAVE_FUTURE_DATA: 3;loop: boolean;muted: boolean;paused
Section titled “paused”readonly paused: boolean;playbackRate
Section titled “playbackRate”playbackRate: number;poster
Section titled “poster”poster: string;preload
Section titled “preload”preload: string;readyState
Section titled “readyState”readonly readyState: number;seekable
Section titled “seekable”readonly seekable: TimeRanges;seeking
Section titled “seeking”readonly seeking: boolean;src: string;volume
Section titled “volume”volume: number;exitPictureInPicture()
Section titled “exitPictureInPicture()”exitPictureInPicture(): Promise<void>;Returns
Section titled “Returns”Promise<void>
load()
Section titled “load()”load(): void;Returns
Section titled “Returns”void
pause()
Section titled “pause()”pause(): void;Returns
Section titled “Returns”void
play()
Section titled “play()”play(): Promise<void>;Returns
Section titled “Returns”Promise<void>
requestPictureInPicture()
Section titled “requestPictureInPicture()”requestPictureInPicture(): Promise<void>;Returns
Section titled “Returns”Promise<void>
RequestHeaderRule
Section titled “RequestHeaderRule”type RequestHeaderRule = object;Properties
Section titled “Properties”domains
Section titled “domains”domains: string[];reason?
Section titled “reason?”optional reason?: string;requestHeaders
Section titled “requestHeaders”requestHeaders: HeaderOperation[];SelectorPart
Section titled “SelectorPart”type SelectorPart = object;Properties
Section titled “Properties”args: unknown[];kind: ChainKind;name: string;SiteCookie
Section titled “SiteCookie”type SiteCookie = object;Properties
Section titled “Properties”name: string;value: string;Variables
Section titled “Variables”assertAttachableFrameUrl
Section titled “assertAttachableFrameUrl”const assertAttachableFrameUrl: (raw) => void;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
assertFetchableUrl
Section titled “assertFetchableUrl”const assertFetchableUrl: (raw) => void;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
attachFrame
Section titled “attachFrame”const attachFrame: ({ iframe, domains, syncCookies, lockdown }) => Promise<Frame>;Parameters
Section titled “Parameters”{ iframe, domains, syncCookies, lockdown }
Section titled “{ iframe, domains, syncCookies, lockdown }”Returns
Section titled “Returns”cookies
Section titled “cookies”const cookies: object;Type Declaration
Section titled “Type Declaration”get: (details) => Promise<SiteCookie | null>;Parameters
Section titled “Parameters”details
Section titled “details”Returns
Section titled “Returns”Promise<SiteCookie | null>
events
Section titled “events”const events: TypedEventTarget;EXTENSION_ABI
Section titled “EXTENSION_ABI”const EXTENSION_ABI: 1 = 1;What the extension half announces about itself. Increment when the callable surface CHANGES in a way a page could notice: an operation added, removed, renamed, or given different semantics.
This is not the package version and not the manifest version. Those move for reasons that have nothing to do with the protocol (a dependency bump, a store resubmission), and tying the contract to them would make every release look like a protocol change.
const fetch: (input, init?) => Promise<Response>;Parameters
Section titled “Parameters”RequestInfo | URL
Returns
Section titled “Returns”Promise<Response>
FORGEABLE_HEADERS
Section titled “FORGEABLE_HEADERS”const FORGEABLE_HEADERS: string[];isExtensionExposed
Section titled “isExtensionExposed”const isExtensionExposed: () => boolean;Unchanged on purpose, and still exported: a page half built before versioning calls exactly this, and an extension that announces an ABI must keep answering it the same way. Backwards compatibility here runs in BOTH directions, which is the only property that matters when neither end updates on demand.
Returns
Section titled “Returns”boolean
isLocalNetworkUrl
Section titled “isLocalNetworkUrl”const isLocalNetworkUrl: (raw) => boolean;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
isLocatorDenied
Section titled “isLocatorDenied”const isLocatorDenied: (error) => boolean;Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
isLocatorUnsupported
Section titled “isLocatorUnsupported”const isLocatorUnsupported: (error) => boolean;Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
isTerminalError
Section titled “isTerminalError”const isTerminalError: (error) => boolean;Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
LOCATOR_DENIED
Section titled “LOCATOR_DENIED”const LOCATOR_DENIED: "LocatorDeniedError" = "LocatorDeniedError";LOCATOR_ERROR
Section titled “LOCATOR_ERROR”const LOCATOR_ERROR: "LocatorError" = "LocatorError";LOCATOR_UNSUPPORTED
Section titled “LOCATOR_UNSUPPORTED”const LOCATOR_UNSUPPORTED: "LocatorUnsupportedError" = "LocatorUnsupportedError";permissions
Section titled “permissions”const permissions: object;Type Declaration
Section titled “Type Declaration”request
Section titled “request”request: (requests) => Promise<PermissionGrant[]>;Parameters
Section titled “Parameters”requests
Section titled “requests”Returns
Section titled “Returns”readExtensionHandshake
Section titled “readExtensionHandshake”const readExtensionHandshake: () => ExtensionHandshake;The three-way answer: absent, present but too old, or usable.
Returns
Section titled “Returns”removeRequestHeaderRule
Section titled “removeRequestHeaderRule”const removeRequestHeaderRule: (ruleId) => Promise<void>;Parameters
Section titled “Parameters”ruleId
Section titled “ruleId”number
Returns
Section titled “Returns”Promise<void>
REQUIRED_EXTENSION_ABI
Section titled “REQUIRED_EXTENSION_ABI”const REQUIRED_EXTENSION_ABI: 0 = 0;The oldest extension the page half will talk to. Raise it ONLY when the page half starts depending
on something older extensions cannot do, never merely because EXTENSION_ABI moved: an added
operation does not break a page that does not call it.
Deliberately 0 for this release. Every extension currently installed predates versioning and announces no ABI at all, so a floor of 1 would refuse all of them the moment this page half deployed, which is precisely the failure this file exists to prevent.
setMissingExtensionHandler
Section titled “setMissingExtensionHandler”const setMissingExtensionHandler: (handler) => void;Parameters
Section titled “Parameters”handler
Section titled “handler”MissingExtensionHandler | null
Returns
Section titled “Returns”void
setRequestHeaderRule
Section titled “setRequestHeaderRule”const setRequestHeaderRule: (rule) => Promise<{ ruleId: number;}>;Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{
ruleId: number;
}>
supportsOperation
Section titled “supportsOperation”const supportsOperation: (handshake, operation) => boolean;Whether a named operation is callable.
null operations means the extension could not tell us, and the answer is YES: it predates the
ops list and supports the original surface. The ABI floor is the mechanism for refusing an
extension that is genuinely too old; this one only refines a list that was actually announced.
Parameters
Section titled “Parameters”handshake
Section titled “handshake”operation
Section titled “operation”string
Returns
Section titled “Returns”boolean
waitForExtensionExposure
Section titled “waitForExtensionExposure”const waitForExtensionExposure: (timeout?) => Promise<void>;Parameters
Section titled “Parameters”timeout?
Section titled “timeout?”number
Returns
Section titled “Returns”Promise<void>
Functions
Section titled “Functions”available()
Section titled “available()”function available(): boolean;Returns
Section titled “Returns”boolean
promptInstall()
Section titled “promptInstall()”function promptInstall(reason?): Promise<boolean>;Parameters
Section titled “Parameters”reason?
Section titled “reason?”string
Returns
Section titled “Returns”Promise<boolean>
References
Section titled “References”extension
Section titled “extension”Renames and re-exports events