Update baseURI checking/pull and fallback, fixes #17661

This commit fixes an issue in IE10 and IE11 (which do support WebSockets). The .baseURI is not valid in those browsers, so you have to have a more robust fallback and check. The fix below was authored and tested against an actual websocket supporting server and has been verified to work. I also spent some time and did AMD cleanup on the module, getting rid of dojox. dojo. and most deprecated API usage. It now no longer forcibly expects a dojox. namespace and such.
at some point you have to draw a line though.  defensive programming taken to the extreme in this case, would say that we can't rely on `window` or `document` to even exist so we first should have tested for their existence but that would smell more of paranoia rather than robust programming.

i would think that if we don't have a `baseURI` by the time we get here then trying to make it work somehow in this unknown environment is probably going to cause a failure later.  wouldn't it be better to fail early than to try and keep going with uncertainty?