author | Mark Banner <standard8@mozilla.com> |
Thu, 01 Oct 2015 19:40:50 +0100 | |
changeset 265698 | 41880e71001e93af35018ff0dfaa5c4e5006480d |
parent 265697 | 53483ede42c2830a3a3af02b4d902fd4c1b2e83d |
child 265699 | dcf488b739183e1f256e4ecdc55f432c6c323c43 |
push id | 66003 |
push user | cbook@mozilla.com |
push date | Fri, 02 Oct 2015 11:37:40 +0000 |
treeherder | mozilla-inbound@3fd732d24f46 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dmose |
bugs | 1207300 |
milestone | 44.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/loop/modules/MozLoopPushHandler.jsm +++ b/browser/components/loop/modules/MozLoopPushHandler.jsm @@ -382,23 +382,19 @@ var MozLoopPushHandler = { * that are found in the work queue at that point. * * @param {Object} options Set of configuration options. Currently, * the only option is mocketWebSocket which will be * used for testing. */ initialize: function(options = {}) { consoleLog.info("PushHandler: initialize options = ", options); - if (Services.io.offline) { - consoleLog.warn("PushHandler: IO offline"); - return false; - } if (this._initDone) { - return true; + return; } this._initDone = true; this._retryManager = new RetryManager(this._startRetryDelay_ms, this._maxRetryDelay_ms); // Send an empty json payload as a ping. // Close the websocket and re-open if a timeout occurs. this._pingMonitor = new PingMonitor(() => this._pushSocket.send({}), @@ -406,17 +402,16 @@ var MozLoopPushHandler = { this._pingInterval_ms, this._pingTimeout_ms); if ("mockWebSocket" in options) { this._mockWebSocket = options.mockWebSocket; } this._openSocket(); - return true; }, /** * Reset and clear PushServer connection. * Returns MozLoopPushHandler to pre-initialized state. */ shutdown: function() { consoleLog.info("PushHandler: shutdown");
--- a/browser/components/loop/test/xpcshell/test_looppush_initialize.js +++ b/browser/components/loop/test/xpcshell/test_looppush_initialize.js @@ -2,40 +2,33 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; var dummyCallback = () => {}; var mockWebSocket = new MockWebSocketChannel(); var pushServerRequestCount = 0; -add_test(function test_initalize_offline() { - Services.io.offline = true; - do_check_false(MozLoopPushHandler.initialize()); - Services.io.offline = false; - run_next_test(); -}); - add_test(function test_initalize_missing_chanid() { Assert.throws(() => MozLoopPushHandler.register(null, dummyCallback, dummyCallback)); run_next_test(); }); add_test(function test_initalize_missing_regcallback() { Assert.throws(() => MozLoopPushHandler.register("chan-1", null, dummyCallback)); run_next_test(); }); add_test(function test_initalize_missing_notifycallback() { Assert.throws(() => MozLoopPushHandler.register("chan-1", dummyCallback, null)); run_next_test(); }); add_test(function test_initalize_websocket() { - do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket})); + MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}); MozLoopPushHandler.register( "chan-1", function(err, url, id) { Assert.equal(err, null, "err should be null to indicate success"); Assert.equal(url, kEndPointUrl, "Should return push server application URL"); Assert.equal(id, "chan-1", "Should have channel id = chan-1"); Assert.equal(mockWebSocket.uri.prePath, kServerPushUrl, "Should have the url from preferences"); @@ -187,17 +180,17 @@ add_test(function test_retry_pushurl() { response.processAsync(); response.finish(); run_next_test(); break; } }); - do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket})); + MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}); }); function run_test() { setupFakeLoopServer(); loopServer.registerPathHandler("/push-server-config", (request, response) => { response.setStatusLine(null, 200, "OK"); response.write(JSON.stringify({pushServerURI: kServerPushUrl}));