Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/common/get-electron-binding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const getElectronBinding: typeof process.electronBinding = process.electronBinding
? (name: string) => process.electronBinding(name as any)
: (name: string) => (process as any)._linkedBinding('electron_common_' + name)
3 changes: 2 additions & 1 deletion src/main/objects-registry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { WebContents } from 'electron'
import { getElectronBinding } from '../common/get-electron-binding'

const v8Util = process.electronBinding('v8_util')
const v8Util = getElectronBinding('v8_util')

const getOwnerKey = (webContents: WebContents, contextId: string) => {
return `${webContents.id}-${contextId}`
Expand Down
5 changes: 3 additions & 2 deletions src/main/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { isPromise, isSerializableObject, deserialize, serialize } from '../comm
import type { MetaTypeFromRenderer, ObjectMember, MetaType, ObjProtoDescriptor } from '../common/types'
import { ipcMain, WebContents, IpcMainEvent, app } from 'electron'
import { IPC_MESSAGES } from '../common/ipc-messages';
import { getElectronBinding } from '../common/get-electron-binding'

const v8Util = process.electronBinding('v8_util')
const { NativeImage } = process.electronBinding('native_image')
const v8Util = getElectronBinding('v8_util')
const { NativeImage } = getElectronBinding('native_image')

// The internal properties of Function.
const FUNCTION_PROPERTIES = [
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/callbacks-registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const v8Util = process.electronBinding('v8_util')
import { getElectronBinding } from '../common/get-electron-binding'
const v8Util = getElectronBinding('v8_util')

export class CallbacksRegistry {
private nextId: number = 0
Expand Down
1 change: 1 addition & 0 deletions src/renderer/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isPromise, isSerializableObject, serialize, deserialize } from '../comm
import { MetaTypeFromRenderer, ObjectMember, ObjProtoDescriptor, MetaType } from '../common/types'
import { BrowserWindow, WebContents, ipcRenderer } from 'electron'
import { browserModules } from '../common/module-names'
import { getElectronBinding } from '../common/get-electron-binding'
import { IPC_MESSAGES } from '../common/ipc-messages';

const v8Util = process.electronBinding('v8_util')
Expand Down