gecko-dev/dom/bindings/test/test_bug707564-chrome.html
Peter Van der Beken f781f02ccd Bug 1245650 - remove JavaScript-navigator-property category support. r=bz.
Generate normal properties with getters for things marked as NavigatorProperty,
instead of defining these from a resolve hook.
2016-02-05 20:20:08 +01:00

67 lines
2.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=707564
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 707564</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=707564">Mozilla Bug 707564</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t1" src="http://example.org/tests/dom/bindings/test/file_bug707564.html"></iframe>
<iframe id="t2"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 775543 **/
function test()
{
var nav = document.getElementById("t1").contentWindow.navigator;
is(nav.foopy, undefined, "We should have an Xray now");
is(nav.wrappedJSObject.foopy, 5, "We should have the right navigator object");
var props = Object.getOwnPropertyNames(Object.getPrototypeOf(nav));
isnot(props.indexOf("mozContacts"), -1,
"Should enumerate a mozContacts property on navigator xray");
var nav = document.getElementById("t2").contentWindow.navigator;
is(nav.foopy, undefined, "We should have an Xray now again");
is(nav.wrappedJSObject.foopy, 5, "We should have the right navigator object again");
var found = false;
for (var name in nav) {
if (name == "mozContacts") {
found = true;
}
}
ok(found, "Should enumerate a mozContacts property on navigator xray via for...in");
SimpleTest.finish();
}
onload = test;
onload = function() {
var iframe1 = document.getElementById("t1");
SpecialPowers.pushPermissions([
{type: "contacts-read", allow: true, context: iframe1.contentDocument},
{type: "contacts-write", allow: true, context: iframe1.contentDocument},
{type: "contacts-create", allow: true, context: iframe1.contentDocument},
], function() {
iframe1.src = "http://example.org/tests/dom/bindings/test/file_bug707564.html";
iframe1.onload = function() {
var iframe2 = document.getElementById("t2");
iframe2.src = "http://example.org/tests/dom/bindings/test/file_bug707564.html";
iframe2.onload = test;
};
});
};
</script>
</pre>
</body>
</html>