Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to open DevTools of webview #8096

Closed
Sunvas opened this issue Aug 1, 2023 · 9 comments
Closed

Impossible to open DevTools of webview #8096

Sunvas opened this issue Aug 1, 2023 · 9 comments
Assignees

Comments

@Sunvas
Copy link

Sunvas commented Aug 1, 2023

Current/Missing Behavior

It is completely impossible to open DevTools of a webview: neither by context menu neither by JavaScript API.

How to reproduce

package.json

{
	"main": "/main.html",
	"name": "demo"
}

main.html

<h6>WebView 2</h6> <webview id="webview2" src=https://github.com/nwjs/nw.js/issues/"https://gmail.com"> <button onclick="DevTools1()">OpenDevTools 1</button> <button onclick="DevTools2()">OpenDevTools 2</button> <script> function DevTools1() { document.getElementById("webview1").showDevTools(true); } function DevTools2() { document.getElementById("webview2").showDevTools(true); } </script> </body> </html>">
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Demo</title>
</head>
<body>
	<h6>WebView 1</h6>
	<webview id="webview1" src="https://google.com"></webview>
	
	<h6>WebView 2</h6>
	<webview id="webview2" src="https://gmail.com"></webview>
	
	<button onclick="DevTools1()">OpenDevTools 1</button> <button onclick="DevTools2()">OpenDevTools 2</button>
	<script>
	function DevTools1()
	{
		document.getElementById("webview1").showDevTools(true);
	}
	function DevTools2()
	{
		document.getElementById("webview2").showDevTools(true);
	}
	</script>
</body>
</html>

And there is no way to open both DevTools simultaneously. Quite strange behaviour.

Video

https://youtu.be/O0wJpmhK6X8
Please note that DevTools is called on one webview and displayed for another.

Additional Info

  • Operating System: Windows
  • NW.js Version: 0.78, 0.78.1
@rogerwang
Copy link
Member

We have test case guarding this feature and it works well: https://github.com/nwjs/nw.js/tree/nw78/test/sanity/webview-cdt

@Sunvas
Copy link
Author

Sunvas commented Aug 1, 2023

@rogerwang , in your test you have

var demodev = document.getElementById('demodev');

which means opening only one DevTools window (of webview with ID demodev) . But in my case i'm trying to open 2+ DevTools windows and that's impossible.

@Sunvas
Copy link
Author

Sunvas commented Aug 1, 2023

@rogerwang I've added video.

https://youtu.be/O0wJpmhK6X8
Please note that DevTools is called on one webview and displayed for another.

@bluthen
Copy link
Contributor

bluthen commented Aug 2, 2023

Agreed, works great in 0.66.0 but not in 0.78.1

@Sunvas
Copy link
Author

Sunvas commented Aug 17, 2023

0.79 - the same bug.

@Sunvas
Copy link
Author

Sunvas commented Aug 18, 2023

Despite it is impossible to open DevTools for specified webview and entire window, nevertheless this message also appears in console:
DevTools debugger is disabled because it is attached to a process that hosts multiple top-level frames, where DevTools debugger doesn't work properly. Please relaunch the browser with --disable-features=ProcessPerSiteUpToMainFrameThreshold to enable debugger.

@rogerwang
Copy link
Member

Try this workaround: run nw with --disable-features=DevToolsTabTarget

@Sunvas
Copy link
Author

Sunvas commented Aug 21, 2023

That works. It worth to mention this param in docs.

@rogerwang
Copy link
Member

close as fixed in 0.79.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants