1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // checking to make sure we don't hang as per 1038304
7 // offline so url isn't impt
8 var url
= "ws://localhost";
14 onBinaryMessageAvailable() {},
15 onMessageAvailable() {},
18 // onStart is not called when a connection fails
21 onStop(aContext
, aStatusCode
) {
22 Assert
.notEqual(aStatusCode
, Cr
.NS_OK
);
23 Services
.io
.offline
= offlineStatus
;
29 offlineStatus
= Services
.io
.offline
;
30 Services
.io
.offline
= true;
33 chan
= Cc
["@mozilla.org/network/protocol;1?name=ws"].createInstance(
34 Ci
.nsIWebSocketChannel
38 Services
.scriptSecurityManager
.getSystemPrincipal(),
39 null, // aTriggeringPrincipal
40 Ci
.nsILoadInfo
.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL
,
41 Ci
.nsIContentPolicy
.TYPE_WEBSOCKET
44 var uri
= Services
.io
.newURI(url
);
45 chan
.asyncOpen(uri
, url
, {}, 0, listener
, null);
48 dump("throwing " + x
);