gecko/dom/tests/mochitest/general/test_bug629535.html

47 lines
1.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=629535
-->
<head>
<title>Test for Bug 629535</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629535">Mozilla Bug 629535</a>
<script type="application/javascript">
const dntPref = 'privacy.donottrackheader.enabled';
SimpleTest.waitForExplicitFinish();
is(SpecialPowers.getBoolPref(dntPref), false,
'DNT should be disabled by default');
is(navigator.doNotTrack, 'unspecified',
'navigator.doNotTrack should initially be "unspecified".');
SpecialPowers.pushPrefEnv({"clear": [[dntPref]]}, test1);
function test1() {
is(navigator.doNotTrack, "unspecified", 'after clearing pref');
SpecialPowers.pushPrefEnv({"set": [[dntPref, true]]}, test2);
}
function test2() {
is(navigator.doNotTrack, "yes", 'after setting pref to true');
SpecialPowers.pushPrefEnv({"set": [[dntPref, false]]}, test3);
}
function test3() {
is(navigator.doNotTrack, "unspecified", 'after setting pref to false');
SimpleTest.finish();
}
</script>
</body>
</html>