@@ -46,6 +46,7 @@ const SES_BUNDLE = readFileSync(require.resolve('ses'), 'utf-8');
4646 * @property {string } entry - The entry point file.
4747 * @property {boolean } [inline] - Whether to inline the lockdown script.
4848 * @property {boolean } [inlineBundle] - Whether to inline the bundle.
49+ * @property {boolean } [scuttleGlobalThis] - Whether to enable scuttling.
4950 * @property {import('webpack').Configuration } [config] - Additional webpack
5051 * configuration for this entry point. This is merged with the base
5152 * configuration.
@@ -79,6 +80,7 @@ const ENTRY_POINTS = [
7980 {
8081 name : 'iframe' ,
8182 entry : './src/iframe/index.ts' ,
83+ scuttleGlobalThis : true ,
8284
8385 config : DEFAULT_WEB_CONFIG ,
8486 } ,
@@ -108,6 +110,7 @@ const ENTRY_POINTS = [
108110 target : 'web' ,
109111 entry : './src/webview/index.ts' ,
110112 inlineBundle : true ,
113+ scuttleGlobalThis : true ,
111114
112115 config : {
113116 plugins : [
@@ -140,6 +143,7 @@ const ENTRY_POINTS = [
140143 {
141144 name : 'worker-pool' ,
142145 entry : './src/webworker/pool/index.ts' ,
146+ scuttleGlobalThis : true ,
143147
144148 config : DEFAULT_WEB_CONFIG ,
145149 } ,
@@ -231,6 +235,17 @@ const configs = ENTRY_POINTS.map(
231235 generatePolicy : UPDATE_POLICY ,
232236 policyLocation : resolve ( __dirname , 'lavamoat' , 'webpack' , name ) ,
233237 inlineLockdown : inline ? / b u n d l e \. j s / u : undefined ,
238+ scuttleGlobalThis : {
239+ enabled : true ,
240+ exceptions : [
241+ 'postMessage' ,
242+ 'removeEventListener' ,
243+ 'isSecureContext' ,
244+ 'ReactNativeWebView' ,
245+ 'JSON' ,
246+ 'String' ,
247+ ] ,
248+ } ,
234249 } ) ,
235250
236251 {
0 commit comments