The isXDomain() function queries the port this way:
var locPort = window.location.port || 80;
At least with FireFox 5 window.location.port is also an empty string for HTTPS pages on standard port. This means that locPort==80 for HTTPS pages which makes isXDomain() return true.
Perhaps checking window.location.protocol=="https:" could solve the problem.