diff --git a/services/common/async.js b/services/common/async.js index 680f5e45ff1..2c2b818f6c7 100644 --- a/services/common/async.js +++ b/services/common/async.js @@ -2,14 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef MERGED_COMPARTMENT - this.EXPORTED_SYMBOLS = ["Async"]; var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components; -#endif - // Constants for makeSyncCallback, waitForSyncCallback. const CB_READY = {}; const CB_COMPLETE = {}; diff --git a/services/common/moz.build b/services/common/moz.build index 37e1aa64bdd..aac754a292f 100644 --- a/services/common/moz.build +++ b/services/common/moz.build @@ -14,8 +14,11 @@ EXTRA_COMPONENTS += [ ] EXTRA_JS_MODULES['services-common'] += [ + 'async.js', 'logmanager.js', 'moz-kinto-client.js', + 'observers.js', + 'rest.js', 'stringbundle.js', 'utils.js', ] @@ -31,12 +34,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' or CONFIG['MOZ_B2GDROID']: 'modules-testing/storageserver.js', ] -EXTRA_PP_JS_MODULES['services-common'] += [ - 'async.js', - 'observers.js', - 'rest.js', -] - TESTING_JS_MODULES.services.common += [ 'modules-testing/logging.js', 'modules-testing/utils.js', diff --git a/services/common/observers.js b/services/common/observers.js index 8b04e5ff6d9..c0b77104824 100644 --- a/services/common/observers.js +++ b/services/common/observers.js @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef MERGED_COMPARTMENT - this.EXPORTED_SYMBOLS = ["Observers"]; var Cc = Components.classes; @@ -11,8 +9,6 @@ var Ci = Components.interfaces; var Cr = Components.results; var Cu = Components.utils; -#endif - Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /** diff --git a/services/common/rest.js b/services/common/rest.js index a846d656abd..b63708b7188 100644 --- a/services/common/rest.js +++ b/services/common/rest.js @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef MERGED_COMPARTMENT - var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; this.EXPORTED_SYMBOLS = [ @@ -12,8 +10,6 @@ this.EXPORTED_SYMBOLS = [ "TokenAuthenticatedRESTRequest", ]; -#endif - Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm"); diff --git a/services/common/tests/unit/test_hawkclient.js b/services/common/tests/unit/test_hawkclient.js index 465cad2d8b7..95375c7affb 100644 --- a/services/common/tests/unit/test_hawkclient.js +++ b/services/common/tests/unit/test_hawkclient.js @@ -44,7 +44,7 @@ add_task(function test_updateClockOffset() { do_check_true(Math.abs(client.localtimeOffsetMsec + HOUR_MS) <= SECOND_MS); }); -add_task(function test_authenticated_get_request() { +add_task(function* test_authenticated_get_request() { let message = "{\"msg\": \"Great Success!\"}"; let method = "GET"; @@ -66,7 +66,7 @@ add_task(function test_authenticated_get_request() { yield deferredStop(server); }); -function check_authenticated_request(method) { +function* check_authenticated_request(method) { let server = httpd_setup({"/foo": (request, response) => { do_check_true(request.hasHeader("Authorization")); @@ -98,7 +98,7 @@ add_task(function test_authenticated_patch_request() { check_authenticated_request("PATCH"); }); -add_task(function test_credentials_optional() { +add_task(function* test_credentials_optional() { let method = "GET"; let server = httpd_setup({ "/foo": (request, response) => { @@ -118,7 +118,7 @@ add_task(function test_credentials_optional() { yield deferredStop(server); }); -add_task(function test_server_error() { +add_task(function* test_server_error() { let message = "Ohai!"; let method = "GET"; @@ -141,7 +141,7 @@ add_task(function test_server_error() { yield deferredStop(server); }); -add_task(function test_server_error_json() { +add_task(function* test_server_error_json() { let message = JSON.stringify({error: "Cannot get ye flask."}); let method = "GET"; @@ -163,7 +163,7 @@ add_task(function test_server_error_json() { yield deferredStop(server); }); -add_task(function test_offset_after_request() { +add_task(function* test_offset_after_request() { let message = "Ohai!"; let method = "GET"; @@ -186,7 +186,7 @@ add_task(function test_offset_after_request() { yield deferredStop(server); }); -add_task(function test_offset_in_hawk_header() { +add_task(function* test_offset_in_hawk_header() { let message = "Ohai!"; let method = "GET"; @@ -233,7 +233,7 @@ add_task(function test_offset_in_hawk_header() { yield deferredStop(server); }); -add_task(function test_2xx_success() { +add_task(function* test_2xx_success() { // Just to ensure that we're not biased toward 200 OK for success let credentials = { id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x", @@ -257,7 +257,7 @@ add_task(function test_2xx_success() { yield deferredStop(server); }); -add_task(function test_retry_request_on_fail() { +add_task(function* test_retry_request_on_fail() { let attempts = 0; let credentials = { id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x", @@ -312,7 +312,7 @@ add_task(function test_retry_request_on_fail() { yield deferredStop(server); }); -add_task(function test_multiple_401_retry_once() { +add_task(function* test_multiple_401_retry_once() { // Like test_retry_request_on_fail, but always return a 401 // and ensure that the client only retries once. let attempts = 0; @@ -361,7 +361,7 @@ add_task(function test_multiple_401_retry_once() { yield deferredStop(server); }); -add_task(function test_500_no_retry() { +add_task(function* test_500_no_retry() { // If we get a 500 error, the client should not retry (as it would with a // 401) let credentials = { @@ -401,7 +401,7 @@ add_task(function test_500_no_retry() { yield deferredStop(server); }); -add_task(function test_401_then_500() { +add_task(function* test_401_then_500() { // Like test_multiple_401_retry_once, but return a 500 to the // second request, ensuring that the promise is properly rejected // in client.request. @@ -465,7 +465,7 @@ add_task(function test_401_then_500() { yield deferredStop(server); }); -add_task(function throw_if_not_json_body() { +add_task(function* throw_if_not_json_body() { let client = new HawkClient("https://example.com"); try { yield client.request("/bogus", "GET", {}, "I am not json");