mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Revert "alloy: Allow --remote-debugging-port=0 (fixes #3619)"
Reason for the revert: Incorrectly enables DevTools remote debugging
by default.
This reverts commit 70471059cf.
			
			
This commit is contained in:
		| @@ -432,15 +432,11 @@ typedef struct _cef_settings_t { | |||||||
|  |  | ||||||
|   /// |   /// | ||||||
|   /// Set to a value between 1024 and 65535 to enable remote debugging on the |   /// Set to a value between 1024 and 65535 to enable remote debugging on the | ||||||
|   /// specified port. Setting 0 will result in the selection of an ephemeral |   /// specified port. Also configurable using the "remote-debugging-port" | ||||||
|   /// port, the port number will be printed as part of WebSocket endpoit URL |   /// command-line switch. Remote debugging can be accessed by loading the | ||||||
|   /// to stderr. If the cache directory path is provided, the port will be  |   /// chrome://inspect page in Google Chrome. Port numbers 9222 and 9229 are | ||||||
|   /// also written into <cache-dir>/DevToolsActivePort file. |   /// discoverable by default. Other port numbers may need to be configured via | ||||||
|   /// Also configurable using the "remote-debugging-port" command-line switch. |   /// "Discover network targets" on the Devices tab. | ||||||
|   /// Remote debugging can be accessed by loading the chrome://inspect page in |  | ||||||
|   /// Google Chrome. Port numbers 9222 and 9229 are discoverable by default. |  | ||||||
|   /// Other port numbers may need to be configured via "Discover network |  | ||||||
|   /// targets" on the Devices tab. |  | ||||||
|   /// |   /// | ||||||
|   int remote_debugging_port; |   int remote_debugging_port; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -70,29 +70,28 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory { | |||||||
| std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() { | std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() { | ||||||
|   const base::CommandLine& command_line = |   const base::CommandLine& command_line = | ||||||
|       *base::CommandLine::ForCurrentProcess(); |       *base::CommandLine::ForCurrentProcess(); | ||||||
|   // See if the user specified a port on the command line. Specifying 0 |   // See if the user specified a port on the command line. Specifying 0 would | ||||||
|   // results in the selection of an ephemeral port, the port number will |   // result in the selection of an ephemeral port but that doesn't make sense | ||||||
|   // be printed as part of WebSocket endpoit URL to stderr. |   // for CEF where the URL is otherwise undiscoverable. Also, don't allow | ||||||
|   // If the cache directory path is provided, the port will be also written |   // binding of ports between 0 and 1024 exclusive because they're normally | ||||||
|   // into <cache-dir>/DevToolsActivePort file. |   // restricted to root on Posix-based systems. | ||||||
|   // |   uint16_t port = 0; | ||||||
|   // It's not allowed to bind ports between 0 and 1024 exclusive because |  | ||||||
|   // they're normally restricted to root on Posix-based systems. |  | ||||||
|   if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { |   if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { | ||||||
|     int port = 0; |     int temp_port; | ||||||
|     std::string port_str = |     std::string port_str = | ||||||
|         command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); |         command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | ||||||
|  |     if (base::StringToInt(port_str, &temp_port) && temp_port >= 1024 && | ||||||
|     if (base::StringToInt(port_str, &port) && |         temp_port < 65535) { | ||||||
|         (0 == port || (port >= 1024 && port < 65535))) { |       port = static_cast<uint16_t>(temp_port); | ||||||
|       return std::unique_ptr<content::DevToolsSocketFactory>( |  | ||||||
|           new TCPServerSocketFactory("127.0.0.1", port)); |  | ||||||
|     } else { |     } else { | ||||||
|       DLOG(WARNING) << "Invalid http debugger port number '" << port_str << "'"; |       DLOG(WARNING) << "Invalid http debugger port number " << temp_port; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   if (port == 0) { | ||||||
|   return nullptr; |     return nullptr; | ||||||
|  |   } | ||||||
|  |   return std::unique_ptr<content::DevToolsSocketFactory>( | ||||||
|  |       new TCPServerSocketFactory("127.0.0.1", port)); | ||||||
| } | } | ||||||
|  |  | ||||||
| }  //  namespace | }  //  namespace | ||||||
|   | |||||||
| @@ -346,9 +346,8 @@ std::optional<int> AlloyMainDelegate::BasicStartupComplete() { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (settings_->remote_debugging_port == 0 || |     if (settings_->remote_debugging_port >= 1024 && | ||||||
|         (settings_->remote_debugging_port >= 1024 && |         settings_->remote_debugging_port <= 65535) { | ||||||
|          settings_->remote_debugging_port <= 65535)) { |  | ||||||
|       command_line->AppendSwitchASCII( |       command_line->AppendSwitchASCII( | ||||||
|           switches::kRemoteDebuggingPort, |           switches::kRemoteDebuggingPort, | ||||||
|           base::NumberToString(settings_->remote_debugging_port)); |           base::NumberToString(settings_->remote_debugging_port)); | ||||||
|   | |||||||
| @@ -114,9 +114,8 @@ std::optional<int> ChromeMainDelegateCef::BasicStartupComplete() { | |||||||
|           CefString(&settings_->javascript_flags).ToString()); |           CefString(&settings_->javascript_flags).ToString()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (settings_->remote_debugging_port == 0 || |     if (settings_->remote_debugging_port >= 1024 && | ||||||
|         (settings_->remote_debugging_port >= 1024 && |         settings_->remote_debugging_port <= 65535) { | ||||||
|          settings_->remote_debugging_port <= 65535)) { |  | ||||||
|       command_line->AppendSwitchASCII( |       command_line->AppendSwitchASCII( | ||||||
|           switches::kRemoteDebuggingPort, |           switches::kRemoteDebuggingPort, | ||||||
|           base::NumberToString(settings_->remote_debugging_port)); |           base::NumberToString(settings_->remote_debugging_port)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user