Bug 1596918: Part 4f - Fix callers which have timing issues. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D53747

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2019-12-06 22:15:31 +00:00
Родитель 41c61c2bb9
Коммит 7f21292ff1
4 изменённых файлов: 16 добавлений и 12 удалений

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

@ -161,9 +161,10 @@ function promiseTabLoadEvent(tab, url) {
* Wait for the search engine to change.
*/
function promiseContentSearchChange(browser, newEngineName) {
return SpecialPowers.spawn(browser, [{ newEngineName }], async function(
args
) {
// Callers of this depend on very specific, very racy timing, and fail
// if we introduce the trip through SpecialPowersParent that
// SpecialPowers.spawn requires.
return ContentTask.spawn(browser, { newEngineName }, async function(args) {
return new Promise(resolve => {
content.addEventListener("ContentSearchService", function listener(
aEvent

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

@ -175,12 +175,13 @@ add_task(async function check_permission_state_change() {
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
// Check if a popup opens.
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
let open = content.document.getElementById("pop");
open.click();
});
await BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
await Promise.all([
SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
let open = content.document.getElementById("pop");
open.click();
}),
BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen"),
]);
await BrowserTestUtils.waitForCondition(
() => popup.linkedBrowser.currentURI.spec != "about:blank"
);

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

@ -385,7 +385,7 @@ add_task(async function() {
await openSiteDataSettingsDialog();
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
let frameDoc = content.gSubDialog._topDialog._frame.contentDocument;
let siteItems = frameDoc.getElementsByTagName("richlistitem");

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

@ -37,8 +37,10 @@ add_task(async function() {
// Click the link in file_bug1554070_2.html. It should open example.org in
// a new tab.
await click();
await BrowserTestUtils.waitForNewTab(gBrowser, URL2, true);
await Promise.all([
click(),
BrowserTestUtils.waitForNewTab(gBrowser, URL2, true),
]);
is(gBrowser.tabs.length, 3, "got new tab");
is(gBrowser.currentURI.spec, URL2, "loaded example.org");