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

Feature Request: Add switch to disable the remote debugging server #3620

Closed
erezcohen opened this issue Jun 28, 2015 · 7 comments
Closed

Feature Request: Add switch to disable the remote debugging server #3620

erezcohen opened this issue Jun 28, 2015 · 7 comments
Assignees
Milestone

Comments

@erezcohen
Copy link

As nwjs starts it opens a tcp port on local host (for remote debugging / devtools) and listens on it.
I would prefer to be able to supply a command line switch that will tell nwjs not to open the port.

Motivation: Enterprise organizations with high security restrictions (e.g. banks) many times prevent end users from running apps that try to open and listen on ports (even on local host).

Note: At first I thought it is solely a Chromium issue (see: https://code.google.com/p/chromium/issues/detail?id=503566) however it seems that running a simple chromium installation doesn't open the mentioned port - so I guess this behavior is determined somewhere in the nwjs integration?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@erezcohen
Copy link
Author

See https://code.google.com/p/chromium/issues/detail?id=349558#c4:
According to them: "Desktop Chromium would only enable remote debugging if started with --remote-debugging-port command line option" - Then why is it enabled by default in nwjs?

@erezcohen
Copy link
Author

I'm thinking of fixing it myself.
Possibly, in order to maintain backward compatibility, the devtools server should be started by default.
Can anyone point me to a starting point?
Is the fix should be in Chromium or nwjs? (or in the build/config files?)

@xiaoyongwu
Copy link

xiaoyongwu commented Apr 26, 2016

Any updates on this issue? Looks like this should be a fix from nwjs in src/shell_browser_main_parts.cc.

if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
    int temp_port;
    std::string port_str =
        command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
    // FIXME: should revert to `temp_port > 0` when chrome-devtools:// is enabled
    if (base::StringToInt(port_str, &temp_port) &&
        temp_port >= 0 && temp_port < 65535) {
      port = temp_port;
    } else {
      DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
    }
  }
  devtools_delegate_ = new ShellDevToolsDelegate(browser_context_.get(), port);

The code above should try to detect a special port such as -1 and not to start the remote debugging?

@rogerwang rogerwang added this to the 0.14.x milestone Apr 27, 2016
@rogerwang
Copy link
Member

Will disable this in normal build.

@xiaoyongwu
Copy link

Is this going to be disabled for next release in normal build?

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@AllencxWang
Copy link

AllencxWang commented Jun 13, 2016

For those who are still using the older version of nwjs (say, 0.12.x), you can simply modify "nw/src/shell_browser_main_parts.cc" like this:

screen shot 2016-06-13 at 10 52 10 am

Once it's rebuilt, nwjs will start listening on the remote debug port only if it's specified. (nw --remote-debugging-port=9222).

If you want to disable this remote debugging port forever, you can use devtools_http_handler_.reset() (just like the else clause did).

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

5 participants