And fine with FF 53 too. Evidently a very unique bug.
I see; the procedure is passed a 32-bit value, and wants to ensure it's a valid port number (in the range 1 to 65535), so that you'll get the error if you enter something idiotic like microsoft.com:0 or google.com:65536; but it was first assigning the 32-bit value to a 16-bit value, cutting off the high-order bits and rendering the check for being over 65535 meaningless. Worse, it was a signed 16-bit value, so anything over 32767 tested as less than 0 and was blocked as an invalid port number!
Edit: Roytam's fix works! BTW, I saw that he found and fixed the same coding mistake in FF 45 and the Tycho browsers (PM 27 and KM); yet it didn't cause the same bug, at least in the FF 45 build I was using. (Haven't tried the others.) Like later FF versions, FF 45 accessed port 50100 just fine.