Bug 1720535: Add https-first-disabled annotation to mochitest harness r=ahal

Differential Revision: https://phabricator.services.mozilla.com/D119970
This commit is contained in:
Christoph Kerschbaumer 2021-07-26 16:47:45 +00:00
parent adf989bb23
commit 5a0e65f9c3
4 changed files with 22 additions and 0 deletions

View File

@ -110,6 +110,7 @@
function browserTest(aTestFile) {
this.path = aTestFile['url'];
this.expected = aTestFile['expected'];
this.https_first_disabled = aTestFile['https_first_disabled'] || false,
this.dumper = gDumper;
this.results = [];
this.scope = null;

View File

@ -797,6 +797,14 @@ Tester.prototype = {
name
);
let time = Date.now() - this.lastStartTime;
// HTTPS-First (Bug 1704453) TODO: in case a test is annoated
// with https_first_disabled then we explicitly flip the pref
// dom.security.https_first to false for the duration of the test.
if (this.currentTest.https_first_disabled) {
window.SpecialPowers.popPrefEnv();
}
this.structuredLogger.testEnd(
this.currentTest.path,
"OK",
@ -955,6 +963,15 @@ Tester.prototype = {
));
let currentTest = this.currentTest;
// HTTPS-First (Bug 1704453) TODO: in case a test is annoated
// with https_first_disabled then we explicitly flip the pref
// dom.security.https_first to false for the duration of the test.
if (currentTest.https_first_disabled) {
window.SpecialPowers.pushPrefEnv({
set: [["dom.security.https_first", false]],
});
}
// Import utils in the test scope.
let { scope } = this.currentTest;
scope.EventUtils = this.EventUtils;

View File

@ -30,6 +30,7 @@ function parseTestManifest(testManifest, params, callback) {
test: {
url: name,
expected: obj.expected,
https_first_disabled: obj.https_first_disabled,
},
};
} else {
@ -41,6 +42,7 @@ function parseTestManifest(testManifest, params, callback) {
test: {
url: name,
expected: obj.expected,
https_first_disabled: obj.https_first_disabled,
},
});
}

View File

@ -1627,6 +1627,8 @@ toolbar#nav-bar {
testob["disabled"] = test["disabled"]
if "expected" in test:
testob["expected"] = test["expected"]
if "https_first_disabled" in test:
testob["https_first_disabled"] = test["https_first_disabled"] == "true"
if "scheme" in test:
testob["scheme"] = test["scheme"]
if "tags" in test: