|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=629535 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 629535</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629535">Mozilla Bug 629535</a> |
|
13 |
|
14 <script type="application/javascript"> |
|
15 |
|
16 const dntPref = 'privacy.donottrackheader.enabled'; |
|
17 |
|
18 SimpleTest.waitForExplicitFinish(); |
|
19 |
|
20 is(SpecialPowers.getBoolPref(dntPref), false, |
|
21 'DNT should be disabled by default'); |
|
22 is(navigator.doNotTrack, 'unspecified', |
|
23 'navigator.doNotTrack should initially be "unspecified".'); |
|
24 |
|
25 SpecialPowers.pushPrefEnv({"clear": [[dntPref]]}, test1); |
|
26 |
|
27 function test1() { |
|
28 is(navigator.doNotTrack, "unspecified", 'after clearing pref'); |
|
29 SpecialPowers.pushPrefEnv({"set": [[dntPref, true]]}, test2); |
|
30 } |
|
31 |
|
32 function test2() { |
|
33 is(navigator.doNotTrack, "yes", 'after setting pref to true'); |
|
34 SpecialPowers.pushPrefEnv({"set": [[dntPref, false]]}, test3); |
|
35 } |
|
36 |
|
37 function test3() { |
|
38 is(navigator.doNotTrack, "unspecified", 'after setting pref to false'); |
|
39 SimpleTest.finish(); |
|
40 } |
|
41 |
|
42 </script> |
|
43 |
|
44 </body> |
|
45 </html> |
|
46 |