@lvce-editor/iframe-worker 2.3.0 → 3.0.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 +8 -38
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -1094,11 +1094,8 @@ const getPortTuple = () => {
|
|
|
1094
1094
|
};
|
|
1095
1095
|
};
|
|
1096
1096
|
|
|
1097
|
-
const getJson = async () => {};
|
|
1098
|
-
|
|
1099
1097
|
const getSavedState = async () => {
|
|
1100
|
-
|
|
1101
|
-
return value;
|
|
1098
|
+
return invoke$3('WebView.getSavedState');
|
|
1102
1099
|
};
|
|
1103
1100
|
|
|
1104
1101
|
const getSavedWebViewState = async id => {
|
|
@@ -1141,7 +1138,7 @@ const getWebViewFrameAncestors = (locationProtocol, locationHost) => {
|
|
|
1141
1138
|
return frameAncestors;
|
|
1142
1139
|
};
|
|
1143
1140
|
|
|
1144
|
-
const getWebViewOrigin = webViewPort => {
|
|
1141
|
+
const getWebViewOrigin = (webViewPort, platform) => {
|
|
1145
1142
|
// TODO don't hardcode protocol
|
|
1146
1143
|
let origin = '';
|
|
1147
1144
|
if (platform === Electron) {
|
|
@@ -1222,11 +1219,6 @@ const register$3 = async previewServerId => {
|
|
|
1222
1219
|
await create(previewServerId); // TODO move this up
|
|
1223
1220
|
};
|
|
1224
1221
|
|
|
1225
|
-
const WebViewProtocolElectron = {
|
|
1226
|
-
__proto__: null,
|
|
1227
|
-
register: register$3
|
|
1228
|
-
};
|
|
1229
|
-
|
|
1230
1222
|
const register$2 = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent) => {
|
|
1231
1223
|
// TODO apply something similar for electron
|
|
1232
1224
|
// TODO pass webview root, so that only these resources can be accessed
|
|
@@ -1238,34 +1230,24 @@ const register$2 = async (previewServerId, webViewPort, frameAncestors, webViewR
|
|
|
1238
1230
|
// TODO make this work in gitpod also
|
|
1239
1231
|
};
|
|
1240
1232
|
|
|
1241
|
-
const WebViewProtocolRemote = {
|
|
1242
|
-
__proto__: null,
|
|
1243
|
-
register: register$2
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
1233
|
const register$1 = async () => {
|
|
1247
1234
|
// noop
|
|
1248
1235
|
};
|
|
1249
1236
|
|
|
1250
|
-
const WebViewProtocolWeb = {
|
|
1251
|
-
__proto__: null,
|
|
1252
|
-
register: register$1
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
1237
|
const getModule = platform => {
|
|
1256
1238
|
switch (platform) {
|
|
1257
1239
|
case Remote:
|
|
1258
|
-
return
|
|
1240
|
+
return register$2;
|
|
1259
1241
|
case Electron:
|
|
1260
|
-
return
|
|
1242
|
+
return register$3;
|
|
1261
1243
|
case Web:
|
|
1262
1244
|
default:
|
|
1263
|
-
return
|
|
1245
|
+
return register$1;
|
|
1264
1246
|
}
|
|
1265
1247
|
};
|
|
1266
1248
|
const register = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent) => {
|
|
1267
|
-
const
|
|
1268
|
-
return
|
|
1249
|
+
const fn = getModule(platform);
|
|
1250
|
+
return fn(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent);
|
|
1269
1251
|
};
|
|
1270
1252
|
|
|
1271
1253
|
const create2 = async ({
|
|
@@ -1319,7 +1301,7 @@ const create2 = async ({
|
|
|
1319
1301
|
await register(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent);
|
|
1320
1302
|
await invoke$1('WebView.create', id, iframeSrc, sandbox, iframeCsp, credentialless);
|
|
1321
1303
|
await invoke$1('WebView.load', id);
|
|
1322
|
-
const origin = getWebViewOrigin(webViewPort);
|
|
1304
|
+
const origin = getWebViewOrigin(webViewPort, platform);
|
|
1323
1305
|
const portType = '';
|
|
1324
1306
|
await setPort(id, port1, origin, portType);
|
|
1325
1307
|
await invokeAndTransfer$1('ExtensionHostWebView.create', webViewId, port2, uri, id, origin);
|
|
@@ -1336,18 +1318,6 @@ const create2 = async ({
|
|
|
1336
1318
|
};
|
|
1337
1319
|
|
|
1338
1320
|
const commandMap = {
|
|
1339
|
-
// deprecated
|
|
1340
|
-
'Location.getHost': getHost,
|
|
1341
|
-
'Location.getOrigin': getOrigin,
|
|
1342
|
-
'Location.getProtocol': getProtocol,
|
|
1343
|
-
'WebView.getBaseUrl': getWebViewBaseUrl,
|
|
1344
|
-
'WebView.getFrameAncestors': getWebViewFrameAncestors,
|
|
1345
|
-
'WebView.getHtml': getWebViewHtml,
|
|
1346
|
-
'WebView.getIframeSrc': getIframeSrc,
|
|
1347
|
-
'WebView.getOrigin': getWebViewOrigin,
|
|
1348
|
-
'WebView.getSandbox': getIframeSandbox,
|
|
1349
|
-
'WebView.getWebViewCsp': getWebViewCsp,
|
|
1350
|
-
// new
|
|
1351
1321
|
'WebView.create2': create2
|
|
1352
1322
|
};
|
|
1353
1323
|
|