@@ -17,7 +17,12 @@ export default class WindowsPermissionUsage extends ContentFeature {
1717 Paused : 'paused' ,
1818 } ;
1919
20- const isFrameInsideFrame = window . self !== window . top && window . parent !== window . top ;
20+ // isDdgWebView is a Windows-specific property injected via userPreferences
21+ const isDdgWebView = this . args ?. isDdgWebView ;
22+
23+ const isFrameInsideFrameInWebView2 = isDdgWebView
24+ ? false // In DDG WebView, we can handle nested frames properly
25+ : window . self !== window . top && window . parent !== window . top ; // In WebView2, we need to deny permission for nested frames
2126
2227 function windowsPostMessage ( name , data ) {
2328 // @ts -expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
@@ -38,8 +43,8 @@ export default class WindowsPermissionUsage extends ContentFeature {
3843 // proxy for navigator.geolocation.watchPosition -> show red geolocation indicator
3944 const watchPositionProxy = new DDGProxy ( this , Geolocation . prototype , 'watchPosition' , {
4045 apply ( target , thisArg , args ) {
41- if ( isFrameInsideFrame ) {
42- // we can't communicate with iframes inside iframes -> deny permission instead of putting users at risk
46+ if ( isFrameInsideFrameInWebView2 ) {
47+ // we can't communicate with iframes inside iframes in WebView2 -> deny permission instead of putting users at risk
4348 throw new DOMException ( 'Permission denied' ) ;
4449 }
4550
@@ -313,8 +318,8 @@ export default class WindowsPermissionUsage extends ContentFeature {
313318 if ( window . MediaDevices ) {
314319 const getUserMediaProxy = new DDGProxy ( this , MediaDevices . prototype , 'getUserMedia' , {
315320 apply ( target , thisArg , args ) {
316- if ( isFrameInsideFrame ) {
317- // we can't communicate with iframes inside iframes -> deny permission instead of putting users at risk
321+ if ( isFrameInsideFrameInWebView2 ) {
322+ // we can't communicate with iframes inside iframes in WebView2 -> deny permission instead of putting users at risk
318323 return Promise . reject ( new DOMException ( 'Permission denied' ) ) ;
319324 }
320325
0 commit comments