@lvce-editor/iframe-worker 5.2.0 → 5.4.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 +13 -12
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -960,7 +960,7 @@ const getIframeSrcRemote = (webViews, webViewPort, webViewId, locationProtocol,
|
|
|
960
960
|
// TODO when running in remote, try scope webviews by path or if possible by domain
|
|
961
961
|
if (platform$1 === Electron) {
|
|
962
962
|
const webViewId = webView.id;
|
|
963
|
-
iframeSrc = `${webViewScheme}://${webViewId}
|
|
963
|
+
iframeSrc = `${webViewScheme}://${webViewId}`;
|
|
964
964
|
} else if (platform$1 === Remote) {
|
|
965
965
|
webViewRoot = webView.uri;
|
|
966
966
|
iframeSrc = createLocalHostUrl(locationProtocol, locationHost, isGitpod, webViewPort);
|
|
@@ -1004,6 +1004,7 @@ const getDefaultBaseUrl = webView => {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
return '';
|
|
1006
1006
|
};
|
|
1007
|
+
|
|
1007
1008
|
const getWebViewBaseUrl = (webView, locationOrigin) => {
|
|
1008
1009
|
const defaultBaseUrl = getDefaultBaseUrl(webView);
|
|
1009
1010
|
if (defaultBaseUrl.startsWith(locationOrigin)) {
|
|
@@ -1094,17 +1095,17 @@ const getWebViewFrameAncestors = (locationProtocol, locationHost) => {
|
|
|
1094
1095
|
return frameAncestors;
|
|
1095
1096
|
};
|
|
1096
1097
|
|
|
1097
|
-
const getWebViewOrigin = (webViewPort, platform, webViewScheme) => {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1098
|
+
const getWebViewOrigin = (webViewPort, platform, webViewScheme, webViewId) => {
|
|
1099
|
+
switch (platform) {
|
|
1100
|
+
case Electron:
|
|
1101
|
+
return `${webViewScheme}://${webViewId}`;
|
|
1102
|
+
case Remote:
|
|
1103
|
+
// TODO support gitpod / codespaces
|
|
1104
|
+
return `http://localhost:${webViewPort}`;
|
|
1105
|
+
default:
|
|
1106
|
+
// TODO
|
|
1107
|
+
return '*';
|
|
1106
1108
|
}
|
|
1107
|
-
return origin;
|
|
1108
1109
|
};
|
|
1109
1110
|
|
|
1110
1111
|
const getIframePermissionPolicy = webView => {
|
|
@@ -1291,7 +1292,7 @@ const create2 = async ({
|
|
|
1291
1292
|
await register(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent, platform, webViewId);
|
|
1292
1293
|
await invoke$1('WebView.create', id, iframeSrc, sandbox, iframeCsp, credentialless, permissionPolicyString, frameTitle);
|
|
1293
1294
|
await invoke$1('WebView.load', id);
|
|
1294
|
-
const origin = getWebViewOrigin(webViewPort, platform, webViewScheme);
|
|
1295
|
+
const origin = getWebViewOrigin(webViewPort, platform, webViewScheme, webViewId);
|
|
1295
1296
|
const portType = '';
|
|
1296
1297
|
await setPort(id, port1, origin, portType);
|
|
1297
1298
|
await invokeAndTransfer$1('ExtensionHostWebView.create', webViewId, port2, uri, id, origin);
|