Bug 864775 - Use unwrapped content window object to determine compartment when creating new ArrayBuffers for use by content from TCPSocket. r=bz, a=blocking-b2g=tef+

uplift of https://hg.mozilla.org/mozilla-central/rev/5a62b421e490
Bug 864775 - Build fix. a=blocking-b2g=tef+

uplift of https://hg.mozilla.org/mozilla-central/rev/4676b8c35f46
Bug 864775 - Fix for test failures. a=blocking-b2g=tef+

uplift of https://hg.mozilla.org/mozilla-central/rev/761a78c8ab03