@lvce-editor/iframe-worker 5.2.0 → 5.3.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.
@@ -1094,17 +1094,17 @@ const getWebViewFrameAncestors = (locationProtocol, locationHost) => {
1094
1094
  return frameAncestors;
1095
1095
  };
1096
1096
 
1097
- const getWebViewOrigin = (webViewPort, platform, webViewScheme) => {
1098
- // TODO don't hardcode protocol
1099
- let origin = '';
1100
- if (platform === Electron) {
1101
- origin = `${webViewScheme}://-/`;
1102
- } else if (platform === Remote) {
1103
- origin = `http://localhost:${webViewPort}`;
1104
- } else {
1105
- origin = '*'; // TODO
1097
+ const getWebViewOrigin = (webViewPort, platform, webViewScheme, webViewId) => {
1098
+ switch (platform) {
1099
+ case Electron:
1100
+ return `${webViewScheme}://${webViewId}`;
1101
+ case Remote:
1102
+ // TODO support gitpod / codespaces
1103
+ return `http://localhost:${webViewPort}`;
1104
+ default:
1105
+ // TODO
1106
+ return '*';
1106
1107
  }
1107
- return origin;
1108
1108
  };
1109
1109
 
1110
1110
  const getIframePermissionPolicy = webView => {
@@ -1291,7 +1291,7 @@ const create2 = async ({
1291
1291
  await register(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent, platform, webViewId);
1292
1292
  await invoke$1('WebView.create', id, iframeSrc, sandbox, iframeCsp, credentialless, permissionPolicyString, frameTitle);
1293
1293
  await invoke$1('WebView.load', id);
1294
- const origin = getWebViewOrigin(webViewPort, platform, webViewScheme);
1294
+ const origin = getWebViewOrigin(webViewPort, platform, webViewScheme, webViewId);
1295
1295
  const portType = '';
1296
1296
  await setPort(id, port1, origin, portType);
1297
1297
  await invokeAndTransfer$1('ExtensionHostWebView.create', webViewId, port2, uri, id, origin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/iframe-worker",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Web Worker to manage creation and lifecycle of iframes in Lvce Editor",
5
5
  "main": "dist/iframeWorkerMain.js",
6
6
  "type": "module",