Bug 1716452 - Fix test_ext_webrequest_auth.html intermittent failures. r=mixedpuppy
commitc07f2abb1ab896617f2774722f17bda9639c57c9
authorLuca Greco <lgreco@mozilla.com>
Wed, 14 Jul 2021 17:10:53 +0000 (14 17:10 +0000)
committerLuca Greco <lgreco@mozilla.com>
Wed, 14 Jul 2021 17:10:53 +0000 (14 17:10 +0000)
treeed7b8b42aa1599f4d054e06fe011e2410df94abb
parent1f3750875e1ec1470f2138a07dca738cca91d9e0
Bug 1716452 - Fix test_ext_webrequest_auth.html intermittent failures. r=mixedpuppy

This patch fixes the intermittent failures being triggered by test_ext_webrequest_auth.html by making sure that
the "http-on-modify-request" observers added by the test tasks part of this test file are going to ignore any http
request that isn't related to the mochi.test url that is expected to trigger the authentication dialog.

With the previous version of the chrome script executed by these two test tasks, there was a chance that the observer
would be setting the mocked nsIAuthPromptProvider/nsIauthPromp2 notification callback on the wrong channel, if
the http channel was also related to the mochi.test host. After that the observer was removed and it would not be
setting the notificationCallbacks on the channel that was meant to set it on (and that would make the testcase to
trigger the actual authentication prompt that can be seen in the failure screenshots).

As part of this patch we are also reverting the additional debugging logs added in a previous patch attached to
this issue.

Differential Revision: https://phabricator.services.mozilla.com/D119880
toolkit/components/extensions/test/mochitest/test_ext_webrequest_auth.html
toolkit/components/extensions/webrequest/WebRequest.jsm