Bug 1801059: Fix Error syncing tabs in tps tests r=isabel_rios

Differential Revision: https://phabricator.services.mozilla.com/D162442
This commit is contained in:
Sammy Khamis 2022-11-22 18:24:39 +00:00
parent 76a10c5956
commit 2ccba411ac
3 changed files with 8 additions and 9 deletions

View file

@ -17,9 +17,8 @@ var phases = { phase1: "profile1", phase2: "profile2", phase3: "profile1" };
var tabs1 = [
{ uri: "https://www.mozilla.org/en-US/firefox/", profile: "profile1" },
{
uri:
"data:text/html,<html><head><title>Hello</title></head><body>Hello</body></html>",
title: "Hello",
uri: "https://example.com/",
title: "Example Domain",
profile: "profile1",
},
];
@ -27,8 +26,7 @@ var tabs1 = [
var tabs2 = [
{ uri: "https://www.mozilla.org/en-US/contribute/", profile: "profile2" },
{
uri:
"data:text/html,<html><head><title>Bye</title></head><body>Bye</body></html>",
uri: "https://example.com/",
profile: "profile2",
},
];

View file

@ -65,11 +65,12 @@ var BrowserTabs = {
* @param profile The profile to search for tabs
* @return true if the specified tab could be found, otherwise false
*/
Find(uri, title, profile) {
async Find(uri, title, profile) {
// Find the uri in Weave's list of tabs for the given profile.
let tabEngine = Weave.Service.engineManager.get("tabs");
for (let client of Weave.Service.clientsEngine.remoteClients) {
let tabClient = tabEngine.getAllClients().find(x => x.id === client.id);
let tabClients = await tabEngine.getAllClients();
let tabClient = tabClients.find(x => x.id === client.id);
if (!tabClient || !tabClient.tabs) {
continue;
}

View file

@ -353,7 +353,7 @@ var TPS = {
"profile must be defined when verifying tabs"
);
lazy.Logger.AssertTrue(
lazy.BrowserTabs.Find(tab.uri, tab.title, tab.profile),
await lazy.BrowserTabs.Find(tab.uri, tab.title, tab.profile),
"error locating tab"
);
break;
@ -363,7 +363,7 @@ var TPS = {
"profile must be defined when verifying tabs"
);
lazy.Logger.AssertTrue(
!lazy.BrowserTabs.Find(tab.uri, tab.title, tab.profile),
await !lazy.BrowserTabs.Find(tab.uri, tab.title, tab.profile),
"tab found which was expected to be absent"
);
break;