You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Debugger not hit/paused in DevTools when using CDP and dynamically creating IFrame element #35478
After running the test case gist in Electron Fiddle, click the "Create IFrame" button. You would observe that debugger is not hit/paused in DevTools. Now comment line 19 in main.js, run the test case again, click the "Create IFrame" button, you would observe that the debugger is hit/paused in DevTools.
I tested the same with Chrome using chrome-remote-interface. Chrome works as expected. Here the same test case (Chrome Version: 104.0.5112.102, Node Version: 16.15.0) with Chrome:
Create a test directory, c:\test, open command prompt in this directory and execute:
npm install chrome-remote-interface
Create file, c:\test\test.js with following contents:
Open DevTools in Chrome, open command prompt and navigate to c:\test and execute:
node test.js
In Chrome, click the "Create IFrame" button, you would observe that the debugger is hit/paused, and in the console you see the CDP events are also triggered.
Closing as there are other issues (#34260 and #34938) which have the same problem with iframe. I could do a workaround by remotely attaching debugger via Chrome DevTools Protocol.
i have same issue, but i passed the probrolem with another way. here is the simple code
// create a invisible BrowserWindow, it's not the main windowconstdebuggerWin=newBrowserWindow();constproxyDebugger=debuggerWin.webContents.debugger;proxyDebugger.attach();// use debuggerWin to proxy all webContents events and commandsproxyDebugger.sendCommand("Target.setDiscoverTargets",{discover: true});lettargetContentsId: string;proxyDebugger.on("message",(...[method,params])=>{if(method==="Target.targetCreated"){const{targetInfo: { targetId },}=params;targetContentsId=targetIdproxyDebugger.sendCommand("Target.attachToTarget",{ targetId,flatten: true}).then(({ sessionId })=>{// then you can send any command to the target or listen messages from target// eg: proxyDebugger.sendCommand("Emulation.setTouchEmulationEnabled", { enabled: true }, sessionId);});}// listen messages from targetif(method==='Target.receivedMessageFromTarget'){if(targetContentsId===params.targetId){// do something}}})
Activity
pmadhur commentedon Aug 28, 2022
Seems to be similar to #34938, not sure if it exactly the same problem. My problem is with Debugger domain, and #34938 seems to be with Page domain.
pmadhur commentedon Aug 31, 2022
I tested the same with Chrome using chrome-remote-interface. Chrome works as expected. Here the same test case (Chrome Version: 104.0.5112.102, Node Version: 16.15.0) with Chrome:
Create a test directory, c:\test, open command prompt in this directory and execute:
npm install chrome-remote-interfaceCreate file, c:\test\test.js with following contents:
Create file c:\test\test.html with following contents:
Start Chrome with following arguments:
chrome.exe --remote-debugging-port=9222 --user-data-dir=c:/test/remote-profileOpen DevTools in Chrome, open command prompt and navigate to c:\test and execute:
node test.jsIn Chrome, click the "Create IFrame" button, you would observe that the debugger is hit/paused, and in the console you see the CDP events are also triggered.
So, it seems to be a problem with Electron.
pmadhur commentedon Oct 2, 2022
Closing as there are other issues (#34260 and #34938) which have the same problem with iframe. I could do a workaround by remotely attaching debugger via Chrome DevTools Protocol.
MrHuangJser commentedon Mar 17, 2023
i have same issue, but i passed the probrolem with another way. here is the simple code