mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1242965 - Make services/common eslintable. r=rnewman
This commit is contained in:
parent
ef7abd0c0f
commit
d0d82170ca
@ -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 = {};
|
||||
|
@ -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',
|
||||
|
@ -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");
|
||||
|
||||
/**
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user