gecko/js/xpconnect/tests/mochitest/chrome_wrappers_helper.html
Bobby Holley 5c79d2757f Bug 739796 - Make js_TransplantObjectWithWrapper and GetSameCompartmentSecurityWrapper play nicely together. r=mrbkap
--HG--
extra : rebase_source : c132069987b4cae121dfcf1b19ffacaee845df1e
2012-04-05 12:21:12 -07:00

37 lines
1.7 KiB
HTML

<html>
<head>
<script>
function check_wrapper(ok, wrapper, expected, note) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
ok(utils.getClassName(wrapper) === expected, note);
}
function check_parent(ok, obj, expected, note) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
ok(utils.getParent(obj) === expected, note);
}
function run_test(ok, xpcnw, sjow) {
// both wrappers should point to our window: XOW
check_wrapper(ok, ok, "Proxy", "functions are wrapped properly")
check_parent(ok, ok, window, "ok is parented correctly");
check_wrapper(ok, xpcnw, "Proxy", "XPCNWs are transformed correctly");
check_wrapper(ok, sjow, "Proxy", "SJOWs are transformed correctly");
check_wrapper(ok, window.location, "Proxy",
"Content needs a same-compartment security wrappers around location");
ok(defprop1 === 1, "defprop1 exists");
window.defprop1 = 2;
ok(defprop1 === 2, "defprop1 is properly writable");
// defprop2 = {}; disabled because the test doesn't work
}
</script>
</head>
<body>
</body>
</html>