Bug 1242965 - Make services/common eslintable. r=rnewman

This commit is contained in:
Hector Zhao 2016-01-28 15:42:16 +08:00
parent 21eeae61b0
commit e72a83d14b
5 changed files with 16 additions and 31 deletions

View File

@ -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 = {};

View File

@ -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',

View File

@ -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");
/**

View File

@ -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");

View File

@ -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");