|
21 | 21 |
|
22 | 22 | CefRefPtr<ClientHandler> g_handler;
|
23 | 23 | int g_remote_debugging_port = 0;
|
| 24 | +std::string g_get_remote_debugging_port_error; |
24 | 25 |
|
25 | 26 | #ifdef OS_WIN
|
26 | 27 | bool g_force_enable_acc = false;
|
@@ -99,24 +100,22 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<CefCommandLine> command_lin
|
99 | 100 | // Enable dev tools
|
100 | 101 | CefString debugger_port = command_line->GetSwitchValue("remote-debugging-port");
|
101 | 102 | if (!debugger_port.empty()) {
|
102 |
| - const long port = strtol(debugger_port.ToString().c_str(), NULL, 10); |
103 |
| - if (errno == ERANGE || port == 0) { |
104 |
| - LOG(ERROR) << "Could not enable remote debugging." |
105 |
| - << " Error while parsing remote-debugging-port arg: "<< debugger_port.ToString(); |
106 |
| - errno = 0; |
| 103 | + g_get_remote_debugging_port_error = debugger_port.ToString(); |
| 104 | + long port = strtol(g_get_remote_debugging_port_error.c_str(), NULL, 10); |
| 105 | + if (errno == ERANGE) { |
| 106 | + errno = port = 0; |
| 107 | + } |
| 108 | + static const long max_port_num = 65535; |
| 109 | + static const long max_reserved_port_num = 1023; |
| 110 | + if (port > max_reserved_port_num && port < max_port_num) { |
| 111 | + g_remote_debugging_port = static_cast<int>(port); |
| 112 | + settings.remote_debugging_port = g_remote_debugging_port; |
| 113 | + g_get_remote_debugging_port_error.clear(); |
107 | 114 | }
|
108 | 115 | else {
|
109 |
| - static const long max_port_num = 65534; |
110 |
| - static const long max_reserved_port_num = 1025; |
111 |
| - if (port >= max_reserved_port_num && port <= max_port_num) { |
112 |
| - g_remote_debugging_port = static_cast<int>(port); |
113 |
| - settings.remote_debugging_port = g_remote_debugging_port; |
114 |
| - } |
115 |
| - else { |
116 |
| - LOG(ERROR) << "Cannot enable remote debugging on port "<< port |
117 |
| - << ". Port numbers should be between "<< max_reserved_port_num |
118 |
| - << " and " << max_port_num << "."; |
119 |
| - } |
| 116 | + // Setting debugging port to highest number will disable remote debugging |
| 117 | + // As setting.remote_debugging_port has higher priority compared to command line option |
| 118 | + settings.remote_debugging_port = max_port_num; |
120 | 119 | }
|
121 | 120 | }
|
122 | 121 |
|
|
0 commit comments