@lvce-editor/extension-management-worker 4.39.0 → 4.40.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.
|
@@ -2406,6 +2406,10 @@ const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
|
|
|
2406
2406
|
|
|
2407
2407
|
// TODO have a way so that the worker already includes the webview api and the extension
|
|
2408
2408
|
// host sub-worker doesn't need to import the other file
|
|
2409
|
+
if (rpcInfo.contentSecurityPolicy) {
|
|
2410
|
+
const pathName = new URL(rpcInfo.url, 'http://localhost').pathname;
|
|
2411
|
+
await invoke('ExtensionHostWorkerContentSecurityPolicy.set', pathName, rpcInfo.contentSecurityPolicy);
|
|
2412
|
+
}
|
|
2409
2413
|
await invokeAndTransfer('IpcParent.create', {
|
|
2410
2414
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
2411
2415
|
name: rpcInfo.name,
|
|
@@ -3118,9 +3122,18 @@ const getRpcForInstance = async (viewId, uid, assetDir, platform) => {
|
|
|
3118
3122
|
}
|
|
3119
3123
|
return getRpcForView(viewId, assetDir, platform);
|
|
3120
3124
|
};
|
|
3125
|
+
const getViewEventListeners = async (rpc, viewId) => {
|
|
3126
|
+
const snapshot = await rpc.invoke('ExtensionApi.getViewRegistrySnapshot');
|
|
3127
|
+
if (!Array.isArray(snapshot?.views)) {
|
|
3128
|
+
return undefined;
|
|
3129
|
+
}
|
|
3130
|
+
const view = snapshot.views.find(view => view?.id === viewId);
|
|
3131
|
+
return Array.isArray(view?.eventListeners) ? view.eventListeners : undefined;
|
|
3132
|
+
};
|
|
3121
3133
|
const createViewInstance = async (viewId, uid, context, assetDir, platform) => {
|
|
3122
3134
|
try {
|
|
3123
3135
|
const rpc = await getRpcForView(viewId, assetDir, platform);
|
|
3136
|
+
const eventListeners = await getViewEventListeners(rpc, viewId);
|
|
3124
3137
|
const result = await rpc.invoke('ExtensionApi.createViewInstance', viewId, uid, context);
|
|
3125
3138
|
set$1(uid, {
|
|
3126
3139
|
rpc,
|
|
@@ -3128,6 +3141,9 @@ const createViewInstance = async (viewId, uid, context, assetDir, platform) => {
|
|
|
3128
3141
|
viewId
|
|
3129
3142
|
});
|
|
3130
3143
|
return {
|
|
3144
|
+
...(eventListeners && {
|
|
3145
|
+
eventListeners
|
|
3146
|
+
}),
|
|
3131
3147
|
ok: true,
|
|
3132
3148
|
result
|
|
3133
3149
|
};
|