Bug 1707823 - [devtools] Make navigateTo more secure. r=ochameau.

In the `BrowserTestUtils.browserLoaded` call we use in `navigateTo`, we weren't
checking for a specific uri to be loaded, which means the Promise could resolve
on *any* page being loaded.
This patch makes it more secure by waiting the load event for the uri we navigated to.

Differential Revision: https://phabricator.services.mozilla.com/D113479
This commit is contained in:
Nicolas Chevobbe 2021-04-28 07:52:21 +00:00
Родитель 4589016d4c
Коммит 13980e9a4f
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -491,8 +491,10 @@ async function navigateTo(uri, { isErrorPage = false } = {}) {
const currentBrowsingContextID = browser.browsingContext.id;
const onBrowserLoaded = BrowserTestUtils.browserLoaded(
browser,
// includeSubFrames
false,
null,
// resolve on this specific page to load (if null, it would be any page load)
uri,
isErrorPage
);
BrowserTestUtils.loadURI(browser, uri);