@lvce-editor/shared-process 0.26.0 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/parts/ConnectIpcToElectron/ConnectIpcToElectron.js +9 -0
- package/src/parts/EmbedsProcess/EmbedsProcess.js +0 -9
- package/src/parts/EmbedsProcessPath/EmbedsProcessPath.js +1 -1
- package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +10 -21
- package/src/parts/HandleIncomingIpc/HandleIncomingIpc.js +44 -0
- package/src/parts/HandleIpc/HandleIpc.js +22 -1
- package/src/parts/HandleIpcEmbedsProcess/HandleIpcEmbedsProcess.js +12 -0
- package/src/parts/HandleIpcExtensionHostHelperProcess/HandleIpcExtensionHostHelperProcess.js +30 -0
- package/src/parts/HandleIpcModule/HandleIpcModule.js +27 -0
- package/src/parts/HandleIpcProcessExplorer/HandleIpcProcessExplorer.js +14 -0
- package/src/parts/HandleIpcSearchProcess/HandleIpcSearchProcess.js +1 -0
- package/src/parts/HandleIpcSharedProcess/HandleIpcSharedProcess.js +41 -0
- package/src/parts/HandleIpcTerminalProcess/HandleIpcTerminalProcess.js +24 -0
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.js +6 -7
- package/src/parts/HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.js +5 -5
- package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.js +4 -7
- package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js +4 -8
- package/src/parts/HandleWebSocketForExtensionHostHelperProcess/HandleWebSocketForExtensionHostHelperProcess.js +4 -8
- package/src/parts/HandleWebSocketForSharedProcess/HandleWebSocketForSharedProcess.js +4 -15
- package/src/parts/HandleWebSocketForTerminalProcess/HandleWebSocketForTerminalProcess.js +4 -17
- package/src/parts/IpcId/IpcId.js +8 -0
- package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +17 -3
- package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +6 -9
- package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +4 -7
- package/src/parts/LaunchPtyHost/LaunchPtyHost.js +10 -9
- package/src/parts/Module/Module.js +0 -14
- package/src/parts/ModuleId/ModuleId.js +0 -7
- package/src/parts/ModuleMap/ModuleMap.js +1 -51
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/SendIncomingIpc/SendIncomingIpc.js +46 -0
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.ipc.js +1 -1
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +12 -18
- package/src/parts/ElectronBrowserView/ElectronBrowserView.ipc.js +0 -6
- package/src/parts/ElectronBrowserView/ElectronBrowserView.js +0 -21
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.js +0 -35
- package/src/parts/ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js +0 -15
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js +0 -6
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.js +0 -7
- package/src/parts/ElectronBrowserViewState/ElectronBrowserViewState.js +0 -12
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js +0 -7
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.js +0 -10
- package/src/parts/ElectronWebContents/ElectronWebContents.ipc.js +0 -12
- package/src/parts/ElectronWebContents/ElectronWebContents.js +0 -61
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.ipc.js +0 -6
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.js +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.26.
|
|
22
|
-
"@lvce-editor/ipc": "^
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.26.2",
|
|
22
|
+
"@lvce-editor/ipc": "^7.2.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^1.3.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.2.0",
|
|
25
25
|
"@lvce-editor/pretty-error": "^1.5.0",
|
|
26
|
-
"@lvce-editor/pty-host": "0.26.
|
|
26
|
+
"@lvce-editor/pty-host": "0.26.2",
|
|
27
27
|
"@lvce-editor/verror": "^1.2.0",
|
|
28
28
|
"@lvce-editor/web-socket-server": "^1.1.0",
|
|
29
29
|
"debug": "^4.3.4",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
4
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
5
|
+
export const connectIpcToElectron = async (ipc) => {
|
|
6
|
+
const { port1, port2 } = await GetPortTuple.getPortTuple();
|
|
7
|
+
await JsonRpc.invokeAndTransfer(ipc, [port1], 'HandleElectronMessagePort.handleElectronMessagePort', IpcId.MainProcess);
|
|
8
|
+
await ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', [port2]);
|
|
9
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
2
1
|
import * as LaunchEmbedsProcess from '../LaunchEmbedsProcess/LaunchEmbedsProcess.js';
|
|
3
2
|
export const state = {
|
|
4
3
|
/**
|
|
@@ -12,11 +11,3 @@ export const getOrCreate = async () => {
|
|
|
12
11
|
}
|
|
13
12
|
return state.ipc;
|
|
14
13
|
};
|
|
15
|
-
export const invoke = async (method, ...params) => {
|
|
16
|
-
const ipc = await getOrCreate();
|
|
17
|
-
return JsonRpc.invoke(ipc, method, ...params);
|
|
18
|
-
};
|
|
19
|
-
export const invokeAndTransfer = async (method, transfer, ...params) => {
|
|
20
|
-
const ipc = await getOrCreate();
|
|
21
|
-
return JsonRpc.invokeAndTransfer(ipc, transfer, method, ...params);
|
|
22
|
-
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as Path from '../Path/Path.js';
|
|
2
2
|
import * as Root from '../Root/Root.js';
|
|
3
|
-
export const embedsProcessPath = Path.join(Root.root, 'packages', 'embeds-process', '
|
|
3
|
+
export const embedsProcessPath = Path.join(Root.root, 'packages', 'embeds-process', 'dist', 'embedsProcessMain.js');
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
messagePort,
|
|
12
|
-
});
|
|
13
|
-
HandleIpc.handleIpc(ipc);
|
|
14
|
-
if (params[0] === mainProcessSpecialId) {
|
|
15
|
-
// update ipc with message port ipc that supports transferring objects
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
ParentIpc.state.ipc = ipc;
|
|
18
|
-
}
|
|
19
|
-
// TODO find better way to associate configuration with ipc
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
ipc.windowId = params[1];
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleElectronMessagePort = (messagePort, ...params) => {
|
|
4
|
+
const ipcId = params[0];
|
|
5
|
+
const windowId = params[1];
|
|
6
|
+
const message = {
|
|
7
|
+
ipcId,
|
|
8
|
+
windowId,
|
|
9
|
+
};
|
|
10
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.SharedProcess, messagePort, message);
|
|
22
11
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Assert from '../Assert/Assert.js';
|
|
2
|
+
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
3
|
+
import * as HandleIpcModule from '../HandleIpcModule/HandleIpcModule.js';
|
|
4
|
+
import * as IsMessagePortMain from '../IsMessagePortMain/IsMessagePortMain.js';
|
|
5
|
+
import * as SendIncomingIpc from '../SendIncomingIpc/SendIncomingIpc.js';
|
|
6
|
+
const handleIncomingIpcMessagePort = async (module, handle, message) => {
|
|
7
|
+
const target = await module.targetMessagePort(handle, message);
|
|
8
|
+
const response = module.upgradeMessagePort(handle, message);
|
|
9
|
+
return {
|
|
10
|
+
target,
|
|
11
|
+
response,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const handleIncomingIpcWebSocket = async (module, handle, message) => {
|
|
15
|
+
const target = await module.targetWebSocket(handle, message);
|
|
16
|
+
const response = module.upgradeWebSocket(handle, message);
|
|
17
|
+
return {
|
|
18
|
+
target,
|
|
19
|
+
response,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getIpcAndResponse = (module, handle, message) => {
|
|
23
|
+
if (IsMessagePortMain.isMessagePortMain(handle)) {
|
|
24
|
+
return handleIncomingIpcMessagePort(module, handle, message);
|
|
25
|
+
}
|
|
26
|
+
return handleIncomingIpcWebSocket(module, handle, message);
|
|
27
|
+
};
|
|
28
|
+
const applyResponse = async (target, response, ipcId) => {
|
|
29
|
+
switch (response.type) {
|
|
30
|
+
case 'handle':
|
|
31
|
+
HandleIpc.handleIpc(target);
|
|
32
|
+
break;
|
|
33
|
+
case 'send':
|
|
34
|
+
return SendIncomingIpc.sendIncomingIpc(target, response, ipcId);
|
|
35
|
+
default:
|
|
36
|
+
throw new Error('unexpected response');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const handleIncomingIpc = async (ipcId, handle, message) => {
|
|
40
|
+
Assert.number(ipcId);
|
|
41
|
+
const module = HandleIpcModule.getModule(ipcId);
|
|
42
|
+
const { target, response } = await getIpcAndResponse(module, handle, message);
|
|
43
|
+
await applyResponse(target, response, ipcId);
|
|
44
|
+
};
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import * as HandleMessage from '../HandleMessage/HandleMessage.js';
|
|
2
|
+
const handled = new WeakSet();
|
|
2
3
|
export const handleIpc = (ipc) => {
|
|
3
|
-
|
|
4
|
+
if (handled.has(ipc)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
handled.add(ipc);
|
|
8
|
+
if ('addEventListener' in ipc) {
|
|
9
|
+
ipc.addEventListener('message', HandleMessage.handleMessage);
|
|
10
|
+
}
|
|
11
|
+
else if ('on' in ipc) {
|
|
12
|
+
// deprecated
|
|
13
|
+
ipc.on('message', HandleMessage.handleMessage);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const unhandleIpc = (ipc) => {
|
|
17
|
+
handled.delete(ipc);
|
|
18
|
+
if ('removeEventListener' in ipc) {
|
|
19
|
+
ipc.removeEventListener('message', HandleMessage.handleMessage);
|
|
20
|
+
}
|
|
21
|
+
else if ('off' in ipc) {
|
|
22
|
+
// deprecated
|
|
23
|
+
ipc.off('message', HandleMessage.handleMessage);
|
|
24
|
+
}
|
|
4
25
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as EmbedsProcess from '../EmbedsProcess/EmbedsProcess.js';
|
|
2
|
+
export const targetMessagePort = () => {
|
|
3
|
+
return EmbedsProcess.getOrCreate();
|
|
4
|
+
};
|
|
5
|
+
export const upgradeMessagePort = (port, message) => {
|
|
6
|
+
return {
|
|
7
|
+
type: 'send',
|
|
8
|
+
method: 'HandleElectronMessagePort.handleElectronMessagePort',
|
|
9
|
+
params: [message.ipcId],
|
|
10
|
+
transfer: [port],
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as ExtensionHostHelperProcessIpc from '../ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js';
|
|
2
|
+
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
3
|
+
export const targetWebSocket = async () => {
|
|
4
|
+
const ipc = await ExtensionHostHelperProcessIpc.create({
|
|
5
|
+
method: IpcParentType.NodeForkedProcess,
|
|
6
|
+
});
|
|
7
|
+
return ipc;
|
|
8
|
+
};
|
|
9
|
+
export const upgradeWebSocket = (handle, message) => {
|
|
10
|
+
return {
|
|
11
|
+
type: 'send',
|
|
12
|
+
method: 'HandleWebSocket.handleWebSocket',
|
|
13
|
+
params: [message],
|
|
14
|
+
transfer: handle,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export const targetMessagePort = async () => {
|
|
18
|
+
const ipc = await ExtensionHostHelperProcessIpc.create({
|
|
19
|
+
method: IpcParentType.ElectronUtilityProcess,
|
|
20
|
+
});
|
|
21
|
+
return ipc;
|
|
22
|
+
};
|
|
23
|
+
export const upgradeMessagePort = (port) => {
|
|
24
|
+
return {
|
|
25
|
+
type: 'send',
|
|
26
|
+
method: 'HandleElectronMessagePort.handleElectronMessagePort',
|
|
27
|
+
params: [],
|
|
28
|
+
transfer: [port],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Assert from '../Assert/Assert.js';
|
|
2
|
+
import * as HandleIpcEmbedsProcess from '../HandleIpcEmbedsProcess/HandleIpcEmbedsProcess.js';
|
|
3
|
+
import * as HandleIpcExtensionHostHelperProcess from '../HandleIpcExtensionHostHelperProcess/HandleIpcExtensionHostHelperProcess.js';
|
|
4
|
+
import * as HandleIpcProcessExplorer from '../HandleIpcProcessExplorer/HandleIpcProcessExplorer.js';
|
|
5
|
+
import * as HandleIpcSearchProcess from '../HandleIpcSearchProcess/HandleIpcSearchProcess.js';
|
|
6
|
+
import * as HandleIpcSharedProcess from '../HandleIpcSharedProcess/HandleIpcSharedProcess.js';
|
|
7
|
+
import * as HandleIpcTerminalProcess from '../HandleIpcTerminalProcess/HandleIpcTerminalProcess.js';
|
|
8
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
9
|
+
export const getModule = (ipcId) => {
|
|
10
|
+
Assert.number(ipcId);
|
|
11
|
+
switch (ipcId) {
|
|
12
|
+
case IpcId.SharedProcess:
|
|
13
|
+
return HandleIpcSharedProcess;
|
|
14
|
+
case IpcId.EmbedsProcess:
|
|
15
|
+
return HandleIpcEmbedsProcess;
|
|
16
|
+
case IpcId.TerminalProcess:
|
|
17
|
+
return HandleIpcTerminalProcess;
|
|
18
|
+
case IpcId.ExtensionHostHelperProcess:
|
|
19
|
+
return HandleIpcExtensionHostHelperProcess;
|
|
20
|
+
case IpcId.ProcessExplorer:
|
|
21
|
+
return HandleIpcProcessExplorer;
|
|
22
|
+
case IpcId.SearchProcess:
|
|
23
|
+
return HandleIpcSearchProcess;
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`unexpected incoming ipc`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as ProcessExplorer from '../ProcessExplorer/ProcessExplorer.js';
|
|
2
|
+
import * as Assert from '../Assert/Assert.js';
|
|
3
|
+
export const targetMessagePort = () => {
|
|
4
|
+
return ProcessExplorer.getOrCreate();
|
|
5
|
+
};
|
|
6
|
+
export const upgradeMessagePort = (port) => {
|
|
7
|
+
Assert.object(port);
|
|
8
|
+
return {
|
|
9
|
+
type: 'send',
|
|
10
|
+
method: 'HandleElectronMessagePort.handleElectronMessagePort',
|
|
11
|
+
params: [],
|
|
12
|
+
transfer: [port],
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Assert from '../Assert/Assert.js';
|
|
2
|
+
import * as HandleSocketError from '../HandleSocketError/HandleSocketError.js';
|
|
3
|
+
import * as IpcChild from '../IpcChild/IpcChild.js';
|
|
4
|
+
import * as IpcChildType from '../IpcChildType/IpcChildType.js';
|
|
5
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
6
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
7
|
+
export const targetWebSocket = async (handle, message) => {
|
|
8
|
+
handle.on('error', HandleSocketError.handleSocketError);
|
|
9
|
+
const ipc = await IpcChild.listen({
|
|
10
|
+
method: IpcChildType.WebSocket,
|
|
11
|
+
request: message,
|
|
12
|
+
handle,
|
|
13
|
+
});
|
|
14
|
+
return ipc;
|
|
15
|
+
};
|
|
16
|
+
export const upgradeWebSocket = () => {
|
|
17
|
+
return {
|
|
18
|
+
type: 'handle',
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const targetMessagePort = async (messagePort, message) => {
|
|
22
|
+
Assert.object(messagePort);
|
|
23
|
+
const ipc = await IpcChild.listen({
|
|
24
|
+
method: IpcChildType.ElectronMessagePort,
|
|
25
|
+
messagePort,
|
|
26
|
+
});
|
|
27
|
+
if (message.ipcId === IpcId.MainProcess) {
|
|
28
|
+
// update ipc with message port ipc that supports transferring objects
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
ParentIpc.state.ipc = ipc;
|
|
31
|
+
}
|
|
32
|
+
// TODO find better way to associate configuration with ipc
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
ipc.windowId = message.windowId;
|
|
35
|
+
return ipc;
|
|
36
|
+
};
|
|
37
|
+
export const upgradeMessagePort = () => {
|
|
38
|
+
return {
|
|
39
|
+
type: 'handle',
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as PtyHost from '../PtyHost/PtyHost.js';
|
|
2
|
+
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
3
|
+
export const targetWebSocket = () => {
|
|
4
|
+
return PtyHost.getOrCreate(IpcParentType.NodeForkedProcess);
|
|
5
|
+
};
|
|
6
|
+
export const upgradeWebSocket = (handle, message) => {
|
|
7
|
+
return {
|
|
8
|
+
type: 'send',
|
|
9
|
+
method: 'HandleWebSocket.handleWebSocket',
|
|
10
|
+
params: [message],
|
|
11
|
+
transfer: handle,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const targetMessagePort = () => {
|
|
15
|
+
return PtyHost.getOrCreate(IpcParentType.ElectronUtilityProcess);
|
|
16
|
+
};
|
|
17
|
+
export const upgradeMessagePort = (port) => {
|
|
18
|
+
return {
|
|
19
|
+
type: 'send',
|
|
20
|
+
method: 'HandleElectronMessagePort.handleElectronMessagePort',
|
|
21
|
+
params: [],
|
|
22
|
+
transfer: [port],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
await JsonRpc.invokeAndTransfer(embedsProcess, [port], 'HandleElectronMessagePort.handleElectronMessagePort');
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleMessagePortForEmbedsProcess = (port, ipcId) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.EmbedsProcess, port, {
|
|
5
|
+
ipcId,
|
|
6
|
+
});
|
|
8
7
|
};
|
|
@@ -15,9 +15,9 @@ export const handleMessagePortForExtensionHostHelperProcess = async (rendererWor
|
|
|
15
15
|
});
|
|
16
16
|
HandleIpc.handleIpc(ipc);
|
|
17
17
|
await JsonRpc.invokeAndTransfer(ipc, [port], 'HandleElectronMessagePort.handleElectronMessagePort');
|
|
18
|
-
const cleanup = () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
rendererWorkerIpc.on('close', cleanup)
|
|
18
|
+
// const cleanup = () => {
|
|
19
|
+
// ipc.dispose()
|
|
20
|
+
// rendererWorkerIpc.off('close', cleanup)
|
|
21
|
+
// }
|
|
22
|
+
// rendererWorkerIpc.on('close', cleanup)
|
|
23
23
|
};
|
package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Assert.object(port);
|
|
6
|
-
const ipc = await ProcessExplorer.getOrCreate();
|
|
7
|
-
await JsonRpc.invokeAndTransfer(ipc, [port], 'HandleElectronMessagePort.handleElectronMessagePort');
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleMessagePortForProcessExplorer = (port) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.ProcessExplorer, port, {});
|
|
8
5
|
};
|
package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const handleMessagePortForTerminalProcess = async (port) => {
|
|
6
|
-
Assert.object(port);
|
|
7
|
-
const ptyHost = await PtyHost.getOrCreate(IpcParentType.ElectronUtilityProcess);
|
|
8
|
-
await JsonRpc.invokeAndTransfer(ptyHost, [port], 'HandleElectronMessagePort.handleElectronMessagePort');
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleMessagePortForTerminalProcess = (port) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.TerminalProcess, port, {});
|
|
9
5
|
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const ipc = await ExtensionHostHelperProcessIpc.create({
|
|
6
|
-
method: IpcParentType.NodeForkedProcess,
|
|
7
|
-
});
|
|
8
|
-
await JsonRpc.invokeAndTransfer(ipc, handle, 'HandleWebSocket.handleWebSocket', message);
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleWebSocket = (message, handle) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.ExtensionHostHelperProcess, handle, message);
|
|
9
5
|
};
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import * as IpcChildType from '../IpcChildType/IpcChildType.js';
|
|
6
|
-
export const handleWebSocket = async (request, handle) => {
|
|
7
|
-
Assert.object(request);
|
|
8
|
-
Assert.object(handle);
|
|
9
|
-
handle.on('error', HandleSocketError.handleSocketError);
|
|
10
|
-
const ipc = await IpcChild.listen({
|
|
11
|
-
method: IpcChildType.WebSocket,
|
|
12
|
-
request,
|
|
13
|
-
handle,
|
|
14
|
-
});
|
|
15
|
-
HandleIpc.handleIpc(ipc);
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleWebSocket = (request, handle) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.SharedProcess, handle, request);
|
|
16
5
|
};
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
jsonrpc: '2.0',
|
|
6
|
-
method: 'HandleWebSocket.handleWebSocket',
|
|
7
|
-
params: [message],
|
|
8
|
-
}, handle);
|
|
9
|
-
// console.log({ instance })
|
|
10
|
-
// const ipc = await PtyHost.getOrCreate()
|
|
11
|
-
// console.info('[sharedprocess] creating extension ipc')
|
|
12
|
-
// const rpc = await ExtensionHostRpc.create(ipc, handle)
|
|
13
|
-
// console.info('[sharedprocess] created extension host rpc')
|
|
14
|
-
// ipc._process.send(message, handle)
|
|
15
|
-
// rpc.send(message)
|
|
16
|
-
// console.log('spawned extension host')
|
|
17
|
-
// console.log(rpc)
|
|
1
|
+
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
export const handleWebSocket = (message, handle) => {
|
|
4
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.TerminalProcess, handle, message);
|
|
18
5
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SharedProcess = 1;
|
|
2
|
+
export const MainProcess = -5;
|
|
3
|
+
export const EmbedsProcess = 2;
|
|
4
|
+
export const TerminalProcess = 7;
|
|
5
|
+
export const ExtensionHostHelperProcess = 3;
|
|
6
|
+
export const ProcessExplorer = 11;
|
|
7
|
+
export const SearchProcess = 13;
|
|
8
|
+
export const Unknown = 0;
|
package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js
CHANGED
|
@@ -22,6 +22,7 @@ export const signal = (port) => {
|
|
|
22
22
|
export const wrap = (port) => {
|
|
23
23
|
return {
|
|
24
24
|
port,
|
|
25
|
+
wrappedListener: undefined,
|
|
25
26
|
send(message) {
|
|
26
27
|
this.port.postMessage(message);
|
|
27
28
|
},
|
|
@@ -34,20 +35,33 @@ export const wrap = (port) => {
|
|
|
34
35
|
this.port.on(event, listener);
|
|
35
36
|
break;
|
|
36
37
|
case 'message':
|
|
37
|
-
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
this.wrappedListener = (event) => {
|
|
38
40
|
const syntheticEvent = {
|
|
39
41
|
data: event.data,
|
|
40
42
|
target: this,
|
|
41
43
|
};
|
|
42
44
|
listener(syntheticEvent);
|
|
43
45
|
};
|
|
44
|
-
this.port.on(event,
|
|
46
|
+
this.port.on(event, this.wrappedListener);
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
off(event, listener) {
|
|
53
|
+
switch (event) {
|
|
54
|
+
case 'close':
|
|
55
|
+
this.port.off(event, listener);
|
|
56
|
+
break;
|
|
57
|
+
case 'message':
|
|
58
|
+
this.port.off(event, this.wrappedListener);
|
|
59
|
+
this.wrappedListener = undefined;
|
|
45
60
|
break;
|
|
46
61
|
default:
|
|
47
62
|
break;
|
|
48
63
|
}
|
|
49
64
|
},
|
|
50
|
-
off(event, listener) { },
|
|
51
65
|
dispose() {
|
|
52
66
|
this.port.close();
|
|
53
67
|
ParentIpc.invoke('TemporaryMessagePort.dispose', this.port.name);
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
import * as ConnectIpcToElectron from '../ConnectIpcToElectron/ConnectIpcToElectron.js';
|
|
1
2
|
import * as EmbedsProcessPath from '../EmbedsProcessPath/EmbedsProcessPath.js';
|
|
2
|
-
import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
|
|
3
3
|
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
4
4
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
5
5
|
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
6
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
7
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
8
6
|
export const launchEmbedsProcess = async () => {
|
|
9
|
-
const
|
|
7
|
+
const ipc = await IpcParent.create({
|
|
10
8
|
method: IpcParentType.ElectronUtilityProcess,
|
|
11
9
|
path: EmbedsProcessPath.embedsProcessPath,
|
|
12
10
|
argv: [],
|
|
13
11
|
stdio: 'inherit',
|
|
14
12
|
name: 'Embeds Process',
|
|
15
13
|
});
|
|
16
|
-
HandleIpc.handleIpc(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return embedsProcess;
|
|
14
|
+
HandleIpc.handleIpc(ipc);
|
|
15
|
+
await ConnectIpcToElectron.connectIpcToElectron(ipc);
|
|
16
|
+
HandleIpc.unhandleIpc(ipc);
|
|
17
|
+
return ipc;
|
|
21
18
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ConnectIpcToElectron from '../ConnectIpcToElectron/ConnectIpcToElectron.js';
|
|
2
2
|
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
3
3
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
4
4
|
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
5
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
6
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
7
5
|
import * as ProcessExplorerPath from '../ProcessExplorerPath/ProcessExplorerPath.js';
|
|
8
6
|
export const launchProcessExplorer = async () => {
|
|
9
7
|
const ipc = await IpcParent.create({
|
|
@@ -11,11 +9,10 @@ export const launchProcessExplorer = async () => {
|
|
|
11
9
|
path: ProcessExplorerPath.processExplorerPath,
|
|
12
10
|
argv: [],
|
|
13
11
|
stdio: 'inherit',
|
|
14
|
-
name: 'Process
|
|
12
|
+
name: 'Process Explorer',
|
|
15
13
|
});
|
|
16
14
|
HandleIpc.handleIpc(ipc);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', [port2]);
|
|
15
|
+
await ConnectIpcToElectron.connectIpcToElectron(ipc);
|
|
16
|
+
HandleIpc.unhandleIpc(ipc);
|
|
20
17
|
return ipc;
|
|
21
18
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import exitHook from 'exit-hook';
|
|
2
2
|
import * as Debug from '../Debug/Debug.js';
|
|
3
|
-
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
4
3
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
5
4
|
import * as PtyHostPath from '../PtyHostPath/PtyHostPath.js';
|
|
6
5
|
import * as PtyHostState from '../PtyHostState/PtyHostState.js';
|
|
@@ -24,14 +23,16 @@ export const launchPtyHost = async (method) => {
|
|
|
24
23
|
stdio: 'inherit',
|
|
25
24
|
name: 'Terminal Process',
|
|
26
25
|
});
|
|
27
|
-
HandleIpc.handleIpc(ptyHost)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
// HandleIpc.handleIpc(ptyHost)
|
|
27
|
+
// TODO
|
|
28
|
+
// const handleClose = () => {
|
|
29
|
+
// // @ts-ignore
|
|
30
|
+
// ptyHost._rawIpc.off('close', handleClose)
|
|
31
|
+
// PtyHostState.state.ipc = undefined
|
|
32
|
+
// PtyHostState.state.ptyHostPromise = undefined
|
|
33
|
+
// }
|
|
34
|
+
// // @ts-ignore
|
|
35
|
+
// ptyHost._rawIpc.on('close', handleClose)
|
|
35
36
|
PtyHostState.state.ipc = ptyHost;
|
|
36
37
|
return ptyHost;
|
|
37
38
|
};
|
|
@@ -5,8 +5,6 @@ export const load = (moduleId) => {
|
|
|
5
5
|
return import('../AttachDebugger/AttachDebugger.ipc.js');
|
|
6
6
|
case ModuleId.AutoUpdater:
|
|
7
7
|
return import('../AutoUpdater/AutoUpdater.ipc.js');
|
|
8
|
-
case ModuleId.ElectronBrowserViewFunctions:
|
|
9
|
-
return import('../ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js');
|
|
10
8
|
case ModuleId.AutoUpdaterAppImage:
|
|
11
9
|
return import('../AutoUpdaterAppImage/AutoUpdaterAppImage.ipc.js');
|
|
12
10
|
case ModuleId.GetWindowId:
|
|
@@ -27,8 +25,6 @@ export const load = (moduleId) => {
|
|
|
27
25
|
return import('../Download/Download.ipc.js');
|
|
28
26
|
case ModuleId.ElectronApplicationMenu:
|
|
29
27
|
return import('../ElectronApplicationMenu/ElectronApplicationMenu.ipc.js');
|
|
30
|
-
case ModuleId.ElectronBrowserView:
|
|
31
|
-
return import('../ElectronBrowserView/ElectronBrowserView.ipc.js');
|
|
32
28
|
case ModuleId.ElectronContentTracing:
|
|
33
29
|
return import('../ElectronContentTracing/ElectronContentTracing.ipc.js');
|
|
34
30
|
case ModuleId.ElectronDeveloper:
|
|
@@ -47,8 +43,6 @@ export const load = (moduleId) => {
|
|
|
47
43
|
return import('../ElectronSafeStorage/ElectronSafeStorage.ipc.js');
|
|
48
44
|
case ModuleId.Window:
|
|
49
45
|
return import('../ElectronWindow/ElectronWindow.ipc.js');
|
|
50
|
-
case ModuleId.ElectronBrowserViewQuickPick:
|
|
51
|
-
return import('../ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js');
|
|
52
46
|
case ModuleId.ElectronWindowAbout:
|
|
53
47
|
return import('../ElectronWindowAbout/ElectronWindowAbout.ipc.js');
|
|
54
48
|
case ModuleId.ElectronWindowProcessExplorer:
|
|
@@ -111,8 +105,6 @@ export const load = (moduleId) => {
|
|
|
111
105
|
return import('../TextDocument/TextDocument.ipc.js');
|
|
112
106
|
case ModuleId.Search:
|
|
113
107
|
return import('../TextSearch/TextSearch.ipc.js');
|
|
114
|
-
case ModuleId.ElectronBrowserViewSuggestions:
|
|
115
|
-
return import('../ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js');
|
|
116
108
|
case ModuleId.WebSocketServer:
|
|
117
109
|
return import('../WebSocketServer/WebSocketServer.ipc.js');
|
|
118
110
|
case ModuleId.Workspace:
|
|
@@ -137,12 +129,6 @@ export const load = (moduleId) => {
|
|
|
137
129
|
return import('../HandleRemoteRequest/HandleRemoteRequest.ipc.js');
|
|
138
130
|
case ModuleId.HandleMessagePortForExtensionHostHelperProcess:
|
|
139
131
|
return import('../HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.ipc.js');
|
|
140
|
-
case ModuleId.ElectronWebContents:
|
|
141
|
-
return import('../ElectronWebContents/ElectronWebContents.ipc.js');
|
|
142
|
-
case ModuleId.ElectronWebContentsView:
|
|
143
|
-
return import('../ElectronWebContentsView/ElectronWebContentsView.ipc.js');
|
|
144
|
-
case ModuleId.ElectronWebContentsViewFunctions:
|
|
145
|
-
return import('../ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js');
|
|
146
132
|
case ModuleId.ContentSecurityPolicy:
|
|
147
133
|
return import('../ContentSecurityPolicy/ContentSecurityPolicy.ipc.js');
|
|
148
134
|
case ModuleId.HandleMessagePortForProcessExplorer:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const ElectronBrowserViewSuggestions = 111;
|
|
2
1
|
export const ClipBoard = 1;
|
|
3
2
|
export const Developer = 2;
|
|
4
3
|
export const ExtensionHost = 3;
|
|
@@ -22,7 +21,6 @@ export const Download = 19;
|
|
|
22
21
|
export const ElectronPowerSaveBlocker = 222;
|
|
23
22
|
export const GitLsFiles = 20;
|
|
24
23
|
export const BulkReplacement = 21;
|
|
25
|
-
export const ElectronBrowserViewQuickPick = 999;
|
|
26
24
|
export const InstallExtension = 22;
|
|
27
25
|
export const AutoUpdater = 23;
|
|
28
26
|
export const IsAutoUpdateSupported = 24;
|
|
@@ -32,7 +30,6 @@ export const RebuildNodePty = 27;
|
|
|
32
30
|
export const ElectronInitialize = 28;
|
|
33
31
|
export const HandleWebSocket = 29;
|
|
34
32
|
export const Process = 30;
|
|
35
|
-
export const ElectronBrowserViewFunctions = 200;
|
|
36
33
|
export const AttachDebugger = 31;
|
|
37
34
|
export const HandleElectronMessagePort = 32;
|
|
38
35
|
export const HandleNodeMessagePort = 33;
|
|
@@ -53,7 +50,6 @@ export const ElectronSafeStorage = 47;
|
|
|
53
50
|
export const ElectronDeveloper = 100;
|
|
54
51
|
export const ElectronProcess = 48;
|
|
55
52
|
export const ElectronContextMenu = 49;
|
|
56
|
-
export const ElectronBrowserView = 50;
|
|
57
53
|
export const Window = 51;
|
|
58
54
|
export const PassThroughElectronMessagePort = 52;
|
|
59
55
|
export const Exit = 53;
|
|
@@ -69,9 +65,6 @@ export const TemporaryMessagePort = 62;
|
|
|
69
65
|
export const GetElectronFileResponse = 63;
|
|
70
66
|
export const HandleRemoteRequest = 64;
|
|
71
67
|
export const HandleMessagePortForExtensionHostHelperProcess = 65;
|
|
72
|
-
export const ElectronWebContents = 66;
|
|
73
|
-
export const ElectronWebContentsView = 67;
|
|
74
|
-
export const ElectronWebContentsViewFunctions = 68;
|
|
75
68
|
export const HandleRequestTest = 69;
|
|
76
69
|
export const ContentSecurityPolicy = 70;
|
|
77
70
|
export const HandleMessagePortForEmbedsProcess = 72;
|
|
@@ -41,10 +41,6 @@ export const getModuleId = (commandId) => {
|
|
|
41
41
|
case 'ElectronApplicationMenu.handleClick':
|
|
42
42
|
case 'ElectronApplicationMenu.setItems':
|
|
43
43
|
return ModuleId.ElectronApplicationMenu;
|
|
44
|
-
case 'ElectronBrowserView.createBrowserView':
|
|
45
|
-
case 'ElectronBrowserView.disposeBrowserView':
|
|
46
|
-
case 'ElectronBrowserView.getAll':
|
|
47
|
-
return ModuleId.ElectronBrowserView;
|
|
48
44
|
case 'ElectronClipBoard.writeText':
|
|
49
45
|
return ModuleId.ElectronClipBoard;
|
|
50
46
|
case 'ElectronContentTracing.startRecording':
|
|
@@ -73,9 +69,6 @@ export const getModuleId = (commandId) => {
|
|
|
73
69
|
return ModuleId.ElectronWindowProcessExplorer;
|
|
74
70
|
case 'Exit.exit':
|
|
75
71
|
return ModuleId.Exit;
|
|
76
|
-
case 'ElectronBrowserViewQuickPick.createBrowserViewQuickPick':
|
|
77
|
-
case 'ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick':
|
|
78
|
-
return ModuleId.ElectronBrowserViewQuickPick;
|
|
79
72
|
case 'ExtensionHost.dispose':
|
|
80
73
|
case 'ExtensionHost.enableExtension':
|
|
81
74
|
case 'ExtensionHost.executeCommand':
|
|
@@ -136,34 +129,6 @@ export const getModuleId = (commandId) => {
|
|
|
136
129
|
case 'ExtensionManagement.install':
|
|
137
130
|
case 'ExtensionManagement.uninstall':
|
|
138
131
|
return ModuleId.ExtensionManagement;
|
|
139
|
-
case 'ElectronBrowserViewFunctions.resizeBrowserView':
|
|
140
|
-
case 'ElectronBrowserViewFunctions.setIframeSrc':
|
|
141
|
-
case 'ElectronBrowserViewFunctions.focus':
|
|
142
|
-
case 'ElectronBrowserViewFunctions.openDevtools':
|
|
143
|
-
case 'ElectronBrowserViewFunctions.reload':
|
|
144
|
-
case 'ElectronBrowserViewFunctions.forward':
|
|
145
|
-
case 'ElectronBrowserViewFunctions.backward':
|
|
146
|
-
case 'ElectronBrowserViewFunctions.cancelNavigation':
|
|
147
|
-
case 'ElectronBrowserViewFunctions.hide':
|
|
148
|
-
case 'ElectronBrowserViewFunctions.inspectElement':
|
|
149
|
-
case 'ElectronBrowserViewFunctions.copyImageAt':
|
|
150
|
-
case 'ElectronBrowserViewFunctions.setFallthroughKeyBindings':
|
|
151
|
-
case 'ElectronBrowserViewFunctions.getStats':
|
|
152
|
-
return ModuleId.ElectronBrowserViewFunctions;
|
|
153
|
-
case 'ElectronWebContentsViewFunctions.resizeBrowserView':
|
|
154
|
-
case 'ElectronWebContentsViewFunctions.setIframeSrc':
|
|
155
|
-
case 'ElectronWebContentsViewFunctions.focus':
|
|
156
|
-
case 'ElectronWebContentsViewFunctions.openDevtools':
|
|
157
|
-
case 'ElectronWebContentsViewFunctions.reload':
|
|
158
|
-
case 'ElectronWebContentsViewFunctions.forward':
|
|
159
|
-
case 'ElectronWebContentsViewFunctions.backward':
|
|
160
|
-
case 'ElectronWebContentsViewFunctions.cancelNavigation':
|
|
161
|
-
case 'ElectronWebContentsViewFunctions.hide':
|
|
162
|
-
case 'ElectronWebContentsViewFunctions.inspectElement':
|
|
163
|
-
case 'ElectronWebContentsViewFunctions.copyImageAt':
|
|
164
|
-
case 'ElectronWebContentsViewFunctions.setFallthroughKeyBindings':
|
|
165
|
-
case 'ElectronWebContentsViewFunctions.getStats':
|
|
166
|
-
return ModuleId.ElectronWebContentsViewFunctions;
|
|
167
132
|
case 'FileSystem.chmod':
|
|
168
133
|
case 'FileSystem.copy':
|
|
169
134
|
case 'FileSystem.createFile':
|
|
@@ -177,10 +142,6 @@ export const getModuleId = (commandId) => {
|
|
|
177
142
|
case 'FileSystem.rename':
|
|
178
143
|
case 'FileSystem.writeFile':
|
|
179
144
|
return ModuleId.FileSystem;
|
|
180
|
-
case 'ElectronBrowserViewSuggestions.createBrowserView':
|
|
181
|
-
case 'ElectronBrowserViewSuggestions.disposeBrowserView':
|
|
182
|
-
case 'ElectronBrowserViewSuggestions.setSuggestions':
|
|
183
|
-
return ModuleId.ElectronBrowserViewSuggestions;
|
|
184
145
|
case 'GetTerminalSpawnOptions.getTerminalSpawnOptions':
|
|
185
146
|
return ModuleId.GetTerminalSpawnOptions;
|
|
186
147
|
case 'GitLsFiles.gitLsFiles':
|
|
@@ -301,7 +262,7 @@ export const getModuleId = (commandId) => {
|
|
|
301
262
|
return ModuleId.HandleWindowAllClosed;
|
|
302
263
|
case 'HandleMessagePortForTerminalProcess.handleMessagePortForTerminalProcess':
|
|
303
264
|
return ModuleId.HandleMessagePortForTerminalProcess;
|
|
304
|
-
case 'TemporaryMessagePort.
|
|
265
|
+
case 'TemporaryMessagePort.handlePorts':
|
|
305
266
|
return ModuleId.TemporaryMessagePort;
|
|
306
267
|
case 'GetElectronFileResponse.getElectronFileResponse':
|
|
307
268
|
return ModuleId.GetElectronFileResponse;
|
|
@@ -309,17 +270,6 @@ export const getModuleId = (commandId) => {
|
|
|
309
270
|
return ModuleId.HandleRemoteRequest;
|
|
310
271
|
case 'HandleMessagePortForExtensionHostHelperProcess.handleMessagePortForExtensionHostHelperProcess':
|
|
311
272
|
return ModuleId.HandleMessagePortForExtensionHostHelperProcess;
|
|
312
|
-
case 'ElectronWebContents.dispose':
|
|
313
|
-
case 'ElectronWebContents.handleKeyBinding':
|
|
314
|
-
case 'ElectronWebContents.handleWindowOpen':
|
|
315
|
-
case 'ElectronWebContents.handleWillNavigate':
|
|
316
|
-
case 'ElectronWebContents.handleDidNavigate':
|
|
317
|
-
case 'ElectronWebContents.handleContextMenu':
|
|
318
|
-
case 'ElectronWebContents.handlePageTitleUpdated':
|
|
319
|
-
return ModuleId.ElectronWebContents;
|
|
320
|
-
case 'ElectronWebContentsView.createWebContentsView':
|
|
321
|
-
case 'ElectronWebContentsView.disposeWebContentsView':
|
|
322
|
-
return ModuleId.ElectronWebContentsView;
|
|
323
273
|
case 'HandleRequestTest.handleRequestTest':
|
|
324
274
|
return ModuleId.HandleRequestTest;
|
|
325
275
|
case 'ContentSecurityPolicy.set':
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.26.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-04-
|
|
44
|
+
export const version = '0.26.2';
|
|
45
|
+
export const commit = 'efc5b0f';
|
|
46
|
+
export const date = '2024-04-23T20:38:06.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
2
|
+
import * as IpcId from '../IpcId/IpcId.js';
|
|
3
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
4
|
+
const state = {
|
|
5
|
+
pendingCount: Object.create(null),
|
|
6
|
+
};
|
|
7
|
+
const addState = (ipcId) => {
|
|
8
|
+
state.pendingCount[ipcId] ||= 0;
|
|
9
|
+
state.pendingCount[ipcId]++;
|
|
10
|
+
};
|
|
11
|
+
const removeState = (ipcId) => {
|
|
12
|
+
state.pendingCount[ipcId]--;
|
|
13
|
+
if (state.pendingCount[ipcId] === 0) {
|
|
14
|
+
delete state.pendingCount[ipcId];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const hasState = (ipcId) => {
|
|
18
|
+
return ipcId in state.pendingCount;
|
|
19
|
+
};
|
|
20
|
+
const supportsPartialIpcHandling = (ipcId) => {
|
|
21
|
+
switch (ipcId) {
|
|
22
|
+
case IpcId.TerminalProcess:
|
|
23
|
+
case IpcId.ProcessExplorer:
|
|
24
|
+
case IpcId.EmbedsProcess:
|
|
25
|
+
return true;
|
|
26
|
+
default:
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
// TODO fork ipc object instead of ref counting
|
|
31
|
+
// duplicated ipc object sends and receives one message
|
|
32
|
+
// original ipc object is never used and can
|
|
33
|
+
// be collected after being out of scope
|
|
34
|
+
// duplicated ipc can also be collected
|
|
35
|
+
// when it is out of scope
|
|
36
|
+
export const sendIncomingIpc = async (target, response, ipcId) => {
|
|
37
|
+
if (!hasState(ipcId) && supportsPartialIpcHandling(ipcId)) {
|
|
38
|
+
HandleIpc.handleIpc(target);
|
|
39
|
+
}
|
|
40
|
+
addState(ipcId);
|
|
41
|
+
await JsonRpc.invokeAndTransfer(target, response.transfer, response.method, ...response.params);
|
|
42
|
+
removeState(ipcId);
|
|
43
|
+
if (!hasState(ipcId) && supportsPartialIpcHandling(ipcId)) {
|
|
44
|
+
HandleIpc.unhandleIpc(target);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
1
|
import * as Assert from '../Assert/Assert.js';
|
|
3
2
|
import * as Id from '../Id/Id.js';
|
|
3
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
4
|
export const state = {
|
|
5
5
|
ports: Object.create(null),
|
|
6
6
|
};
|
|
7
|
-
export const create = async (name) => {
|
|
8
|
-
Assert.string(name);
|
|
9
|
-
await ParentIpc.invoke('TemporaryMessagePort.create', name);
|
|
10
|
-
const port = state.ports[name];
|
|
11
|
-
if (!port) {
|
|
12
|
-
throw new Error(`port was not created`);
|
|
13
|
-
}
|
|
14
|
-
delete state.ports[name];
|
|
15
|
-
port.start();
|
|
16
|
-
return port;
|
|
17
|
-
};
|
|
18
7
|
export const getPortTuple = async () => {
|
|
19
|
-
const id1 =
|
|
20
|
-
const id2 =
|
|
8
|
+
const id1 = Id.create();
|
|
9
|
+
const id2 = Id.create();
|
|
21
10
|
await ParentIpc.invoke('TemporaryMessagePort.createPortTuple', id1, id2);
|
|
22
11
|
const port1 = state.ports[id1];
|
|
23
12
|
const port2 = state.ports[id2];
|
|
13
|
+
delete state.ports[id1];
|
|
14
|
+
delete state.ports[id2];
|
|
24
15
|
return {
|
|
25
16
|
port1,
|
|
26
17
|
port2,
|
|
@@ -31,8 +22,11 @@ export const sendTo = async (name, port) => {
|
|
|
31
22
|
Assert.object(port);
|
|
32
23
|
await ParentIpc.invokeAndTransfer('TemporaryMessagePort.sendTo', [port], name);
|
|
33
24
|
};
|
|
34
|
-
export const
|
|
35
|
-
Assert.
|
|
36
|
-
Assert.
|
|
37
|
-
|
|
25
|
+
export const handlePorts = (port1, port2, id1, id2) => {
|
|
26
|
+
Assert.number(id1);
|
|
27
|
+
Assert.number(id2);
|
|
28
|
+
Assert.object(port1);
|
|
29
|
+
Assert.object(port2);
|
|
30
|
+
state.ports[id1] = port1;
|
|
31
|
+
state.ports[id2] = port2;
|
|
38
32
|
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronBrowserViewState from '../ElectronBrowserViewState/ElectronBrowserViewState.js';
|
|
3
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
4
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
5
|
-
export const createBrowserView = async (ipc, restoreId, fallthroughKeyBindings) => {
|
|
6
|
-
const webContentsId = await ParentIpc.invoke('ElectronBrowserView.createBrowserView2', restoreId);
|
|
7
|
-
ElectronBrowserViewIpcState.add(webContentsId, ipc);
|
|
8
|
-
// TODO get window id from renderer worker
|
|
9
|
-
await ParentIpc.invoke('ElectronBrowserView.attachEventListeners', webContentsId);
|
|
10
|
-
await ParentIpc.invoke('ElectronBrowserViewFunctions.setBackgroundColor', webContentsId, 'white');
|
|
11
|
-
return webContentsId;
|
|
12
|
-
};
|
|
13
|
-
export const disposeBrowserView = async (id) => {
|
|
14
|
-
ElectronBrowserViewState.remove(id);
|
|
15
|
-
await ParentIpc.invoke('ElectronBrowserView.disposeBrowserView', id);
|
|
16
|
-
await ElectronWebContents.dispose(id);
|
|
17
|
-
};
|
|
18
|
-
export const handleBrowserViewCreated = (id) => {
|
|
19
|
-
console.log('created', id);
|
|
20
|
-
ElectronBrowserViewState.add(id);
|
|
21
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewFunctions from './ElectronBrowserViewFunctions.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewFunctions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
resizeBrowserView: ElectronBrowserViewFunctions.resizeBrowserView,
|
|
5
|
-
setIframeSrc: ElectronBrowserViewFunctions.setIframeSrc,
|
|
6
|
-
focus: ElectronBrowserViewFunctions.focus,
|
|
7
|
-
openDevtools: ElectronBrowserViewFunctions.openDevtools,
|
|
8
|
-
reload: ElectronBrowserViewFunctions.reload,
|
|
9
|
-
forward: ElectronBrowserViewFunctions.forward,
|
|
10
|
-
backward: ElectronBrowserViewFunctions.backward,
|
|
11
|
-
cancelNavigation: ElectronBrowserViewFunctions.cancelNavigation,
|
|
12
|
-
show: ElectronBrowserViewFunctions.show,
|
|
13
|
-
hide: ElectronBrowserViewFunctions.hide,
|
|
14
|
-
inspectElement: ElectronBrowserViewFunctions.inspectElement,
|
|
15
|
-
copyImageAt: ElectronBrowserViewFunctions.copyImageAt,
|
|
16
|
-
setFallthroughKeyBindings: ElectronBrowserViewFunctions.setFallthroughKeyBindings,
|
|
17
|
-
getStats: ElectronBrowserViewFunctions.getStats,
|
|
18
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
export const resizeBrowserView = (id, x, y, width, height) => {
|
|
4
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.resizeBrowserView', id, x, y, width, height);
|
|
5
|
-
};
|
|
6
|
-
export const setIframeSrc = async (id, iframeSrc) => {
|
|
7
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.setIframeSrc', id, iframeSrc);
|
|
8
|
-
};
|
|
9
|
-
const callFunction = (id, functionName) => {
|
|
10
|
-
return ParentIpc.invoke('ElectronWebContents.callFunction', id, functionName);
|
|
11
|
-
};
|
|
12
|
-
export const focus = ElectronWebContents.focus;
|
|
13
|
-
export const openDevtools = ElectronWebContents.openDevtools;
|
|
14
|
-
export const reload = ElectronWebContents.reload;
|
|
15
|
-
export const forward = ElectronWebContents.forward;
|
|
16
|
-
export const backward = ElectronWebContents.backward;
|
|
17
|
-
export const cancelNavigation = (id) => {
|
|
18
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.cancelNavigation', id);
|
|
19
|
-
};
|
|
20
|
-
export const show = (id) => {
|
|
21
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.show', id);
|
|
22
|
-
};
|
|
23
|
-
export const hide = (id) => {
|
|
24
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.hide', id);
|
|
25
|
-
};
|
|
26
|
-
export const inspectElement = ElectronWebContents.inspectElement;
|
|
27
|
-
export const copyImageAt = (id, x, y) => {
|
|
28
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.copyImageAt', id, x, y);
|
|
29
|
-
};
|
|
30
|
-
export const setFallthroughKeyBindings = (fallthroughKeyBindings) => {
|
|
31
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.setFallthroughKeyBindings', fallthroughKeyBindings);
|
|
32
|
-
};
|
|
33
|
-
export const getStats = (id) => {
|
|
34
|
-
return ParentIpc.invoke('ElectronWebContents.getStats', id);
|
|
35
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const state = {
|
|
2
|
-
ipcMap: Object.create(null),
|
|
3
|
-
};
|
|
4
|
-
export const add = (id, ipc) => {
|
|
5
|
-
state.ipcMap[id] = ipc;
|
|
6
|
-
};
|
|
7
|
-
export const get = (id) => {
|
|
8
|
-
return state.ipcMap[id];
|
|
9
|
-
};
|
|
10
|
-
export const remove = (id) => {
|
|
11
|
-
delete state.ipcMap[id];
|
|
12
|
-
};
|
|
13
|
-
export const getAll = () => {
|
|
14
|
-
return Object.values(state.ipcMap);
|
|
15
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewQuickPick from './ElectronBrowserViewQuickPick.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewQuickPick';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
startLogging: ElectronBrowserViewQuickPick.createBrowserViewQuickPick,
|
|
5
|
-
disposeBrowserViewQuickPick: ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick,
|
|
6
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
export const createBrowserViewQuickPick = (x, y, width, height) => {
|
|
3
|
-
return ParentIpc.invoke('ElectronBrowserViewQuickPick.createBrowserViewQuickPick', x, y, width, height);
|
|
4
|
-
};
|
|
5
|
-
export const disposeBrowserViewQuickPick = () => {
|
|
6
|
-
return ParentIpc.invoke('ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick');
|
|
7
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const state = {
|
|
2
|
-
browserViews: Object.create(null),
|
|
3
|
-
};
|
|
4
|
-
export const add = (id) => {
|
|
5
|
-
state.browserViews[id] = id;
|
|
6
|
-
};
|
|
7
|
-
export const remove = (id) => {
|
|
8
|
-
delete state.browserViews[id];
|
|
9
|
-
};
|
|
10
|
-
export const getAll = () => {
|
|
11
|
-
return Object.values(state.browserViews);
|
|
12
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewSuggestions from './ElectronBrowserViewSuggestions.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewSuggestions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
createBrowserView: ElectronBrowserViewSuggestions.createBrowserView,
|
|
5
|
-
disposeBrowserView: ElectronBrowserViewSuggestions.disposeBrowserView,
|
|
6
|
-
setSuggestions: ElectronBrowserViewSuggestions.setSuggestions,
|
|
7
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
export const createBrowserView = (x, y, width, height) => {
|
|
3
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.createBrowserView', x, y, width, height);
|
|
4
|
-
};
|
|
5
|
-
export const disposeBrowserView = () => {
|
|
6
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.disposeBrowserView');
|
|
7
|
-
};
|
|
8
|
-
export const setSuggestions = (suggestions) => {
|
|
9
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.setSuggestions', suggestions);
|
|
10
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContents from './ElectronWebContents.js';
|
|
2
|
-
export const name = 'ElectronWebContents';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
dispose: ElectronWebContents.dispose,
|
|
5
|
-
handleKeyBinding: ElectronWebContents.handleKeyBinding,
|
|
6
|
-
handleWindowOpen: ElectronWebContents.handleWindowOpen,
|
|
7
|
-
handleWillNavigate: ElectronWebContents.handleWillNavigate,
|
|
8
|
-
handleDidNavigate: ElectronWebContents.handleDidNavigate,
|
|
9
|
-
handleContextMenu: ElectronWebContents.handleContextMenu,
|
|
10
|
-
handleTitleUpdated: ElectronWebContents.handleTitleUpdated,
|
|
11
|
-
handleBrowserViewDestroyed: ElectronWebContents.handleBrowserViewDestroyed, // TODO rename to webcontents
|
|
12
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronBrowserViewState from '../ElectronBrowserViewState/ElectronBrowserViewState.js';
|
|
3
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
|
-
export const dispose = async (id) => {
|
|
5
|
-
await ParentIpc.invoke('ElectronWebContents.dispose', id);
|
|
6
|
-
};
|
|
7
|
-
export const callFunction = (webContentsId, method, ...params) => {
|
|
8
|
-
return ParentIpc.invoke(`ElectronWebContents.callFunction`, webContentsId, method, ...params);
|
|
9
|
-
};
|
|
10
|
-
export const focus = (webContentsId) => {
|
|
11
|
-
return callFunction(webContentsId, 'focus');
|
|
12
|
-
};
|
|
13
|
-
export const openDevtools = (webContentsId) => {
|
|
14
|
-
return callFunction(webContentsId, 'openDevTools');
|
|
15
|
-
};
|
|
16
|
-
export const reload = (webContentsId) => {
|
|
17
|
-
return callFunction(webContentsId, 'reload');
|
|
18
|
-
};
|
|
19
|
-
export const forward = (webContentsId) => {
|
|
20
|
-
return callFunction(webContentsId, 'goForward');
|
|
21
|
-
};
|
|
22
|
-
export const backward = (webContentsId) => {
|
|
23
|
-
return callFunction(webContentsId, 'goBack');
|
|
24
|
-
};
|
|
25
|
-
export const inspectElement = (webContentsId, x, y) => {
|
|
26
|
-
return callFunction(webContentsId, `inspectElement`, x, y);
|
|
27
|
-
};
|
|
28
|
-
export const handleWindowOpen = (webContentsId, url) => {
|
|
29
|
-
// TODO
|
|
30
|
-
};
|
|
31
|
-
const forwardEvent = (method, webContentsId, ...params) => {
|
|
32
|
-
const ipc = ElectronBrowserViewIpcState.get(webContentsId);
|
|
33
|
-
if (!ipc) {
|
|
34
|
-
console.log(`[shared-process] no ipc for webcontents ${webContentsId}`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
ipc.send({
|
|
38
|
-
jsonrpc: '2.0',
|
|
39
|
-
method: `SimpleBrowser.${method}`,
|
|
40
|
-
params,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
export const handleWillNavigate = (...args) => {
|
|
44
|
-
return forwardEvent('handleWillNavigate', ...args);
|
|
45
|
-
};
|
|
46
|
-
export const handleDidNavigate = (...args) => {
|
|
47
|
-
return forwardEvent('handleDidNavigate', ...args);
|
|
48
|
-
};
|
|
49
|
-
export const handleContextMenu = (...args) => {
|
|
50
|
-
return forwardEvent('handleContextMenu', ...args);
|
|
51
|
-
};
|
|
52
|
-
export const handleTitleUpdated = (...args) => {
|
|
53
|
-
return forwardEvent('handleTitleUpdated', ...args);
|
|
54
|
-
};
|
|
55
|
-
export const handleKeyBinding = (...args) => {
|
|
56
|
-
forwardEvent('handleKeyBinding', ...args);
|
|
57
|
-
};
|
|
58
|
-
export const handleBrowserViewDestroyed = (id) => {
|
|
59
|
-
ElectronBrowserViewState.remove(id);
|
|
60
|
-
ElectronBrowserViewIpcState.remove(id);
|
|
61
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContentsView from './ElectronWebContentsView.js';
|
|
2
|
-
export const name = 'ElectronWebContentsView';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
createWebContentsView: ElectronWebContentsView.createWebContentsView,
|
|
5
|
-
disposeWebContentsView: ElectronWebContentsView.disposeWebContentsView,
|
|
6
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
|
-
import * as Assert from '../Assert/Assert.js';
|
|
5
|
-
export const createWebContentsView = async (ipc, restoreId, fallthroughKeyBindings) => {
|
|
6
|
-
Assert.object(ipc);
|
|
7
|
-
Assert.number(restoreId);
|
|
8
|
-
const webContentsId = await ParentIpc.invoke('ElectronWebContentsView.createWebContentsView', restoreId);
|
|
9
|
-
ElectronBrowserViewIpcState.add(webContentsId, ipc);
|
|
10
|
-
// TODO get window id from renderer worker
|
|
11
|
-
await ParentIpc.invoke('ElectronWebContentsView.attachEventListeners', webContentsId);
|
|
12
|
-
await ParentIpc.invoke('ElectronWebContentsViewFunctions.setBackgroundColor', webContentsId, 'white');
|
|
13
|
-
return webContentsId;
|
|
14
|
-
};
|
|
15
|
-
export const disposeWebContentsView = async (id) => {
|
|
16
|
-
await ParentIpc.invoke('ElectronWebContentsView.disposeWebContentsView', id);
|
|
17
|
-
await ElectronWebContents.dispose(id);
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContentsViewFunctions from './ElectronWebContentsViewFunctions.js';
|
|
2
|
-
export const name = 'ElectronWebContentsViewFunctions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
resizeBrowserView: ElectronWebContentsViewFunctions.resizeBrowserView,
|
|
5
|
-
setIframeSrc: ElectronWebContentsViewFunctions.setIframeSrc,
|
|
6
|
-
focus: ElectronWebContentsViewFunctions.focus,
|
|
7
|
-
openDevtools: ElectronWebContentsViewFunctions.openDevtools,
|
|
8
|
-
reload: ElectronWebContentsViewFunctions.reload,
|
|
9
|
-
forward: ElectronWebContentsViewFunctions.forward,
|
|
10
|
-
backward: ElectronWebContentsViewFunctions.backward,
|
|
11
|
-
cancelNavigation: ElectronWebContentsViewFunctions.cancelNavigation,
|
|
12
|
-
show: ElectronWebContentsViewFunctions.show,
|
|
13
|
-
hide: ElectronWebContentsViewFunctions.hide,
|
|
14
|
-
inspectElement: ElectronWebContentsViewFunctions.inspectElement,
|
|
15
|
-
copyImageAt: ElectronWebContentsViewFunctions.copyImageAt,
|
|
16
|
-
setFallthroughKeyBindings: ElectronWebContentsViewFunctions.setFallthroughKeyBindings,
|
|
17
|
-
getStats: ElectronWebContentsViewFunctions.getStats,
|
|
18
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
export const resizeBrowserView = (id, x, y, width, height) => {
|
|
4
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.resizeBrowserView', id, x, y, width, height);
|
|
5
|
-
};
|
|
6
|
-
export const setIframeSrc = async (id, iframeSrc) => {
|
|
7
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.setIframeSrc', id, iframeSrc);
|
|
8
|
-
};
|
|
9
|
-
const callFunction = (id, functionName) => {
|
|
10
|
-
return ParentIpc.invoke('ElectronWebContents.callFunction', id, functionName);
|
|
11
|
-
};
|
|
12
|
-
export const focus = ElectronWebContents.focus;
|
|
13
|
-
export const openDevtools = ElectronWebContents.openDevtools;
|
|
14
|
-
export const reload = ElectronWebContents.reload;
|
|
15
|
-
export const forward = ElectronWebContents.forward;
|
|
16
|
-
export const backward = ElectronWebContents.backward;
|
|
17
|
-
export const cancelNavigation = (id) => {
|
|
18
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.cancelNavigation', id);
|
|
19
|
-
};
|
|
20
|
-
export const show = (id) => {
|
|
21
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.show', id);
|
|
22
|
-
};
|
|
23
|
-
export const hide = (id) => {
|
|
24
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.hide', id);
|
|
25
|
-
};
|
|
26
|
-
export const inspectElement = ElectronWebContents.inspectElement;
|
|
27
|
-
export const copyImageAt = (id, x, y) => {
|
|
28
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.copyImageAt', id, x, y);
|
|
29
|
-
};
|
|
30
|
-
export const setFallthroughKeyBindings = (fallthroughKeyBindings) => {
|
|
31
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.setFallthroughKeyBindings', fallthroughKeyBindings);
|
|
32
|
-
};
|
|
33
|
-
export const getStats = (id) => {
|
|
34
|
-
return ParentIpc.invoke('ElectronWebContents.getStats', id);
|
|
35
|
-
};
|