I had a similar problem on libsoup 3.0 and linuxmint/cjs and this worked for me. It's been 10 years but I'm leaving this here in case someone will have the same problem and find this useful.
message.connect("accept-certificate", function () {
return true
})