Support FakeXDomainRequest

This is a continuation of the work done by @enemaerke to address issue #196.
I've added unit tests and fixed a few small issues which they uncovered.

There is no integrate with fake server at this stage, but I feel like that this basic functionality should be accepted before any server support is added.

Happy to make whatever changes needed to get this merged.