@lvce-editor/iframe-worker 5.34.0 → 5.36.0
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/dist/iframeWorkerMain.js +479 -92
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -472,7 +472,7 @@ const create$4 = (method, params) => {
|
|
|
472
472
|
};
|
|
473
473
|
};
|
|
474
474
|
const callbacks = Object.create(null);
|
|
475
|
-
const set$
|
|
475
|
+
const set$3 = (id, fn) => {
|
|
476
476
|
callbacks[id] = fn;
|
|
477
477
|
};
|
|
478
478
|
const get$2 = id => {
|
|
@@ -482,16 +482,16 @@ const remove$1 = id => {
|
|
|
482
482
|
delete callbacks[id];
|
|
483
483
|
};
|
|
484
484
|
let id = 0;
|
|
485
|
-
const create$3 = () => {
|
|
485
|
+
const create$3$1 = () => {
|
|
486
486
|
return ++id;
|
|
487
487
|
};
|
|
488
488
|
const registerPromise = () => {
|
|
489
|
-
const id = create$3();
|
|
489
|
+
const id = create$3$1();
|
|
490
490
|
const {
|
|
491
491
|
resolve,
|
|
492
492
|
promise
|
|
493
493
|
} = Promise.withResolvers();
|
|
494
|
-
set$
|
|
494
|
+
set$3(id, resolve);
|
|
495
495
|
return {
|
|
496
496
|
id,
|
|
497
497
|
promise
|
|
@@ -571,7 +571,8 @@ const splitLines = lines => {
|
|
|
571
571
|
return lines.split(NewLine);
|
|
572
572
|
};
|
|
573
573
|
const getCurrentStack = () => {
|
|
574
|
-
const
|
|
574
|
+
const stackLinesToSkip = 3;
|
|
575
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
575
576
|
return currentStack;
|
|
576
577
|
};
|
|
577
578
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
@@ -705,18 +706,18 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
705
706
|
}
|
|
706
707
|
};
|
|
707
708
|
};
|
|
708
|
-
const create$1$1 = (
|
|
709
|
+
const create$1$1 = (id, error) => {
|
|
709
710
|
return {
|
|
710
711
|
jsonrpc: Two,
|
|
711
|
-
id
|
|
712
|
+
id,
|
|
712
713
|
error
|
|
713
714
|
};
|
|
714
715
|
};
|
|
715
|
-
const getErrorResponse = (
|
|
716
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
716
717
|
const prettyError = preparePrettyError(error);
|
|
717
718
|
logError(error, prettyError);
|
|
718
719
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
719
|
-
return create$1$1(
|
|
720
|
+
return create$1$1(id, errorProperty);
|
|
720
721
|
};
|
|
721
722
|
const create$5 = (message, result) => {
|
|
722
723
|
return {
|
|
@@ -729,12 +730,27 @@ const getSuccessResponse = (message, result) => {
|
|
|
729
730
|
const resultProperty = result ?? null;
|
|
730
731
|
return create$5(message, resultProperty);
|
|
731
732
|
};
|
|
733
|
+
const getErrorResponseSimple = (id, error) => {
|
|
734
|
+
return {
|
|
735
|
+
jsonrpc: Two,
|
|
736
|
+
id,
|
|
737
|
+
error: {
|
|
738
|
+
code: Custom,
|
|
739
|
+
// @ts-ignore
|
|
740
|
+
message: error.message,
|
|
741
|
+
data: error
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
};
|
|
732
745
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
733
746
|
try {
|
|
734
747
|
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
735
748
|
return getSuccessResponse(message, result);
|
|
736
749
|
} catch (error) {
|
|
737
|
-
|
|
750
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
751
|
+
return getErrorResponseSimple(message.id, error);
|
|
752
|
+
}
|
|
753
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
738
754
|
}
|
|
739
755
|
};
|
|
740
756
|
const defaultPreparePrettyError = error => {
|
|
@@ -789,7 +805,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
789
805
|
try {
|
|
790
806
|
ipc.send(response);
|
|
791
807
|
} catch (error) {
|
|
792
|
-
const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
|
|
808
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
793
809
|
ipc.send(errorResponse);
|
|
794
810
|
}
|
|
795
811
|
return;
|
|
@@ -820,13 +836,19 @@ const send = (transport, method, ...params) => {
|
|
|
820
836
|
const message = create$4(method, params);
|
|
821
837
|
transport.send(message);
|
|
822
838
|
};
|
|
823
|
-
const invoke$
|
|
839
|
+
const invoke$6 = (ipc, method, ...params) => {
|
|
824
840
|
return invokeHelper(ipc, method, params, false);
|
|
825
841
|
};
|
|
826
|
-
const invokeAndTransfer$
|
|
842
|
+
const invokeAndTransfer$5 = (ipc, method, ...params) => {
|
|
827
843
|
return invokeHelper(ipc, method, params, true);
|
|
828
844
|
};
|
|
829
845
|
|
|
846
|
+
class CommandNotFoundError extends Error {
|
|
847
|
+
constructor(command) {
|
|
848
|
+
super(`Command not found ${command}`);
|
|
849
|
+
this.name = 'CommandNotFoundError';
|
|
850
|
+
}
|
|
851
|
+
}
|
|
830
852
|
const commands = Object.create(null);
|
|
831
853
|
const register$4 = commandMap => {
|
|
832
854
|
Object.assign(commands, commandMap);
|
|
@@ -837,7 +859,7 @@ const getCommand = key => {
|
|
|
837
859
|
const execute = (command, ...args) => {
|
|
838
860
|
const fn = getCommand(command);
|
|
839
861
|
if (!fn) {
|
|
840
|
-
throw new
|
|
862
|
+
throw new CommandNotFoundError(command);
|
|
841
863
|
}
|
|
842
864
|
return fn(...args);
|
|
843
865
|
};
|
|
@@ -853,10 +875,10 @@ const createRpc = ipc => {
|
|
|
853
875
|
send(ipc, method, ...params);
|
|
854
876
|
},
|
|
855
877
|
invoke(method, ...params) {
|
|
856
|
-
return invoke$
|
|
878
|
+
return invoke$6(ipc, method, ...params);
|
|
857
879
|
},
|
|
858
880
|
invokeAndTransfer(method, ...params) {
|
|
859
|
-
return invokeAndTransfer$
|
|
881
|
+
return invokeAndTransfer$5(ipc, method, ...params);
|
|
860
882
|
},
|
|
861
883
|
async dispose() {
|
|
862
884
|
await ipc?.dispose();
|
|
@@ -894,7 +916,7 @@ const listen$1 = async (module, options) => {
|
|
|
894
916
|
const ipc = module.wrap(rawIpc);
|
|
895
917
|
return ipc;
|
|
896
918
|
};
|
|
897
|
-
const create$
|
|
919
|
+
const create$e = async ({
|
|
898
920
|
commandMap,
|
|
899
921
|
messagePort,
|
|
900
922
|
isMessagePortOpen
|
|
@@ -912,9 +934,9 @@ const create$9 = async ({
|
|
|
912
934
|
};
|
|
913
935
|
const MessagePortRpcParent = {
|
|
914
936
|
__proto__: null,
|
|
915
|
-
create: create$
|
|
937
|
+
create: create$e
|
|
916
938
|
};
|
|
917
|
-
const create$
|
|
939
|
+
const create$3 = async ({
|
|
918
940
|
commandMap
|
|
919
941
|
}) => {
|
|
920
942
|
// TODO create a commandMap per rpc instance
|
|
@@ -926,32 +948,396 @@ const create$2 = async ({
|
|
|
926
948
|
};
|
|
927
949
|
const WebWorkerRpcClient = {
|
|
928
950
|
__proto__: null,
|
|
929
|
-
create: create$
|
|
951
|
+
create: create$3
|
|
930
952
|
};
|
|
931
953
|
|
|
932
|
-
const
|
|
954
|
+
const DebugWorker = 55;
|
|
955
|
+
const RendererWorker$1 = 1;
|
|
933
956
|
|
|
934
957
|
const rpcs$1 = Object.create(null);
|
|
935
|
-
const set$
|
|
958
|
+
const set$2 = (id, rpc) => {
|
|
936
959
|
rpcs$1[id] = rpc;
|
|
937
960
|
};
|
|
938
961
|
const get$1 = id => {
|
|
939
962
|
return rpcs$1[id];
|
|
940
963
|
};
|
|
941
964
|
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
|
|
965
|
+
const create$2 = rpcId => {
|
|
966
|
+
return {
|
|
967
|
+
// @ts-ignore
|
|
968
|
+
invoke(method, ...params) {
|
|
969
|
+
const rpc = get$1(rpcId);
|
|
970
|
+
// @ts-ignore
|
|
971
|
+
return rpc.invoke(method, ...params);
|
|
972
|
+
},
|
|
973
|
+
// @ts-ignore
|
|
974
|
+
invokeAndTransfer(method, ...params) {
|
|
975
|
+
const rpc = get$1(rpcId);
|
|
976
|
+
// @ts-ignore
|
|
977
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
978
|
+
},
|
|
979
|
+
set(rpc) {
|
|
980
|
+
set$2(rpcId, rpc);
|
|
981
|
+
},
|
|
982
|
+
async dispose() {
|
|
983
|
+
const rpc = get$1(rpcId);
|
|
984
|
+
await rpc.dispose();
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
const {
|
|
990
|
+
invoke: invoke$5,
|
|
991
|
+
invokeAndTransfer: invokeAndTransfer$4,
|
|
992
|
+
set: set$1,
|
|
993
|
+
dispose
|
|
994
|
+
} = create$2(RendererWorker$1);
|
|
995
|
+
const searchFileHtml = async uri => {
|
|
996
|
+
return invoke$5('ExtensionHost.searchFileWithHtml', uri);
|
|
997
|
+
};
|
|
998
|
+
const getFilePathElectron = async file => {
|
|
999
|
+
return invoke$5('FileSystemHandle.getFilePathElectron', file);
|
|
1000
|
+
};
|
|
1001
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1002
|
+
return invoke$5('ContextMenu.show', x, y, id, ...args);
|
|
1003
|
+
};
|
|
1004
|
+
const getElectronVersion = async () => {
|
|
1005
|
+
return invoke$5('Process.getElectronVersion');
|
|
1006
|
+
};
|
|
1007
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1008
|
+
await invoke$5('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1009
|
+
};
|
|
1010
|
+
const setColorTheme = async id => {
|
|
1011
|
+
// @ts-ignore
|
|
1012
|
+
return invoke$5(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1013
|
+
};
|
|
1014
|
+
const getNodeVersion = async () => {
|
|
1015
|
+
return invoke$5('Process.getNodeVersion');
|
|
1016
|
+
};
|
|
1017
|
+
const getChromeVersion = async () => {
|
|
1018
|
+
return invoke$5('Process.getChromeVersion');
|
|
945
1019
|
};
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
|
|
1020
|
+
const getV8Version = async () => {
|
|
1021
|
+
return invoke$5('Process.getV8Version');
|
|
1022
|
+
};
|
|
1023
|
+
const getFileHandles = async fileIds => {
|
|
1024
|
+
const files = await invoke$5('FileSystemHandle.getFileHandles', fileIds);
|
|
1025
|
+
return files;
|
|
1026
|
+
};
|
|
1027
|
+
const setWorkspacePath = async path => {
|
|
1028
|
+
await invoke$5('Workspace.setPath', path);
|
|
1029
|
+
};
|
|
1030
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1031
|
+
await invokeAndTransfer$4('WebView.registerInterceptor', id, port);
|
|
1032
|
+
};
|
|
1033
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1034
|
+
await invoke$5('WebView.unregisterInterceptor', id);
|
|
1035
|
+
};
|
|
1036
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1037
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1038
|
+
// @ts-ignore
|
|
1039
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1040
|
+
};
|
|
1041
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1042
|
+
const command = 'Errors.handleMessagePort';
|
|
1043
|
+
// @ts-ignore
|
|
1044
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1045
|
+
};
|
|
1046
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1047
|
+
const command = 'Markdown.handleMessagePort';
|
|
1048
|
+
// @ts-ignore
|
|
1049
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1050
|
+
};
|
|
1051
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1052
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1053
|
+
// @ts-ignore
|
|
1054
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1055
|
+
};
|
|
1056
|
+
const readFile$1 = async uri => {
|
|
1057
|
+
return invoke$5('FileSystem.readFile', uri);
|
|
1058
|
+
};
|
|
1059
|
+
const getWebViewSecret = async key => {
|
|
1060
|
+
// @ts-ignore
|
|
1061
|
+
return invoke$5('WebView.getSecret', key);
|
|
1062
|
+
};
|
|
1063
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1064
|
+
return invokeAndTransfer$4('WebView.setPort', uid, port, origin, portType);
|
|
1065
|
+
};
|
|
1066
|
+
const setFocus = key => {
|
|
1067
|
+
return invoke$5('Focus.setFocus', key);
|
|
1068
|
+
};
|
|
1069
|
+
const getFileIcon = async options => {
|
|
1070
|
+
return invoke$5('IconTheme.getFileIcon', options);
|
|
1071
|
+
};
|
|
1072
|
+
const getColorThemeNames = async () => {
|
|
1073
|
+
return invoke$5('ColorTheme.getColorThemeNames');
|
|
1074
|
+
};
|
|
1075
|
+
const disableExtension = async id => {
|
|
1076
|
+
// @ts-ignore
|
|
1077
|
+
return invoke$5('ExtensionManagement.disable', id);
|
|
1078
|
+
};
|
|
1079
|
+
const enableExtension = async id => {
|
|
1080
|
+
// @ts-ignore
|
|
1081
|
+
return invoke$5('ExtensionManagement.enable', id);
|
|
1082
|
+
};
|
|
1083
|
+
const handleDebugChange = async params => {
|
|
1084
|
+
// @ts-ignore
|
|
1085
|
+
return invoke$5('Run And Debug.handleChange', params);
|
|
1086
|
+
};
|
|
1087
|
+
const getFolderIcon = async options => {
|
|
1088
|
+
return invoke$5('IconTheme.getFolderIcon', options);
|
|
1089
|
+
};
|
|
1090
|
+
const closeWidget = async widgetId => {
|
|
1091
|
+
return invoke$5('Viewlet.closeWidget', widgetId);
|
|
1092
|
+
};
|
|
1093
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1094
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1095
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1096
|
+
};
|
|
1097
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1098
|
+
await invokeAndTransfer$4('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1099
|
+
};
|
|
1100
|
+
const confirm = async (message, options) => {
|
|
1101
|
+
// @ts-ignore
|
|
1102
|
+
const result = await invoke$5('ConfirmPrompt.prompt', message, options);
|
|
1103
|
+
return result;
|
|
1104
|
+
};
|
|
1105
|
+
const getRecentlyOpened = async () => {
|
|
1106
|
+
return invoke$5(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1107
|
+
};
|
|
1108
|
+
const getKeyBindings = async () => {
|
|
1109
|
+
return invoke$5('KeyBindingsInitial.getKeyBindings');
|
|
1110
|
+
};
|
|
1111
|
+
const writeClipBoardText = async text => {
|
|
1112
|
+
await invoke$5('ClipBoard.writeText', /* text */text);
|
|
1113
|
+
};
|
|
1114
|
+
const writeClipBoardImage = async blob => {
|
|
1115
|
+
// @ts-ignore
|
|
1116
|
+
await invoke$5('ClipBoard.writeImage', /* text */blob);
|
|
1117
|
+
};
|
|
1118
|
+
const searchFileMemory = async uri => {
|
|
1119
|
+
// @ts-ignore
|
|
1120
|
+
return invoke$5('ExtensionHost.searchFileWithMemory', uri);
|
|
1121
|
+
};
|
|
1122
|
+
const searchFileFetch = async uri => {
|
|
1123
|
+
return invoke$5('ExtensionHost.searchFileWithFetch', uri);
|
|
1124
|
+
};
|
|
1125
|
+
const showMessageBox = async options => {
|
|
1126
|
+
return invoke$5('ElectronDialog.showMessageBox', options);
|
|
1127
|
+
};
|
|
1128
|
+
const handleDebugResumed = async params => {
|
|
1129
|
+
await invoke$5('Run And Debug.handleResumed', params);
|
|
1130
|
+
};
|
|
1131
|
+
const openWidget = async name => {
|
|
1132
|
+
await invoke$5('Viewlet.openWidget', name);
|
|
1133
|
+
};
|
|
1134
|
+
const getIcons = async requests => {
|
|
1135
|
+
const icons = await invoke$5('IconTheme.getIcons', requests);
|
|
1136
|
+
return icons;
|
|
1137
|
+
};
|
|
1138
|
+
const activateByEvent = event => {
|
|
1139
|
+
return invoke$5('ExtensionHostManagement.activateByEvent', event);
|
|
1140
|
+
};
|
|
1141
|
+
const setAdditionalFocus = focusKey => {
|
|
1142
|
+
// @ts-ignore
|
|
1143
|
+
return invoke$5('Focus.setAdditionalFocus', focusKey);
|
|
1144
|
+
};
|
|
1145
|
+
const getActiveEditorId = () => {
|
|
1146
|
+
// @ts-ignore
|
|
1147
|
+
return invoke$5('GetActiveEditor.getActiveEditorId');
|
|
1148
|
+
};
|
|
1149
|
+
const getWorkspacePath = () => {
|
|
1150
|
+
return invoke$5('Workspace.getPath');
|
|
1151
|
+
};
|
|
1152
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1153
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1154
|
+
// @ts-ignore
|
|
1155
|
+
await invokeAndTransfer$4('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1156
|
+
};
|
|
1157
|
+
const getPreference = async key => {
|
|
1158
|
+
return await invoke$5('Preferences.get', key);
|
|
1159
|
+
};
|
|
1160
|
+
const getAllExtensions = async () => {
|
|
1161
|
+
return invoke$5('ExtensionManagement.getAllExtensions');
|
|
1162
|
+
};
|
|
1163
|
+
const rerenderEditor = async key => {
|
|
1164
|
+
// @ts-ignore
|
|
1165
|
+
return invoke$5('Editor.rerender', key);
|
|
1166
|
+
};
|
|
1167
|
+
const handleDebugPaused = async params => {
|
|
1168
|
+
await invoke$5('Run And Debug.handlePaused', params);
|
|
1169
|
+
};
|
|
1170
|
+
const openUri = async (uri, focus, options) => {
|
|
1171
|
+
await invoke$5('Main.openUri', uri, focus, options);
|
|
1172
|
+
};
|
|
1173
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1174
|
+
await invokeAndTransfer$4(
|
|
1175
|
+
// @ts-ignore
|
|
1176
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
949
1177
|
};
|
|
1178
|
+
const handleDebugScriptParsed = async script => {
|
|
1179
|
+
await invoke$5('Run And Debug.handleScriptParsed', script);
|
|
1180
|
+
};
|
|
1181
|
+
const getWindowId = async () => {
|
|
1182
|
+
return invoke$5('GetWindowId.getWindowId');
|
|
1183
|
+
};
|
|
1184
|
+
const getBlob = async uri => {
|
|
1185
|
+
// @ts-ignore
|
|
1186
|
+
return invoke$5('FileSystem.getBlob', uri);
|
|
1187
|
+
};
|
|
1188
|
+
const getExtensionCommands = async () => {
|
|
1189
|
+
return invoke$5('ExtensionHost.getCommands');
|
|
1190
|
+
};
|
|
1191
|
+
const showErrorDialog = async errorInfo => {
|
|
1192
|
+
// @ts-ignore
|
|
1193
|
+
await invoke$5('ErrorHandling.showErrorDialog', errorInfo);
|
|
1194
|
+
};
|
|
1195
|
+
const getFolderSize = async uri => {
|
|
1196
|
+
// @ts-ignore
|
|
1197
|
+
return await invoke$5('FileSystem.getFolderSize', uri);
|
|
1198
|
+
};
|
|
1199
|
+
const getExtension = async id => {
|
|
1200
|
+
// @ts-ignore
|
|
1201
|
+
return invoke$5('ExtensionManagement.getExtension', id);
|
|
1202
|
+
};
|
|
1203
|
+
const getMarkdownDom = async html => {
|
|
1204
|
+
// @ts-ignore
|
|
1205
|
+
return invoke$5('Markdown.getVirtualDom', html);
|
|
1206
|
+
};
|
|
1207
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1208
|
+
// @ts-ignore
|
|
1209
|
+
return invoke$5('Markdown.renderMarkdown', markdown, options);
|
|
1210
|
+
};
|
|
1211
|
+
const openNativeFolder = async uri => {
|
|
1212
|
+
// @ts-ignore
|
|
1213
|
+
await invoke$5('OpenNativeFolder.openNativeFolder', uri);
|
|
1214
|
+
};
|
|
1215
|
+
const uninstallExtension = async id => {
|
|
1216
|
+
return invoke$5('ExtensionManagement.uninstall', id);
|
|
1217
|
+
};
|
|
1218
|
+
const installExtension = async id => {
|
|
1219
|
+
// @ts-ignore
|
|
1220
|
+
return invoke$5('ExtensionManagement.install', id);
|
|
1221
|
+
};
|
|
1222
|
+
const openExtensionSearch = async () => {
|
|
1223
|
+
// @ts-ignore
|
|
1224
|
+
return invoke$5('SideBar.openViewlet', 'Extensions');
|
|
1225
|
+
};
|
|
1226
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1227
|
+
// @ts-ignore
|
|
1228
|
+
return invoke$5('Extensions.handleInput', searchValue);
|
|
1229
|
+
};
|
|
1230
|
+
const openExternal = async uri => {
|
|
1231
|
+
// @ts-ignore
|
|
1232
|
+
await invoke$5('Open.openExternal', uri);
|
|
1233
|
+
};
|
|
1234
|
+
const openUrl = async uri => {
|
|
1235
|
+
// @ts-ignore
|
|
1236
|
+
await invoke$5('Open.openUrl', uri);
|
|
1237
|
+
};
|
|
1238
|
+
const getAllPreferences = async () => {
|
|
1239
|
+
// @ts-ignore
|
|
1240
|
+
return invoke$5('Preferences.getAll');
|
|
1241
|
+
};
|
|
1242
|
+
const showSaveFilePicker = async () => {
|
|
1243
|
+
// @ts-ignore
|
|
1244
|
+
return invoke$5('FilePicker.showSaveFilePicker');
|
|
1245
|
+
};
|
|
1246
|
+
const getLogsDir = async () => {
|
|
1247
|
+
// @ts-ignore
|
|
1248
|
+
return invoke$5('PlatformPaths.getLogsDir');
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
const RendererWorker = {
|
|
1252
|
+
__proto__: null,
|
|
1253
|
+
activateByEvent,
|
|
1254
|
+
applyBulkReplacement,
|
|
1255
|
+
closeWidget,
|
|
1256
|
+
confirm,
|
|
1257
|
+
disableExtension,
|
|
1258
|
+
dispose,
|
|
1259
|
+
enableExtension,
|
|
1260
|
+
getActiveEditorId,
|
|
1261
|
+
getAllExtensions,
|
|
1262
|
+
getAllPreferences,
|
|
1263
|
+
getBlob,
|
|
1264
|
+
getChromeVersion,
|
|
1265
|
+
getColorThemeNames,
|
|
1266
|
+
getElectronVersion,
|
|
1267
|
+
getExtension,
|
|
1268
|
+
getExtensionCommands,
|
|
1269
|
+
getFileHandles,
|
|
1270
|
+
getFileIcon,
|
|
1271
|
+
getFilePathElectron,
|
|
1272
|
+
getFolderIcon,
|
|
1273
|
+
getFolderSize,
|
|
1274
|
+
getIcons,
|
|
1275
|
+
getKeyBindings,
|
|
1276
|
+
getLogsDir,
|
|
1277
|
+
getMarkdownDom,
|
|
1278
|
+
getNodeVersion,
|
|
1279
|
+
getPreference,
|
|
1280
|
+
getRecentlyOpened,
|
|
1281
|
+
getV8Version,
|
|
1282
|
+
getWebViewSecret,
|
|
1283
|
+
getWindowId,
|
|
1284
|
+
getWorkspacePath,
|
|
1285
|
+
handleDebugChange,
|
|
1286
|
+
handleDebugPaused,
|
|
1287
|
+
handleDebugResumed,
|
|
1288
|
+
handleDebugScriptParsed,
|
|
1289
|
+
installExtension,
|
|
1290
|
+
invoke: invoke$5,
|
|
1291
|
+
invokeAndTransfer: invokeAndTransfer$4,
|
|
1292
|
+
openExtensionSearch,
|
|
1293
|
+
openExternal,
|
|
1294
|
+
openNativeFolder,
|
|
1295
|
+
openUri,
|
|
1296
|
+
openUrl,
|
|
1297
|
+
openWidget,
|
|
1298
|
+
readFile: readFile$1,
|
|
1299
|
+
registerWebViewInterceptor,
|
|
1300
|
+
renderMarkdown,
|
|
1301
|
+
rerenderEditor,
|
|
1302
|
+
searchFileFetch,
|
|
1303
|
+
searchFileHtml,
|
|
1304
|
+
searchFileMemory,
|
|
1305
|
+
sendMessagePortToEditorWorker,
|
|
1306
|
+
sendMessagePortToErrorWorker,
|
|
1307
|
+
sendMessagePortToExtensionHostWorker,
|
|
1308
|
+
sendMessagePortToFileSystemWorker,
|
|
1309
|
+
sendMessagePortToMarkdownWorker,
|
|
1310
|
+
sendMessagePortToRendererProcess,
|
|
1311
|
+
sendMessagePortToSearchProcess,
|
|
1312
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
1313
|
+
set: set$1,
|
|
1314
|
+
setAdditionalFocus,
|
|
1315
|
+
setColorTheme,
|
|
1316
|
+
setExtensionsSearchValue,
|
|
1317
|
+
setFocus,
|
|
1318
|
+
setWebViewPort,
|
|
1319
|
+
setWorkspacePath,
|
|
1320
|
+
showContextMenu,
|
|
1321
|
+
showErrorDialog,
|
|
1322
|
+
showMessageBox,
|
|
1323
|
+
showSaveFilePicker,
|
|
1324
|
+
uninstallExtension,
|
|
1325
|
+
unregisterWebViewInterceptor,
|
|
1326
|
+
writeClipBoardImage,
|
|
1327
|
+
writeClipBoardText
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
const {
|
|
1331
|
+
invoke: invoke$4,
|
|
1332
|
+
invokeAndTransfer: invokeAndTransfer$3
|
|
1333
|
+
} = RendererWorker;
|
|
950
1334
|
|
|
951
1335
|
const invoke$3 = async (method, ...params) => {
|
|
1336
|
+
// @ts-ignore
|
|
952
1337
|
return invoke$4('WebView.compatExtensionHostWorkerInvoke', method, ...params);
|
|
953
1338
|
};
|
|
954
1339
|
const invokeAndTransfer$2 = async (method, ...params) => {
|
|
1340
|
+
// @ts-ignore
|
|
955
1341
|
return invokeAndTransfer$3('WebView.compatExtensionHostWorkerInvokeAndTransfer', method, ...params);
|
|
956
1342
|
};
|
|
957
1343
|
|
|
@@ -1011,19 +1397,18 @@ const getWebViewHtml = (baseUrl, locationOrigin, elements, assetDir) => {
|
|
|
1011
1397
|
if (!elements) {
|
|
1012
1398
|
return '';
|
|
1013
1399
|
}
|
|
1014
|
-
const middle = [];
|
|
1015
|
-
middle.push('<meta charset="utf-8">');
|
|
1400
|
+
const middle = ['<meta charset="utf-8">'];
|
|
1016
1401
|
for (const element of elements) {
|
|
1017
1402
|
switch (element.type) {
|
|
1018
|
-
case '
|
|
1019
|
-
middle.push(`<
|
|
1403
|
+
case 'css':
|
|
1404
|
+
middle.push(`<link rel="stylesheet" href="${locationOrigin}${baseUrl}/${element.path}" />`);
|
|
1020
1405
|
break;
|
|
1021
1406
|
case 'script':
|
|
1022
1407
|
middle.push(`<script type="module" src="${locationOrigin}${assetDir}/js/preview-injected.js"></script>`);
|
|
1023
1408
|
middle.push(`<script type="module" src="${locationOrigin}${baseUrl}/${element.path}"></script>`);
|
|
1024
1409
|
break;
|
|
1025
|
-
case '
|
|
1026
|
-
middle.push(`<
|
|
1410
|
+
case 'title':
|
|
1411
|
+
middle.push(`<title>${element.value}</title>`);
|
|
1027
1412
|
break;
|
|
1028
1413
|
}
|
|
1029
1414
|
}
|
|
@@ -1083,9 +1468,9 @@ const getIframeSrcRemote = (webViews, webViewPort, webViewId, locationProtocol,
|
|
|
1083
1468
|
// - load webviews the same as in web using blob urls
|
|
1084
1469
|
// - load webviews from a pattern like /webviews/:id/:fileName
|
|
1085
1470
|
return {
|
|
1471
|
+
iframeContent,
|
|
1086
1472
|
iframeSrc,
|
|
1087
|
-
webViewRoot
|
|
1088
|
-
iframeContent
|
|
1473
|
+
webViewRoot
|
|
1089
1474
|
};
|
|
1090
1475
|
};
|
|
1091
1476
|
|
|
@@ -1099,8 +1484,8 @@ const getBlobUrl = (content, contentType) => {
|
|
|
1099
1484
|
|
|
1100
1485
|
const getDefaultBaseUrl = webView => {
|
|
1101
1486
|
const {
|
|
1102
|
-
|
|
1103
|
-
|
|
1487
|
+
path,
|
|
1488
|
+
remotePath
|
|
1104
1489
|
} = webView;
|
|
1105
1490
|
if (remotePath) {
|
|
1106
1491
|
if (remotePath.endsWith('/index.html')) {
|
|
@@ -1131,9 +1516,9 @@ const getIframeSrc$1 = (webView, locationOrigin, assetDir) => {
|
|
|
1131
1516
|
if (srcHtml) {
|
|
1132
1517
|
const blobUrl = getBlobUrl(srcHtml, 'text/html');
|
|
1133
1518
|
return {
|
|
1519
|
+
iframeContent: '',
|
|
1134
1520
|
iframeSrc: blobUrl,
|
|
1135
|
-
webViewRoot: ''
|
|
1136
|
-
iframeContent: ''
|
|
1521
|
+
webViewRoot: ''
|
|
1137
1522
|
};
|
|
1138
1523
|
}
|
|
1139
1524
|
return undefined;
|
|
@@ -1163,6 +1548,7 @@ const getPortTuple = () => {
|
|
|
1163
1548
|
};
|
|
1164
1549
|
|
|
1165
1550
|
const getSavedState = async () => {
|
|
1551
|
+
// @ts-ignore
|
|
1166
1552
|
return invoke$4('WebView.getSavedState');
|
|
1167
1553
|
};
|
|
1168
1554
|
|
|
@@ -1232,6 +1618,7 @@ const getIframePermissionPolicy = webView => {
|
|
|
1232
1618
|
};
|
|
1233
1619
|
|
|
1234
1620
|
const getWebViews = async () => {
|
|
1621
|
+
// @ts-ignore
|
|
1235
1622
|
return invoke$4('WebView.getWebViews');
|
|
1236
1623
|
};
|
|
1237
1624
|
|
|
@@ -1281,20 +1668,22 @@ const getPort = () => {
|
|
|
1281
1668
|
};
|
|
1282
1669
|
|
|
1283
1670
|
const invoke$2 = async (method, ...params) => {
|
|
1671
|
+
// @ts-ignore
|
|
1284
1672
|
return invoke$4('WebView.compatRendererProcessInvoke', method, ...params);
|
|
1285
1673
|
};
|
|
1286
1674
|
const invokeAndTransfer$1 = async (method, ...params) => {
|
|
1675
|
+
// @ts-ignore
|
|
1287
1676
|
return invokeAndTransfer$3('WebView.compatRendererProcessInvokeAndTransfer', method, ...params);
|
|
1288
1677
|
};
|
|
1289
1678
|
|
|
1290
1679
|
const WebView = 'lvce-oss-webview';
|
|
1291
1680
|
|
|
1292
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1293
1681
|
const setPort = async (uid, port, origin, portType) => {
|
|
1294
1682
|
await invokeAndTransfer$1('WebView.setPort', uid, port, origin, portType);
|
|
1295
1683
|
};
|
|
1296
1684
|
|
|
1297
1685
|
const invoke$1 = async (method, ...params) => {
|
|
1686
|
+
// @ts-ignore
|
|
1298
1687
|
return invoke$4('WebView.compatSharedProcessInvoke', method, ...params);
|
|
1299
1688
|
};
|
|
1300
1689
|
|
|
@@ -1338,11 +1727,11 @@ const register$2 = async (previewServerId, webViewPort, frameAncestors, webViewR
|
|
|
1338
1727
|
await create(previewServerId, useNewWebViewHandler); // TODO move this up
|
|
1339
1728
|
await start(previewServerId, webViewPort); // TODO move this up
|
|
1340
1729
|
await (useNewWebViewHandler ? setInfo2({
|
|
1341
|
-
webViewRoot,
|
|
1342
|
-
webViewId,
|
|
1343
1730
|
contentSecurityPolicy: csp,
|
|
1344
1731
|
iframeContent,
|
|
1345
|
-
remotePathPrefix
|
|
1732
|
+
remotePathPrefix,
|
|
1733
|
+
webViewId,
|
|
1734
|
+
webViewRoot
|
|
1346
1735
|
}) : setHandler(previewServerId, frameAncestors, webViewRoot, csp, iframeContent));
|
|
1347
1736
|
// TODO make this work in gitpod also
|
|
1348
1737
|
};
|
|
@@ -1353,10 +1742,10 @@ const register$1 = async () => {
|
|
|
1353
1742
|
|
|
1354
1743
|
const getModule = platform => {
|
|
1355
1744
|
switch (platform) {
|
|
1356
|
-
case Remote:
|
|
1357
|
-
return register$2;
|
|
1358
1745
|
case Electron:
|
|
1359
1746
|
return register$3;
|
|
1747
|
+
case Remote:
|
|
1748
|
+
return register$2;
|
|
1360
1749
|
default:
|
|
1361
1750
|
return register$1;
|
|
1362
1751
|
}
|
|
@@ -1368,14 +1757,14 @@ const register = async (previewServerId, webViewPort, frameAncestors, webViewRoo
|
|
|
1368
1757
|
};
|
|
1369
1758
|
|
|
1370
1759
|
const create2 = async ({
|
|
1760
|
+
assetDir = '',
|
|
1371
1761
|
id,
|
|
1372
|
-
|
|
1373
|
-
|
|
1762
|
+
isGitpod,
|
|
1763
|
+
platform,
|
|
1374
1764
|
previewServerId,
|
|
1375
1765
|
uri,
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
assetDir = '',
|
|
1766
|
+
webViewId,
|
|
1767
|
+
webViewPort,
|
|
1379
1768
|
webViewScheme = WebView
|
|
1380
1769
|
}) => {
|
|
1381
1770
|
let root = '';
|
|
@@ -1394,9 +1783,9 @@ const create2 = async ({
|
|
|
1394
1783
|
|
|
1395
1784
|
// TODO move all of this to iframe worker
|
|
1396
1785
|
const {
|
|
1786
|
+
iframeContent,
|
|
1397
1787
|
iframeSrc,
|
|
1398
|
-
webViewRoot
|
|
1399
|
-
iframeContent
|
|
1788
|
+
webViewRoot
|
|
1400
1789
|
} = iframeResult;
|
|
1401
1790
|
const frameAncestors = getWebViewFrameAncestors(locationProtocol, locationHost);
|
|
1402
1791
|
const frameTitle = getWebViewTitle(webView);
|
|
@@ -1433,11 +1822,11 @@ const create2 = async ({
|
|
|
1433
1822
|
const savedState = await getSavedWebViewState(webViewId);
|
|
1434
1823
|
await invoke$3('ExtensionHostWebView.load', webViewId, savedState);
|
|
1435
1824
|
return {
|
|
1825
|
+
csp: iframeCsp,
|
|
1436
1826
|
iframeSrc,
|
|
1437
|
-
sandbox,
|
|
1438
|
-
portId,
|
|
1439
1827
|
origin,
|
|
1440
|
-
|
|
1828
|
+
portId,
|
|
1829
|
+
sandbox
|
|
1441
1830
|
};
|
|
1442
1831
|
};
|
|
1443
1832
|
|
|
@@ -1451,13 +1840,14 @@ const createAndLoadWebView = async (id, iframeSrc, sandbox, iframeCsp, credentia
|
|
|
1451
1840
|
};
|
|
1452
1841
|
|
|
1453
1842
|
const invoke = async (method, ...params) => {
|
|
1843
|
+
// @ts-ignore
|
|
1454
1844
|
return invoke$4('WebView.compatRendererWorkerInvoke', method, ...params);
|
|
1455
1845
|
};
|
|
1456
1846
|
const invokeAndTransfer = async (method, ...params) => {
|
|
1847
|
+
// @ts-ignore
|
|
1457
1848
|
return invokeAndTransfer$3('WebView.compatRendererWorkerInvokeAndTransfer', method, ...params);
|
|
1458
1849
|
};
|
|
1459
1850
|
|
|
1460
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1461
1851
|
const createSecondaryWebViewConnection = async (uid, origin, port) => {
|
|
1462
1852
|
const portType = 'application';
|
|
1463
1853
|
await invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
@@ -1469,9 +1859,9 @@ const createWebViewConnection = async (uid, origin) => {
|
|
|
1469
1859
|
port2
|
|
1470
1860
|
} = getPortTuple();
|
|
1471
1861
|
const rpcPromise = MessagePortRpcParent.create({
|
|
1472
|
-
|
|
1862
|
+
commandMap: {},
|
|
1473
1863
|
isMessagePortOpen: false,
|
|
1474
|
-
|
|
1864
|
+
messagePort: port2
|
|
1475
1865
|
});
|
|
1476
1866
|
const portType = 'test';
|
|
1477
1867
|
await invokeAndTransfer('WebView.setPort', uid, port1, origin, portType);
|
|
@@ -1580,8 +1970,8 @@ const getWebViewWorkerRpc2 = async rpcInfo => {
|
|
|
1580
1970
|
} = getPortTuple();
|
|
1581
1971
|
const rpcPromise = MessagePortRpcParent.create({
|
|
1582
1972
|
commandMap: commandMap$1,
|
|
1583
|
-
|
|
1584
|
-
|
|
1973
|
+
isMessagePortOpen: true,
|
|
1974
|
+
messagePort: port2
|
|
1585
1975
|
});
|
|
1586
1976
|
// TODO
|
|
1587
1977
|
// 1. ask extension host worker to ask renderer worker to ask renderer process to create a worker with given url
|
|
@@ -1608,8 +1998,6 @@ const getWebViewWorkerRpc2 = async rpcInfo => {
|
|
|
1608
1998
|
// compared to direct connections
|
|
1609
1999
|
|
|
1610
2000
|
const interceptors = Object.create(null);
|
|
1611
|
-
|
|
1612
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1613
2001
|
const add = (id, port) => {
|
|
1614
2002
|
interceptors[id] = port;
|
|
1615
2003
|
};
|
|
@@ -1638,7 +2026,6 @@ const notifyInterceptors = message => {
|
|
|
1638
2026
|
}
|
|
1639
2027
|
};
|
|
1640
2028
|
|
|
1641
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1642
2029
|
const proxyPorts = (port1, port2) => {
|
|
1643
2030
|
port1.addEventListener('message', event => {
|
|
1644
2031
|
port2.postMessage(event.data);
|
|
@@ -1651,11 +2038,11 @@ const proxyPorts = (port1, port2) => {
|
|
|
1651
2038
|
const createWebWorkerRpc2 = async (rpcInfo, webView, savedState, uri, portId, webViewUid, origin) => {
|
|
1652
2039
|
const rpc = await getWebViewWorkerRpc2(rpcInfo);
|
|
1653
2040
|
const webViewInfo = {
|
|
2041
|
+
origin,
|
|
2042
|
+
portId: portId,
|
|
1654
2043
|
rpc,
|
|
1655
2044
|
webViewId: webView.id,
|
|
1656
|
-
|
|
1657
|
-
webViewUid,
|
|
1658
|
-
origin
|
|
2045
|
+
webViewUid
|
|
1659
2046
|
};
|
|
1660
2047
|
set(portId, webViewInfo);
|
|
1661
2048
|
|
|
@@ -1685,8 +2072,8 @@ const createWebWorkerRpc2 = async (rpcInfo, webView, savedState, uri, portId, we
|
|
|
1685
2072
|
await rpc.invoke('_WebView.create', {
|
|
1686
2073
|
id: portId,
|
|
1687
2074
|
savedState,
|
|
1688
|
-
|
|
1689
|
-
|
|
2075
|
+
uri,
|
|
2076
|
+
webViewId: webView.id
|
|
1690
2077
|
});
|
|
1691
2078
|
};
|
|
1692
2079
|
|
|
@@ -1700,8 +2087,8 @@ const getWebViewWorkerRpc = async rpcInfo => {
|
|
|
1700
2087
|
} = getPortTuple();
|
|
1701
2088
|
const rpcPromise = MessagePortRpcParent.create({
|
|
1702
2089
|
commandMap: commandMap$1,
|
|
1703
|
-
|
|
1704
|
-
|
|
2090
|
+
isMessagePortOpen: true,
|
|
2091
|
+
messagePort: port2
|
|
1705
2092
|
});
|
|
1706
2093
|
await invokeAndTransfer$2('WebView.createWebViewWorkerRpc', rpcInfo, port1);
|
|
1707
2094
|
const rpc = await rpcPromise;
|
|
@@ -1715,11 +2102,11 @@ const createWebViewRpc$1 = async (rpcInfo, webView, savedState, uri, portId, web
|
|
|
1715
2102
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1716
2103
|
const rpc = await getWebViewWorkerRpc(rpcInfo);
|
|
1717
2104
|
const webViewInfo = {
|
|
2105
|
+
origin,
|
|
2106
|
+
portId: portId,
|
|
1718
2107
|
rpc,
|
|
1719
2108
|
webViewId: webView.id,
|
|
1720
|
-
|
|
1721
|
-
webViewUid,
|
|
1722
|
-
origin
|
|
2109
|
+
webViewUid
|
|
1723
2110
|
};
|
|
1724
2111
|
set(portId, webViewInfo);
|
|
1725
2112
|
await rpc.invoke('LoadFile.loadFile', rpcInfo.url);
|
|
@@ -1735,8 +2122,8 @@ const createWebViewRpc$1 = async (rpcInfo, webView, savedState, uri, portId, web
|
|
|
1735
2122
|
await rpc.invoke('_WebView.create', {
|
|
1736
2123
|
id: portId,
|
|
1737
2124
|
savedState,
|
|
1738
|
-
|
|
1739
|
-
|
|
2125
|
+
uri,
|
|
2126
|
+
webViewId: webView.id
|
|
1740
2127
|
});
|
|
1741
2128
|
};
|
|
1742
2129
|
|
|
@@ -1784,13 +2171,13 @@ const getWebViewPort = (platform, locationPort) => {
|
|
|
1784
2171
|
};
|
|
1785
2172
|
|
|
1786
2173
|
const create3 = async ({
|
|
2174
|
+
assetDir,
|
|
1787
2175
|
id,
|
|
1788
|
-
uri,
|
|
1789
2176
|
isGitpod,
|
|
1790
2177
|
platform,
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
2178
|
+
uri,
|
|
2179
|
+
useNewWebViewHandler,
|
|
2180
|
+
webViewScheme
|
|
1794
2181
|
}) => {
|
|
1795
2182
|
setPlatform(platform);
|
|
1796
2183
|
let root = '';
|
|
@@ -1811,9 +2198,9 @@ const create3 = async ({
|
|
|
1811
2198
|
}
|
|
1812
2199
|
const webView = getWebView(webViews, webViewId);
|
|
1813
2200
|
const {
|
|
2201
|
+
iframeContent,
|
|
1814
2202
|
iframeSrc,
|
|
1815
|
-
webViewRoot
|
|
1816
|
-
iframeContent
|
|
2203
|
+
webViewRoot
|
|
1817
2204
|
} = iframeResult;
|
|
1818
2205
|
const frameAncestors = getWebViewFrameAncestors(locationProtocol, locationHost);
|
|
1819
2206
|
const frameTitle = getWebViewTitle(webView);
|
|
@@ -1853,15 +2240,16 @@ const create3 = async ({
|
|
|
1853
2240
|
}
|
|
1854
2241
|
await createWebViewRpc(webView, savedState, uri, portId, id, origin);
|
|
1855
2242
|
return {
|
|
2243
|
+
csp: iframeCsp,
|
|
1856
2244
|
iframeSrc,
|
|
1857
|
-
sandbox,
|
|
1858
|
-
portId,
|
|
1859
2245
|
origin,
|
|
1860
|
-
|
|
2246
|
+
portId,
|
|
2247
|
+
sandbox
|
|
1861
2248
|
};
|
|
1862
2249
|
};
|
|
1863
2250
|
|
|
1864
2251
|
const executeCommand = (method, ...params) => {
|
|
2252
|
+
// @ts-ignore
|
|
1865
2253
|
return invoke$4('ExecuteExternalCommand.executeExternalCommand', method, ...params);
|
|
1866
2254
|
};
|
|
1867
2255
|
|
|
@@ -1874,8 +2262,8 @@ const getWebViewInfo = webViewId => {
|
|
|
1874
2262
|
for (const value of Object.values(rpcs)) {
|
|
1875
2263
|
if (value.webViewId === webViewId) {
|
|
1876
2264
|
return {
|
|
1877
|
-
|
|
1878
|
-
|
|
2265
|
+
origin: value.origin,
|
|
2266
|
+
uid: value.webViewUid
|
|
1879
2267
|
};
|
|
1880
2268
|
}
|
|
1881
2269
|
}
|
|
@@ -1900,7 +2288,6 @@ const saveState = async () => {
|
|
|
1900
2288
|
return serialized;
|
|
1901
2289
|
};
|
|
1902
2290
|
|
|
1903
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1904
2291
|
const registerInterceptor = async (id, port) => {
|
|
1905
2292
|
add(id, port);
|
|
1906
2293
|
};
|
|
@@ -1911,19 +2298,19 @@ const unregisterInterceptor = async id => {
|
|
|
1911
2298
|
const commandMap = {
|
|
1912
2299
|
'WebView.create2': create2,
|
|
1913
2300
|
'WebView.create3': create3,
|
|
1914
|
-
'WebView.
|
|
2301
|
+
'WebView.executeExternalCommand': executeCommand,
|
|
1915
2302
|
'WebView.getSecret': getSecret,
|
|
1916
2303
|
'WebView.getWebViewInfo': getWebViewInfo,
|
|
1917
2304
|
'WebView.registerInterceptor': registerInterceptor,
|
|
1918
|
-
'WebView.
|
|
1919
|
-
'WebView.
|
|
2305
|
+
'WebView.saveState': saveState,
|
|
2306
|
+
'WebView.unregisterInterceptor': unregisterInterceptor
|
|
1920
2307
|
};
|
|
1921
2308
|
|
|
1922
2309
|
const listen = async () => {
|
|
1923
2310
|
const rpc = await WebWorkerRpcClient.create({
|
|
1924
2311
|
commandMap: commandMap
|
|
1925
2312
|
});
|
|
1926
|
-
set$1(
|
|
2313
|
+
set$1(rpc);
|
|
1927
2314
|
};
|
|
1928
2315
|
|
|
1929
2316
|
const main = async () => {
|