Backed out changeset 06a658a93aab (bug 1333044)

--HG--
extra : rebase_source : 554fed79a1c36ce418ab95952cde9669a3297cb6
This commit is contained in:
Carsten "Tomcat" Book 2017-01-25 15:29:35 +01:00
Родитель a6178c3af9
Коммит f868542f9b
21 изменённых файлов: 157 добавлений и 134 удалений

Просмотреть файл

@ -222,6 +222,7 @@ add_task(function* test_offset_in_hawk_header() {
"/second": function(request, response) {
// We see a better date now in the ts component of the header
let delta = getTimestampDelta(request.getHeader("Authorization"));
let message = "Delta: " + delta;
// We're now within HAWK's one-minute window.
// I hope this isn't a recipe for intermittent oranges ...
@ -499,3 +500,4 @@ function run_test() {
initTestLogging("Trace");
run_next_test();
}

Просмотреть файл

@ -207,8 +207,8 @@ add_test(function test_get_utf8() {
// Check that we default to UTF-8 if Content-Type doesn't have a charset.
charset = false;
let request2 = new RESTRequest(server.baseURI + "/resource");
request2.get(function(error2) {
do_check_null(error2);
request2.get(function(error) {
do_check_null(error);
do_check_eq(request2.response.status, 200);
do_check_eq(request2.response.body, response);
@ -291,8 +291,8 @@ add_test(function test_charsets() {
charset = false;
let request2 = new RESTRequest(server.baseURI + "/resource");
request2.charset = "us-ascii";
request2.get(function(error2) {
do_check_null(error2);
request2.get(function(error) {
do_check_null(error);
do_check_eq(request2.response.status, 200);
do_check_eq(request2.response.body, response);
@ -870,3 +870,4 @@ add_test(function test_not_sending_cookie() {
server.stop(run_next_test);
});
});

Просмотреть файл

@ -597,7 +597,7 @@ add_test(function test_x_num_records() {
// BSO fetches don't have one.
do_check_false("x-num-records" in this.response.headers);
let col = localRequest(server, "/2.0/123/storage/crypto");
col.get(function(err2) {
col.get(function(err) {
// Collection fetches do.
do_check_eq(this.response.headers["x-num-records"], "2");
server.stop(run_next_test);

Просмотреть файл

@ -523,23 +523,23 @@ add_test(function test_getKeys() {
user.verified = true;
fxa.setSignedInUser(user).then(() => {
fxa.getSignedInUser().then((user2) => {
fxa.getSignedInUser().then((user) => {
// Before getKeys, we have no keys
do_check_eq(!!user2.kA, false);
do_check_eq(!!user2.kB, false);
do_check_eq(!!user.kA, false);
do_check_eq(!!user.kB, false);
// And we still have a key-fetch token and unwrapBKey to use
do_check_eq(!!user2.keyFetchToken, true);
do_check_eq(!!user2.unwrapBKey, true);
do_check_eq(!!user.keyFetchToken, true);
do_check_eq(!!user.unwrapBKey, true);
fxa.internal.getKeys().then(() => {
fxa.getSignedInUser().then((user3) => {
fxa.getSignedInUser().then((user) => {
// Now we should have keys
do_check_eq(fxa.internal.isUserEmailVerified(user3), true);
do_check_eq(!!user3.verified, true);
do_check_eq(user3.kA, expandHex("11"));
do_check_eq(user3.kB, expandHex("66"));
do_check_eq(user3.keyFetchToken, undefined);
do_check_eq(user3.unwrapBKey, undefined);
do_check_eq(fxa.internal.isUserEmailVerified(user), true);
do_check_eq(!!user.verified, true);
do_check_eq(user.kA, expandHex("11"));
do_check_eq(user.kB, expandHex("66"));
do_check_eq(user.keyFetchToken, undefined);
do_check_eq(user.unwrapBKey, undefined);
run_next_test();
});
});
@ -620,13 +620,13 @@ add_test(function test_fetchAndUnwrapKeys_no_token() {
makeObserver(ONLOGOUT_NOTIFICATION, function() {
log.debug("test_fetchAndUnwrapKeys_no_token observed logout");
fxa.internal.getUserAccountData().then(user2 => {
fxa.internal.getUserAccountData().then(user => {
run_next_test();
});
});
fxa.setSignedInUser(user).then(
user2 => {
user => {
return fxa.internal.fetchAndUnwrapKeys();
}
).then(
@ -861,8 +861,8 @@ add_test(function test_accountStatus() {
do_check_true(result);
fxa.internal.fxAccountsClient._deletedOnServer = true;
fxa.accountStatus().then(
(result2) => {
do_check_false(result2);
(result) => {
do_check_false(result);
fxa.internal.fxAccountsClient._deletedOnServer = false;
fxa.signOut().then(run_next_test);
}

Просмотреть файл

@ -18,13 +18,8 @@ let mockResponse = function(response) {
let Request = function(requestUri) {
// Store the request uri so tests can inspect it
Request._requestUri = requestUri;
Request.ifNoneMatchSet = false;
return {
setHeader(header, value) {
if (header == "If-None-Match" && value == "bogusETag") {
Request.ifNoneMatchSet = true;
}
},
setHeader() {},
get() {
this.response = response;
this.onComplete();
@ -98,6 +93,28 @@ add_test(function setsIfNoneMatchETagHeader() {
body: "{\"email\":\"someone@restmail.net\",\"uid\":\"0d5c1a89b8c54580b8e3e8adadae864a\"}",
};
let ifNoneMatchSet = false;
let mockResponse = function(response) {
let Request = function(requestUri) {
// Store the request uri so tests can inspect it
Request._requestUri = requestUri;
return {
setHeader(header, value) {
if (header == "If-None-Match" && value == "bogusETag") {
ifNoneMatchSet = true;
}
},
get() {
this.response = response;
this.onComplete();
}
};
};
return Request;
};
let req = new mockResponse(response);
client._Request = req;
client.fetchProfile("bogusETag")
@ -106,7 +123,7 @@ add_test(function setsIfNoneMatchETagHeader() {
do_check_eq(client._Request._requestUri, "http://127.0.0.1:1111/v1/profile");
do_check_eq(result.body.email, "someone@restmail.net");
do_check_eq(result.body.uid, "0d5c1a89b8c54580b8e3e8adadae864a");
do_check_true(req.ifNoneMatchSet);
do_check_true(ifNoneMatchSet);
run_next_test();
}
);
@ -165,7 +182,7 @@ add_test(function server401ResponseThenSuccess() {
// The number of times our removeCachedOAuthToken function was called.
let numTokensRemoved = 0;
let mockFxaWithRemove = {
let mockFxa = {
getOAuthToken(options) {
do_check_eq(options.scope, "profile");
return "" + ++lastToken; // tokens are strings.
@ -179,7 +196,7 @@ add_test(function server401ResponseThenSuccess() {
}
let profileOptions = {
serverURL: "http://127.0.0.1:1111/v1",
fxa: mockFxaWithRemove,
fxa: mockFxa,
};
let client = new FxAccountsProfileClient(profileOptions);
@ -239,7 +256,7 @@ add_test(function server401ResponsePersists() {
// The number of times our removeCachedOAuthToken function was called.
let numTokensRemoved = 0;
let mockFxaWithRemove = {
let mockFxa = {
getOAuthToken(options) {
do_check_eq(options.scope, "profile");
return "" + ++lastToken; // tokens are strings.
@ -253,7 +270,7 @@ add_test(function server401ResponsePersists() {
}
let profileOptions = {
serverURL: "http://127.0.0.1:1111/v1",
fxa: mockFxaWithRemove,
fxa: mockFxa,
};
let client = new FxAccountsProfileClient(profileOptions);

Просмотреть файл

@ -11,9 +11,9 @@ Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/FxAccountsCommon.js");
Cu.import("resource://gre/modules/Log.jsm");
let importScope = {};
Services.scriptloader.loadSubScript("resource://gre/components/FxAccountsPush.js", importScope);
const FxAccountsPushService = importScope.FxAccountsPushService;
let scope = {};
Services.scriptloader.loadSubScript("resource://gre/components/FxAccountsPush.js", scope);
const FxAccountsPushService = scope.FxAccountsPushService;
XPCOMUtils.defineLazyServiceGetter(this, "pushService",
"@mozilla.org/push/Service;1", "nsIPushService");

Просмотреть файл

@ -194,9 +194,9 @@ function mockGetTabState(tab) {
function mockGetWindowEnumerator(url, numWindows, numTabs, indexes, moreURLs) {
let elements = [];
function url2entry(urlToConvert) {
function url2entry(url) {
return {
url: ((typeof urlToConvert == "function") ? urlToConvert() : urlToConvert),
url: ((typeof url == "function") ? url() : url),
title: "title"
};
}

Просмотреть файл

@ -869,8 +869,8 @@ SyncServer.prototype = {
// Hand off to the appropriate handler for this path component.
if (first in this.toplevelHandlers) {
let newHandler = this.toplevelHandlers[first];
return newHandler.call(this, newHandler, req, resp, version, username, rest);
let handler = this.toplevelHandlers[first];
return handler.call(this, handler, req, resp, version, username, rest);
}
this._log.debug("SyncServer: Unknown top-level " + first);
throw HTTP_404;
@ -922,7 +922,7 @@ SyncServer.prototype = {
let [, collection, wboID] = match;
let coll = this.getCollection(username, collection);
switch (req.method) {
case "GET": {
case "GET":
if (!coll) {
if (wboID) {
respond(404, "Not found", "Not found");
@ -941,9 +941,9 @@ SyncServer.prototype = {
return undefined;
}
return wbo.handler()(req, resp);
}
// TODO: implement handling of X-If-Unmodified-Since for write verbs.
case "DELETE": {
case "DELETE":
if (!coll) {
respond(200, "OK", "{}");
return undefined;
@ -987,7 +987,6 @@ SyncServer.prototype = {
this.callback.onItemDeleted(username, collection, deleted[i]);
}
return undefined;
}
case "POST":
case "PUT":
if (!coll) {

Просмотреть файл

@ -298,7 +298,7 @@ add_test(function test_ignore_hotfixes() {
// A hotfix extension is one that has the id the same as the
// extensions.hotfix.id pref.
let extensionPrefs = new Preferences("extensions.");
let prefs = new Preferences("extensions.");
let addon = installAddon("test_bootstrap1_1");
do_check_true(store.isAddonSyncable(addon));
@ -312,7 +312,7 @@ add_test(function test_ignore_hotfixes() {
// Basic sanity check.
do_check_true(store.isAddonSyncable(dummy));
extensionPrefs.set("hotfix.id", dummy.id);
prefs.set("hotfix.id", dummy.id);
do_check_false(store.isAddonSyncable(dummy));
// Verify that int values don't throw off checking.
@ -327,7 +327,7 @@ add_test(function test_ignore_hotfixes() {
uninstallAddon(addon);
extensionPrefs.reset("hotfix.id");
prefs.reset("hotfix.id");
run_next_test();
});
@ -536,3 +536,4 @@ add_test(function cleanup() {
reconciler.stopListening();
run_next_test();
});

Просмотреть файл

@ -58,22 +58,22 @@ add_task(async function test_bookmark_order() {
}], "clean slate");
function bookmark(name, parent) {
let bm = new Bookmark("http://weave.server/my-bookmark");
bm.id = name;
bm.title = name;
bm.bmkUri = "http://uri/";
bm.parentid = parent || "unfiled";
bm.tags = [];
return bm;
let bookmark = new Bookmark("http://weave.server/my-bookmark");
bookmark.id = name;
bookmark.title = name;
bookmark.bmkUri = "http://uri/";
bookmark.parentid = parent || "unfiled";
bookmark.tags = [];
return bookmark;
}
function folder(name, parent, children) {
let bmFolder = new BookmarkFolder("http://weave.server/my-bookmark-folder");
bmFolder.id = name;
bmFolder.title = name;
bmFolder.parentid = parent || "unfiled";
bmFolder.children = children;
return bmFolder;
let folder = new BookmarkFolder("http://weave.server/my-bookmark-folder");
folder.id = name;
folder.title = name;
folder.parentid = parent || "unfiled";
folder.children = children;
return folder;
}
function apply(record) {

Просмотреть файл

@ -47,10 +47,10 @@ function clearBookmarks() {
startCount = smartBookmarkCount();
}
function serverForFoo(engineData) {
function serverForFoo(engine) {
return serverForUsers({"foo": "password"}, {
meta: {global: {engines: {bookmarks: {version: engineData.version,
syncID: engineData.syncID}}}},
meta: {global: {engines: {bookmarks: {version: engine.version,
syncID: engine.syncID}}}},
bookmarks: {}
});
}

Просмотреть файл

@ -957,7 +957,7 @@ add_task(async function test_onFaviconChanged() {
await new Promise(resolve => {
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, iconURI, true,
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (uri, dataLen, data, mimeType) => {
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (iconURI, dataLen, data, mimeType) => {
resolve();
},
Services.scriptSecurityManager.getSystemPrincipal());

Просмотреть файл

@ -22,9 +22,9 @@ const SECOND_MS = 1000;
const MINUTE_MS = SECOND_MS * 60;
const HOUR_MS = MINUTE_MS * 60;
var globalIdentityConfig = makeIdentityConfig();
var globalBrowseridManager = new BrowserIDManager();
configureFxAccountIdentity(globalBrowseridManager, globalIdentityConfig);
var identityConfig = makeIdentityConfig();
var browseridManager = new BrowserIDManager();
configureFxAccountIdentity(browseridManager, identityConfig);
/**
* Mock client clock and skew vs server in FxAccounts signed-in user module and
@ -71,19 +71,19 @@ function run_test() {
add_test(function test_initial_state() {
_("Verify initial state");
do_check_false(!!globalBrowseridManager._token);
do_check_false(globalBrowseridManager.hasValidToken());
do_check_false(!!browseridManager._token);
do_check_false(browseridManager.hasValidToken());
run_next_test();
}
);
add_task(async function test_initialializeWithCurrentIdentity() {
_("Verify start after initializeWithCurrentIdentity");
globalBrowseridManager.initializeWithCurrentIdentity();
await globalBrowseridManager.whenReadyToAuthenticate.promise;
do_check_true(!!globalBrowseridManager._token);
do_check_true(globalBrowseridManager.hasValidToken());
do_check_eq(globalBrowseridManager.account, globalIdentityConfig.fxaccount.user.email);
browseridManager.initializeWithCurrentIdentity();
await browseridManager.whenReadyToAuthenticate.promise;
do_check_true(!!browseridManager._token);
do_check_true(browseridManager.hasValidToken());
do_check_eq(browseridManager.account, identityConfig.fxaccount.user.email);
}
);
@ -104,10 +104,10 @@ add_task(async function test_initialializeWithAuthErrorAndDeletedAccount() {
let signCertificateCalled = false;
let accountStatusCalled = false;
let AuthErrorMockFxAClient = function() {
let MockFxAccountsClient = function() {
FxAccountsClient.apply(this);
};
AuthErrorMockFxAClient.prototype = {
MockFxAccountsClient.prototype = {
__proto__: FxAccountsClient.prototype,
signCertificate() {
signCertificateCalled = true;
@ -122,7 +122,7 @@ add_task(async function test_initialializeWithAuthErrorAndDeletedAccount() {
}
};
let mockFxAClient = new AuthErrorMockFxAClient();
let mockFxAClient = new MockFxAccountsClient();
browseridManager._fxaService.internal._fxAccountsClient = mockFxAClient;
await browseridManager.initializeWithCurrentIdentity();
@ -143,19 +143,19 @@ add_task(async function test_initialializeWithNoKeys() {
delete identityConfig.fxaccount.user.kA;
delete identityConfig.fxaccount.user.kB;
// there's no keyFetchToken by default, so the initialize should fail.
configureFxAccountIdentity(globalBrowseridManager, identityConfig);
configureFxAccountIdentity(browseridManager, identityConfig);
await globalBrowseridManager.initializeWithCurrentIdentity();
await globalBrowseridManager.whenReadyToAuthenticate.promise;
await browseridManager.initializeWithCurrentIdentity();
await browseridManager.whenReadyToAuthenticate.promise;
do_check_eq(Status.login, LOGIN_SUCCEEDED, "login succeeded even without keys");
do_check_false(globalBrowseridManager._canFetchKeys(), "_canFetchKeys reflects lack of keys");
do_check_eq(globalBrowseridManager._token, null, "we don't have a token");
do_check_false(browseridManager._canFetchKeys(), "_canFetchKeys reflects lack of keys");
do_check_eq(browseridManager._token, null, "we don't have a token");
});
add_test(function test_getResourceAuthenticator() {
_("BrowserIDManager supplies a Resource Authenticator callback which returns a Hawk header.");
configureFxAccountIdentity(globalBrowseridManager);
let authenticator = globalBrowseridManager.getResourceAuthenticator();
configureFxAccountIdentity(browseridManager);
let authenticator = browseridManager.getResourceAuthenticator();
do_check_true(!!authenticator);
let req = {uri: CommonUtils.makeURI(
"https://example.net/somewhere/over/the/rainbow"),
@ -165,7 +165,7 @@ add_test(function test_getResourceAuthenticator() {
do_check_true("authorization" in output.headers);
do_check_true(output.headers.authorization.startsWith("Hawk"));
_("Expected internal state after successful call.");
do_check_eq(globalBrowseridManager._token.uid, globalIdentityConfig.fxaccount.token.uid);
do_check_eq(browseridManager._token.uid, identityConfig.fxaccount.token.uid);
run_next_test();
}
);
@ -174,13 +174,13 @@ add_test(function test_getRESTRequestAuthenticator() {
_("BrowserIDManager supplies a REST Request Authenticator callback which sets a Hawk header on a request object.");
let request = new SyncStorageRequest(
"https://example.net/somewhere/over/the/rainbow");
let authenticator = globalBrowseridManager.getRESTRequestAuthenticator();
let authenticator = browseridManager.getRESTRequestAuthenticator();
do_check_true(!!authenticator);
let output = authenticator(request, "GET");
do_check_eq(request.uri, output.uri);
do_check_true(output._headers.authorization.startsWith("Hawk"));
do_check_true(output._headers.authorization.includes("nonce"));
do_check_true(globalBrowseridManager.hasValidToken());
do_check_true(browseridManager.hasValidToken());
run_next_test();
}
);
@ -228,7 +228,7 @@ add_test(function test_resourceAuthenticatorSkew() {
do_check_eq(fxa.localtimeOffsetMsec, localtimeOffsetMsec);
// Mocks within mocks...
configureFxAccountIdentity(browseridManager, globalIdentityConfig);
configureFxAccountIdentity(browseridManager, identityConfig);
// Ensure the new FxAccounts mock has a signed-in user.
fxa.internal.currentAccountState.signedInUser = browseridManager._fxaService.internal.currentAccountState.signedInUser;
@ -281,7 +281,7 @@ add_test(function test_RESTResourceAuthenticatorSkew() {
fxa.internal._now_is = now;
fxa.internal.fxAccountsClient = fxaClient;
configureFxAccountIdentity(browseridManager, globalIdentityConfig);
configureFxAccountIdentity(browseridManager, identityConfig);
// Ensure the new FxAccounts mock has a signed-in user.
fxa.internal.currentAccountState.signedInUser = browseridManager._fxaService.internal.currentAccountState.signedInUser;
@ -307,42 +307,42 @@ add_test(function test_RESTResourceAuthenticatorSkew() {
});
add_task(async function test_ensureLoggedIn() {
configureFxAccountIdentity(globalBrowseridManager);
await globalBrowseridManager.initializeWithCurrentIdentity();
await globalBrowseridManager.whenReadyToAuthenticate.promise;
configureFxAccountIdentity(browseridManager);
await browseridManager.initializeWithCurrentIdentity();
await browseridManager.whenReadyToAuthenticate.promise;
Assert.equal(Status.login, LOGIN_SUCCEEDED, "original initialize worked");
await globalBrowseridManager.ensureLoggedIn();
await browseridManager.ensureLoggedIn();
Assert.equal(Status.login, LOGIN_SUCCEEDED, "original ensureLoggedIn worked");
Assert.ok(globalBrowseridManager._shouldHaveSyncKeyBundle,
Assert.ok(browseridManager._shouldHaveSyncKeyBundle,
"_shouldHaveSyncKeyBundle should always be true after ensureLogin completes.");
// arrange for no logged in user.
let fxa = globalBrowseridManager._fxaService
let fxa = browseridManager._fxaService
let signedInUser = fxa.internal.currentAccountState.storageManager.accountData;
fxa.internal.currentAccountState.storageManager.accountData = null;
globalBrowseridManager.initializeWithCurrentIdentity();
Assert.ok(!globalBrowseridManager._shouldHaveSyncKeyBundle,
browseridManager.initializeWithCurrentIdentity();
Assert.ok(!browseridManager._shouldHaveSyncKeyBundle,
"_shouldHaveSyncKeyBundle should be false so we know we are testing what we think we are.");
Status.login = LOGIN_FAILED_NO_USERNAME;
await Assert.rejects(globalBrowseridManager.ensureLoggedIn(), "expecting rejection due to no user");
Assert.ok(globalBrowseridManager._shouldHaveSyncKeyBundle,
await Assert.rejects(browseridManager.ensureLoggedIn(), "expecting rejection due to no user");
Assert.ok(browseridManager._shouldHaveSyncKeyBundle,
"_shouldHaveSyncKeyBundle should always be true after ensureLogin completes.");
// Restore the logged in user to what it was.
fxa.internal.currentAccountState.storageManager.accountData = signedInUser;
Status.login = LOGIN_FAILED_LOGIN_REJECTED;
await Assert.rejects(globalBrowseridManager.ensureLoggedIn(),
await Assert.rejects(browseridManager.ensureLoggedIn(),
"LOGIN_FAILED_LOGIN_REJECTED should have caused immediate rejection");
Assert.equal(Status.login, LOGIN_FAILED_LOGIN_REJECTED,
"status should remain LOGIN_FAILED_LOGIN_REJECTED");
Status.login = LOGIN_FAILED_NETWORK_ERROR;
await globalBrowseridManager.ensureLoggedIn();
await browseridManager.ensureLoggedIn();
Assert.equal(Status.login, LOGIN_SUCCEEDED, "final ensureLoggedIn worked");
});
add_test(function test_tokenExpiration() {
_("BrowserIDManager notices token expiration:");
let bimExp = new BrowserIDManager();
configureFxAccountIdentity(bimExp, globalIdentityConfig);
configureFxAccountIdentity(bimExp, identityConfig);
let authenticator = bimExp.getResourceAuthenticator();
do_check_true(!!authenticator);
@ -450,17 +450,17 @@ add_task(async function test_refreshCertificateOn401() {
let getCertCount = 0;
let CheckSignMockFxAClient = function() {
let MockFxAccountsClient = function() {
FxAccountsClient.apply(this);
};
CheckSignMockFxAClient.prototype = {
MockFxAccountsClient.prototype = {
__proto__: FxAccountsClient.prototype,
signCertificate() {
++getCertCount;
}
};
let mockFxAClient = new CheckSignMockFxAClient();
let mockFxAClient = new MockFxAccountsClient();
browseridManager._fxaService.internal._fxAccountsClient = mockFxAClient;
let didReturn401 = false;
@ -747,12 +747,13 @@ add_task(async function test_signedInUserMissing() {
_("BrowserIDManager detects getSignedInUser returning incomplete account data");
let browseridManager = new BrowserIDManager();
makeIdentityConfig();
// Delete stored keys and the key fetch token.
delete globalIdentityConfig.fxaccount.user.kA;
delete globalIdentityConfig.fxaccount.user.kB;
delete globalIdentityConfig.fxaccount.user.keyFetchToken;
delete identityConfig.fxaccount.user.kA;
delete identityConfig.fxaccount.user.kB;
delete identityConfig.fxaccount.user.keyFetchToken;
configureFxAccountIdentity(browseridManager, globalIdentityConfig);
configureFxAccountIdentity(browseridManager, identityConfig);
let fxa = new FxAccounts({
fetchAndUnwrapKeys() {
@ -766,7 +767,7 @@ add_task(async function test_signedInUserMissing() {
throw new Error("Not expecting to have credentials passed");
}
let storageManager = new MockFxaStorageManager();
storageManager.initialize(globalIdentityConfig.fxaccount.user);
storageManager.initialize(identityConfig.fxaccount.user);
return new AccountState(storageManager);
},
});
@ -844,10 +845,10 @@ async function initializeIdentityWithHAWKResponseFactory(config, cbGetResponse)
}
let fxa = new FxAccounts(internal);
globalBrowseridManager._fxaService = fxa;
globalBrowseridManager._signedInUser = null;
await globalBrowseridManager.initializeWithCurrentIdentity();
await Assert.rejects(globalBrowseridManager.whenReadyToAuthenticate.promise,
browseridManager._fxaService = fxa;
browseridManager._signedInUser = null;
await browseridManager.initializeWithCurrentIdentity();
await Assert.rejects(browseridManager.whenReadyToAuthenticate.promise,
"expecting rejection due to hawk error");
}

Просмотреть файл

@ -121,7 +121,7 @@ add_task(async function test_processIncoming_mobile_history_batched() {
do_check_eq(collection.get_log[4].full, undefined);
do_check_eq(collection.get_log[4].sort, "index");
do_check_eq(collection.get_log[4].limit, MAX_HISTORY_DOWNLOAD);
for (i = 0; i <= Math.floor((234 - 50) / MOBILE_BATCH_SIZE); i++) {
for (let i = 0; i <= Math.floor((234 - 50) / MOBILE_BATCH_SIZE); i++) {
let j = i + 5;
do_check_eq(collection.get_log[j].full, 1);
do_check_eq(collection.get_log[j].limit, undefined);

Просмотреть файл

@ -114,15 +114,15 @@ add_test(function test_info_collections() {
do_check_eq(this.response.body, "{}");
Utils.nextTick(function() {
// When we PUT something to crypto/keys, "crypto" appears in the response.
function cb(err2) {
do_check_eq(null, err2);
function cb(err) {
do_check_eq(null, err);
responseHasCorrectHeaders(this.response);
let putResponseBody = this.response.body;
_("PUT response body: " + JSON.stringify(putResponseBody));
req = localRequest(server, "/1.1/john/info/collections");
req.get(function(err3) {
do_check_eq(null, err3);
req.get(function(err) {
do_check_eq(null, err);
responseHasCorrectHeaders(this.response);
let expectedColl = server.getCollection("john", "crypto");
do_check_true(!!expectedColl);
@ -275,7 +275,7 @@ add_test(function test_x_weave_records() {
// WBO fetches don't have one.
do_check_false("x-weave-records" in this.response.headers);
let col = localRequest(server, "/1.1/john/storage/crypto");
col.get(function(err2) {
col.get(function(err) {
// Collection fetches do.
do_check_eq(this.response.headers["x-weave-records"], "2");
server.stop(run_next_test);

Просмотреть файл

@ -7,6 +7,8 @@ Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/util.js");
var logger;
var fetched = false;
function server_open(metadata, response) {
let body;

Просмотреть файл

@ -270,10 +270,10 @@ add_test(function test_get() {
do_check_eq(res.data, content);
// Observe logging messages.
let resLogger = res._log;
let dbg = resLogger.debug;
let logger = res._log;
let dbg = logger.debug;
let debugMessages = [];
resLogger.debug = function(msg) {
logger.debug = function(msg) {
debugMessages.push(msg);
dbg.call(this, msg);
}
@ -290,7 +290,7 @@ add_test(function test_get() {
do_check_eq(debugMessages.length, 1);
do_check_eq(debugMessages[0],
"Parse fail: Response body starts: \"\"This path exists\"\".");
resLogger.debug = dbg;
logger.debug = dbg;
run_next_test();
});

Просмотреть файл

@ -168,10 +168,10 @@ add_task(async function test_wipeServer() {
const PAYLOAD = 42;
let steamCollection = new ServerWBO("steam", PAYLOAD);
let steamServer = httpd_setup({
let server = httpd_setup({
"/1.1/foo/storage/steam": steamCollection.handler()
});
await SyncTestingInfrastructure(steamServer);
await SyncTestingInfrastructure(server);
do_test_pending();
try {
@ -186,7 +186,7 @@ add_task(async function test_wipeServer() {
do_check_eq(engine.toFetch.length, 0);
} finally {
steamServer.stop(do_test_finished);
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
}
});

Просмотреть файл

@ -1139,8 +1139,8 @@ add_task(async function test_processIncoming_failed_records() {
// Keep track of requests made of a collection.
let count = 0;
let uris = [];
function recording_handler(recordedCollection) {
let h = recordedCollection.handler();
function recording_handler(collection) {
let h = collection.handler();
return function(req, res) {
++count;
uris.push(req.path + "?" + req.queryString);

Просмотреть файл

@ -347,7 +347,7 @@ add_task(async function test_generic_engine_fail() {
JSON.stringify(engine._tracker.changedIDs)}`);
let ping = await sync_and_validate_telem(true);
equal(ping.status.service, SYNC_FAILED_PARTIAL);
deepEqual(ping.engines.find(err => err.name === "steam").failureReason, {
deepEqual(ping.engines.find(e => e.name === "steam").failureReason, {
name: "unexpectederror",
error: String(e)
});

Просмотреть файл

@ -28,17 +28,17 @@ function run_test() {
let state = 0;
let makeObs = function(topic) {
let obj2 = {
observe(subject, obsTopic, data) {
let obj = {
observe(subject, topic, data) {
this.state = ++state;
this.subject = subject;
this.topic = obsTopic;
this.topic = topic;
this.data = data;
}
};
Svc.Obs.add(topic, obj2);
return obj2;
Svc.Obs.add(topic, obj);
return obj;
};
_("Make sure a normal call will call and return with notifications");