diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/base/test/test_bug1281963.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/test_bug1281963.html')
-rw-r--r-- | dom/base/test/test_bug1281963.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/base/test/test_bug1281963.html b/dom/base/test/test_bug1281963.html new file mode 100644 index 000000000..013a03864 --- /dev/null +++ b/dom/base/test/test_bug1281963.html @@ -0,0 +1,68 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/1281963 +--> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Test for Bug 1281963</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"></p> +<div id="content"></div> + +<script class="testbody" type="application/javascript;version=1.7"> + +// __setPref(key, value)__. +// Set a pref value asynchronously, returning a promise that resolves +// when it succeeds. +let setPref = function* (key, value) { + return new Promise(function(resolve, reject) { + SpecialPowers.pushPrefEnv({"set": [[key, value]]}, resolve); + }); +}; + +// Run a test to see that we don't expose the supported mimeTypes +// or installed plugins when "privacy.resistFingerprinting" is active. +add_task(function* () { + let exampleMimeType = undefined, + examplePlugin = undefined; + // Disable fingerprinting resistance. + yield setPref("privacy.resistFingerprinting", false); + // Depending on the testing platform, we may have at least + // one mimeType and plugin available. + exampleMimeType = navigator.mimeTypes[0]; + examplePlugin = navigator.plugins[0]; + + // First check that we can retrieve mimeType or plugin by name and that + // the array length is nonzero. + if (exampleMimeType) { + isnot(navigator.mimeTypes[exampleMimeType.type], undefined, "Should reveal mime type"); + isnot(navigator.mimeTypes.length, 0, "navigator.mimeTypes.length should be nonzero"); + } + if (examplePlugin) { + isnot(navigator.plugins[examplePlugin.name], undefined, "Should reveal plugin"); + isnot(navigator.plugins.length, 0, "navigator.plugins.length should be nonzero"); + } + + // Now test with fingerprinting resistance enabled + yield setPref("privacy.resistFingerprinting", true); + if (exampleMimeType) { + is(navigator.mimeTypes[exampleMimeType.type], undefined, "Don't reveal mime type"); + } + is(navigator.mimeTypes[0], undefined, "Don't reveal mime type"); + is(navigator.mimeTypes.length, 0, "navigator.mimeTypes.length should be 0"); + if (examplePlugin) { + is(navigator.plugins[examplePlugin.name], undefined, "Don't reveal plugin"); + } + is(navigator.plugins[0], undefined, "Don't reveal plugin"); + is(navigator.plugins.length, 0, "navigator.plugins.length should be 0"); +}); + +</script> + +</body> +</html> |