platform/electron/ipc-gate
Classes
Section titled “Classes”IpcGate
Section titled “IpcGate”Defined in: app/src/platform/electron/ipc-gate.ts:44
Decides whether an IPC request is accepted, in this order: the sender is a registered view, the message comes from its top frame with the expected origin, the view has the contract’s capability, the payload matches the schema, and the sender is within the channel’s rate limit. Web content never passes the first check.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new IpcGate(
clock):IpcGate
Defined in: app/src/platform/electron/ipc-gate.ts:50
Parameters
Section titled “Parameters”Time source for rate limiting.
Returns
Section titled “Returns”Methods
Section titled “Methods”check()
Section titled “check()”check<
Req>(contract,sender,payload):Result<Req,IpcRejection>
Defined in: app/src/platform/electron/ipc-gate.ts:90
Checks a request.
Type Parameters
Section titled “Type Parameters”Req
Parameters
Section titled “Parameters”contract
Section titled “contract”RequestContract<Req, unknown>
The channel’s contract.
sender
Section titled “sender”Where the request came from.
payload
Section titled “payload”unknown
The untrusted payload.
Returns
Section titled “Returns”Result<Req, IpcRejection>
The validated request, or the reason for refusing it.
mayReceive()
Section titled “mayReceive()”mayReceive(
viewId,capability):boolean
Defined in: app/src/platform/electron/ipc-gate.ts:79
Tells whether a view may receive events of a capability.
Parameters
Section titled “Parameters”viewId
Section titled “viewId”number
Id of a WebContents.
capability
Section titled “capability”The capability of an event contract.
Returns
Section titled “Returns”boolean
registerView()
Section titled “registerView()”registerView(
viewId,view):Disposable
Defined in: app/src/platform/electron/ipc-gate.ts:60
Registers a view of the browser’s own UI.
Parameters
Section titled “Parameters”viewId
Section titled “viewId”number
Id of its WebContents.
Expected origin and capabilities.
Returns
Section titled “Returns”A disposable that unregisters the view.
Interfaces
Section titled “Interfaces”IpcSender
Section titled “IpcSender”Defined in: app/src/platform/electron/ipc-gate.ts:15
Where an IPC message came from.
Properties
Section titled “Properties”frameUrl
Section titled “frameUrl”
readonlyframeUrl:string
Defined in: app/src/platform/electron/ipc-gate.ts:19
URL of the sending frame.
isMainFrame
Section titled “isMainFrame”
readonlyisMainFrame:boolean
Defined in: app/src/platform/electron/ipc-gate.ts:21
Whether the sending frame is the top frame of its view.
viewId
Section titled “viewId”
readonlyviewId:number
Defined in: app/src/platform/electron/ipc-gate.ts:17
Id of the sending WebContents.
RegisteredView
Section titled “RegisteredView”Defined in: app/src/platform/electron/ipc-gate.ts:8
A view of the browser that may talk to the browser process.
Properties
Section titled “Properties”capabilities
Section titled “capabilities”
readonlycapabilities:ReadonlySet<Capability>
Defined in: app/src/platform/electron/ipc-gate.ts:11
origin
Section titled “origin”
readonlyorigin:string
Defined in: app/src/platform/electron/ipc-gate.ts:10
Origin its top frame must have, such as app://shell.
Type Aliases
Section titled “Type Aliases”IpcRejection
Section titled “IpcRejection”IpcRejection =
"unknown-sender"|"not-main-frame"|"wrong-origin"|"missing-capability"|"invalid-payload"|"rate-limited"
Defined in: app/src/platform/electron/ipc-gate.ts:25
Why a message was refused.
Functions
Section titled “Functions”originOf()
Section titled “originOf()”originOf(
url):string
Defined in: app/src/platform/electron/ipc-gate.ts:140
The origin of a URL for the browser’s own schemes, such as app://shell.
Parameters
Section titled “Parameters”string
A frame URL.
Returns
Section titled “Returns”string