зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1237726, part 1 - Set prefs with pushPrefEnv in mixedcontentblocker/test_main.html. r=tanvi
This commit is contained in:
Родитель
c6c843f5bd
Коммит
164c42ece5
|
@ -14,7 +14,7 @@ support-files =
|
||||||
file_server.sjs
|
file_server.sjs
|
||||||
|
|
||||||
[test_main.html]
|
[test_main.html]
|
||||||
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC
|
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC
|
||||||
[test_bug803225.html]
|
[test_bug803225.html]
|
||||||
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC
|
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC
|
||||||
[test_frameNavigation.html]
|
[test_frameNavigation.html]
|
||||||
|
|
|
@ -13,9 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
||||||
<script>
|
<script>
|
||||||
SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
||||||
|
|
||||||
var origBlockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
|
|
||||||
var origBlockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
|
|
||||||
|
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var settings = [ [true, true], [true, false], [false, true], [false, false] ];
|
var settings = [ [true, true], [true, false], [false, true], [false, false] ];
|
||||||
|
|
||||||
|
@ -23,16 +20,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
||||||
var blockDisplay;
|
var blockDisplay;
|
||||||
|
|
||||||
//Cycle through 4 different preference settings.
|
//Cycle through 4 different preference settings.
|
||||||
function changePrefs(x) {
|
function changePrefs(otherPrefs, callback) {
|
||||||
SpecialPowers.setBoolPref("security.mixed_content.block_display_content", settings[x][0]);
|
let basePrefs = [["security.mixed_content.block_display_content", settings[counter][0]],
|
||||||
SpecialPowers.setBoolPref("security.mixed_content.block_active_content", settings[x][1]);
|
["security.mixed_content.block_active_content", settings[counter][1]]];
|
||||||
blockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
|
let newPrefs = basePrefs.concat(otherPrefs);
|
||||||
blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set the first set of settings (true, true) and increment the counter.
|
SpecialPowers.pushPrefEnv({"set": newPrefs}, function () {
|
||||||
changePrefs(counter);
|
blockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
|
||||||
counter++;
|
blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
|
||||||
|
counter++;
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var testsToRun = {
|
var testsToRun = {
|
||||||
iframe: false,
|
iframe: false,
|
||||||
|
@ -69,23 +68,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
||||||
testsToRun[prop] = false;
|
testsToRun[prop] = false;
|
||||||
}
|
}
|
||||||
//call to change the preferences
|
//call to change the preferences
|
||||||
changePrefs(counter);
|
changePrefs([], function() {
|
||||||
counter++;
|
log("\nblockDisplay set to "+blockDisplay+", blockActive set to "+blockActive+".");
|
||||||
log("\nblockDisplay set to "+blockDisplay+", blockActive set to "+blockActive+".");
|
reloadFrame();
|
||||||
reloadFrame();
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//set the prefs back to what they were set to originally
|
|
||||||
SpecialPowers.setBoolPref("security.mixed_content.block_display_content", origBlockDisplay);
|
|
||||||
SpecialPowers.setBoolPref("security.mixed_content.block_active_content", origBlockActive);
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstTest = true;
|
var firstTest = true;
|
||||||
|
|
||||||
// listen for a messages from the mixed content test harness
|
|
||||||
window.addEventListener("message", receiveMessage, false);
|
|
||||||
function receiveMessage(event) {
|
function receiveMessage(event) {
|
||||||
if(firstTest) {
|
if(firstTest) {
|
||||||
log("blockActive set to "+blockActive+", blockDisplay set to "+blockDisplay+".");
|
log("blockActive set to "+blockActive+", blockDisplay set to "+blockDisplay+".");
|
||||||
|
@ -167,13 +161,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
||||||
checkTestsCompleted();
|
checkTestsCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable <picture> and <img srcset> for test
|
//Set the first set of mixed content settings and increment the counter.
|
||||||
SpecialPowers.pushPrefEnv({'set': [[ "dom.image.srcset.enabled", true ],
|
//Enable <picture> and <img srcset> for the test.
|
||||||
[ "dom.image.picture.enabled", true ]] },
|
changePrefs([[ "dom.image.srcset.enabled", true ], [ "dom.image.picture.enabled", true ]],
|
||||||
function() {
|
function() {
|
||||||
// Kick off test
|
//listen for a messages from the mixed content test harness
|
||||||
reloadFrame();
|
window.addEventListener("message", receiveMessage, false);
|
||||||
});
|
|
||||||
|
//Kick off test
|
||||||
|
reloadFrame();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче