Skip to content

Conversation

gsnedders
Copy link
Member

This makes it possible to run all the Python tests on macOS without triggering the local network privacy prompt, and makes it possible to run wptrunner against at least Chrome, Firefox, and Safari with bind_address=True (the default configuration) without triggering that prompt.

This makes it possible to run all the Python tests on macOS without
triggering the local network privacy prompt, and makes it possible to
run wptrunner against at least Chrome, Firefox, and Safari with
bind_address=True (the default configuration) without triggering that
prompt.
socketserver.TCPServer.server_bind(self)
host, port = self.server_address[:2]
if (
ipaddress.ip_address(host).is_loopback and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't thins error if host isn't an IP address?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, self.server_address is set to Socket.getsockname() in the superclass, which will give an IP address (for AF_INET and AF_INET6). But maybe that's too much relying on an implementation detail. Could look at self.socket.getsockname() ourselves, I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I hadn't noticed that TCPServer.sever_bind was mutating the value of server_address. I think that makes this fine; I'm not too worried about the stdlib changing.

socketserver.TCPServer.server_bind(self)
host, port = self.server_address[:2]
if (
ipaddress.ip_address(host).is_loopback and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I hadn't noticed that TCPServer.sever_bind was mutating the value of server_address. I think that makes this fine; I'm not too worried about the stdlib changing.

@jgraham jgraham merged commit f6aa692 into web-platform-tests:master Jul 2, 2025
34 checks passed
@gsnedders gsnedders deleted the avoid-local-network-prompt-on-macos branch July 10, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants