Bug 1560083 - Rewrite error page load in browser_policy_disable_developer_tools.js to avoid race condition. r=Gijs, a=test-only
authorMichael Kaply <mozilla@kaply.com>
Thu, 27 Jun 2019 23:05:55 +0000
changeset 537132 beb982d67cbd13932e82f15e9002624cb1646aee
parent 537131 060e5273db16d8e5fccbe0b501909a88f1763bdb
child 537133 d77755aee6dedf20ac61ddc6c5376a42ec9c331d
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, test-only
bugs1560083
milestone68.0
Bug 1560083 - Rewrite error page load in browser_policy_disable_developer_tools.js to avoid race condition. r=Gijs, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D35713
browser/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js
--- a/browser/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js
+++ b/browser/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js
@@ -29,16 +29,17 @@ add_task(async function test_updates_pos
   ok(toolsMenu.hidden, "The Web Developer item of the tools menu is hidden");
   let hamburgerMenu = window.document.getElementById("appMenu-developer-button");
   ok(hamburgerMenu.hidden, "The Web Developer item of the hamburger menu is hidden");
 
   BrowserTestUtils.removeTab(tab);
 });
 
 const expectErrorPage = async function(url) {
-  info(`Wait for ${url} to open the net error page`);
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url, false);
-  await ContentTask.spawn(tab.linkedBrowser, null, async function() {
-    ok(content.document.documentURI.startsWith("about:neterror"),
-       "DevTools about: page should display the net error page");
+  await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, async (browser) => {
+    BrowserTestUtils.loadURI(browser, url);
+    await BrowserTestUtils.browserLoaded(browser, false, url, true);
+    await ContentTask.spawn(browser, url, async function() {
+      ok(content.document.documentURI.startsWith("about:neterror?e=blockedByPolicy"),
+      content.document.documentURI + " should start with about:neterror?e=blockedByPolicy");
+    });
   });
-  BrowserTestUtils.removeTab(tab);
 };