HTTPS servers for xpcshell-tests

10 views
Skip to first unread message

Valentin Gosu

unread,
Nov 20, 2025, 6:28:26 AM (yesterday) Nov 20
to dev-pl...@mozilla.org, firef...@mozilla.org
Hi folks,

I would like to announce that we recently moved NodeServer classes from head_servers.js into a sys.mjs module that is usable in xpcshell-tests anywhere in the tree.
Previously if you wanted to set up a server for your tests you probably used httpd.sys.js which had Firefox set up a very simple HTTP server. This server lacked basic features like connection reuse and HTTPS support.
The other alternative was using moz-http2.js - which is a nodejs server implementation that is spawned by the test runner and shared state across all test runs.

The new classes spawn a different nodejs server instance for every instance, set up certificates for you and are well documented: https://firefox-source-docs.mozilla.org/networking/NodeServers.html

Feel free to use the new servers in xpcshell tests. If you encounter any issues please file a bug blocking Bug 1988139.
If there is interest for it, we might also extend this to work in mochitests.

Thanks!
Reply all
Reply to author
Forward
0 new messages