From 2790ca829ab6c1b1dc2f3916ce38e7ec076f54e1 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 11 Oct 2017 20:03:11 -0700 Subject: [PATCH] Bug 1404652: Follow-up: Fix timing issues in webRequest HSTS tests. MozReview-Commit-ID: HFW73u6wp5S --HG-- extra : rebase_source : 6238ba74796e650b3a6cb9ce4c8d8354db976ab6 --- .../extensions/test/mochitest/test_ext_webrequest_hsts.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html index a75593067f2f..31c9009fc191 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html @@ -54,6 +54,7 @@ add_task(async function test_hsts_request() { }, {urls}); browser.webRequest.onCompleted.addListener(details => { browser.test.assertEq(expect.shift(), "onCompleted"); + browser.test.sendMessage("onCompleted", details.url); }, {urls}); browser.webRequest.onErrorOccurred.addListener(details => { browser.test.notifyFail(`onErrorOccurred ${JSON.stringify(details)}`); @@ -84,6 +85,7 @@ add_task(async function test_hsts_request() { "onResponseStarted", "onCompleted"]); // redirect_auto adds a query string ok((await extension.awaitMessage("tabs-done")).startsWith(sample), "redirection ok"); + ok((await extension.awaitMessage("onCompleted")).startsWith(sample), "redirection ok"); // priming hsts extension.sendMessage(`https://${testPath}/hsts.sjs`, @@ -92,6 +94,8 @@ add_task(async function test_hsts_request() { is(await extension.awaitMessage("tabs-done"), "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs", "hsts primed"); + is(await extension.awaitMessage("onCompleted"), + "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs"); // test upgrade extension.sendMessage(`http://${testPath}/hsts.sjs`, @@ -101,6 +105,8 @@ add_task(async function test_hsts_request() { is(await extension.awaitMessage("tabs-done"), "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs", "hsts upgraded"); + is(await extension.awaitMessage("onCompleted"), + "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs"); await extension.unload(); });