gecko-dev/dom/base/test/test_navigator_resolve_identity.html

51 lines
1.5 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=985827
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 985827</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 985827 **/
function test() {
var is = parent.is;
// Test WebIDL NavigatorProperty objects
var x = navigator.mozContacts;
is(typeof x, "object", "Should have a mozContacts object");
delete navigator.mozContacts;
var y = navigator.mozContacts;
is(x, y, "Should have gotten the same mozContacts object again");
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPermissions([
{type: "contacts-read", allow: true, context: document},
{type: "contacts-write", allow: true, context: document},
{type: "contacts-create", allow: true, context: document},
], function() {
var iframe = document.createElement("iframe");
iframe.src = "data:text/html,<script>(" + escape(test.toString()) + ")();</scr" + "ipt>";
document.body.appendChild(iframe);
iframe.onload = function() { SimpleTest.finish(); };
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=985827">Mozilla Bug 985827</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>