diff --git a/lib/loader.js b/lib/loader.js index 972fa8f..38404c0 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -42,10 +42,18 @@ function importLib(file) { } }()); +var navigator = { + get mozTCPSocket() { + delete navigator.mozTCPSocket; + return navigator.mozTCPSocket = window.TCPSocket; + } +}; + var window = this.window = { xpcDump: dump, xpcComponents: Components, xpcArgv: args, + navigator: navigator, get XMLHttpRequest() { var comp = Components.Constructor( diff --git a/test/tcp-socket-test.js b/test/tcp-socket-test.js index 6a34947..429e451 100644 --- a/test/tcp-socket-test.js +++ b/test/tcp-socket-test.js @@ -7,6 +7,8 @@ describe('tcp socket', function() { it('should work under xpcom', function(done) { this.timeout(5000); + expect(window.navigator.mozTCPSocket).to.be.ok(); + subject = window.TCPSocket.open('localhost', 80, { verifyCert: false });