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/tests/mochitest/bugs/test_bug641552.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/tests/mochitest/bugs/test_bug641552.html')
-rw-r--r-- | dom/tests/mochitest/bugs/test_bug641552.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/dom/tests/mochitest/bugs/test_bug641552.html b/dom/tests/mochitest/bugs/test_bug641552.html new file mode 100644 index 000000000..ab76c74a3 --- /dev/null +++ b/dom/tests/mochitest/bugs/test_bug641552.html @@ -0,0 +1,88 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=641552 +--> +<head> + <title>Test for Bug 641552</title> + <script type="application/javascript" src="/MochiKit/packed.js"></script> + <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=641552">Mozilla Bug 641552</a> +<p id="display"></p> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 641552 **/ + +SimpleTest.waitForExplicitFinish(); + +var contractId = "@mozilla.org/xmlextras/xmlhttprequest;1"; +var categoryEntries = [ + {category: "JavaScript-global-property", entry: "randomname", contractId: contractId}, +]; + +function addCategoryEntries(func) { + for (var categoryEntry of categoryEntries) { + SpecialPowers.addCategoryEntry(categoryEntry.category, categoryEntry.entry, categoryEntry.contractId, + false, true); + } + SimpleTest.executeSoon(func); +} + +function removeCategoryEntries(func) { + for (var categoryEntry of categoryEntries) { + SpecialPowers.deleteCategoryEntry(categoryEntry.category, categoryEntry.entry, false); + } + SimpleTest.executeSoon(func); +} + +function checkNamesPresent() { + ok(window.randomname, "window.randomname should return an object"); +} + +function checkNamesAbsent() { + ok(!window.randomname, "window.randomname should return undefined"); +} + +// Ensure the initial state +checkNamesAbsent(); + +addCategoryEntries(function test1() { + ok(window.randomname, "window.randomname should return an object"); + + delete window.randomname; + + // The delete opertor should have no effect as long as the category entry is registered. + checkNamesPresent(); + + removeCategoryEntries(test2); +}); + +function test2() { + // The object should be cached on the global/navigator object once accessed. + checkNamesPresent(); + + delete window.randomname; + + // Now the delete opertor should have the effect. + checkNamesAbsent(); + + addCategoryEntries(function() { + removeCategoryEntries(test3); + }); +} + +function test3() { + // The object should not be cached until the first access. + checkNamesAbsent(); + + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> |