зеркало из 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
|
||||
|
||||
[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]
|
||||
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]
|
||||
|
|
|
@ -13,9 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
|||
<script>
|
||||
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 settings = [ [true, true], [true, false], [false, true], [false, false] ];
|
||||
|
||||
|
@ -23,16 +20,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
|||
var blockDisplay;
|
||||
|
||||
//Cycle through 4 different preference settings.
|
||||
function changePrefs(x) {
|
||||
SpecialPowers.setBoolPref("security.mixed_content.block_display_content", settings[x][0]);
|
||||
SpecialPowers.setBoolPref("security.mixed_content.block_active_content", settings[x][1]);
|
||||
function changePrefs(otherPrefs, callback) {
|
||||
let basePrefs = [["security.mixed_content.block_display_content", settings[counter][0]],
|
||||
["security.mixed_content.block_active_content", settings[counter][1]]];
|
||||
let newPrefs = basePrefs.concat(otherPrefs);
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": newPrefs}, function () {
|
||||
blockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
|
||||
blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
|
||||
}
|
||||
|
||||
//Set the first set of settings (true, true) and increment the counter.
|
||||
changePrefs(counter);
|
||||
counter++;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
var testsToRun = {
|
||||
iframe: false,
|
||||
|
@ -69,23 +68,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
|||
testsToRun[prop] = false;
|
||||
}
|
||||
//call to change the preferences
|
||||
changePrefs(counter);
|
||||
counter++;
|
||||
changePrefs([], function() {
|
||||
log("\nblockDisplay set to "+blockDisplay+", blockActive set to "+blockActive+".");
|
||||
reloadFrame();
|
||||
});
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
var firstTest = true;
|
||||
|
||||
// listen for a messages from the mixed content test harness
|
||||
window.addEventListener("message", receiveMessage, false);
|
||||
function receiveMessage(event) {
|
||||
if(firstTest) {
|
||||
log("blockActive set to "+blockActive+", blockDisplay set to "+blockDisplay+".");
|
||||
|
@ -167,13 +161,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178
|
|||
checkTestsCompleted();
|
||||
}
|
||||
|
||||
// Enable <picture> and <img srcset> for test
|
||||
SpecialPowers.pushPrefEnv({'set': [[ "dom.image.srcset.enabled", true ],
|
||||
[ "dom.image.picture.enabled", true ]] },
|
||||
//Set the first set of mixed content settings and increment the counter.
|
||||
//Enable <picture> and <img srcset> for the test.
|
||||
changePrefs([[ "dom.image.srcset.enabled", true ], [ "dom.image.picture.enabled", true ]],
|
||||
function() {
|
||||
// Kick off test
|
||||
//listen for a messages from the mixed content test harness
|
||||
window.addEventListener("message", receiveMessage, false);
|
||||
|
||||
//Kick off test
|
||||
reloadFrame();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче