js/xpconnect/tests/mochitest/chrome_wrappers_helper.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:4704bd5695ea
1 <html>
2 <head>
3 <script>
4 function check_wrapper(ok, wrapper, expected, note) {
5
6 var utils = SpecialPowers.DOMWindowUtils;
7 ok(utils.getClassName(wrapper) === expected, note);
8 }
9 function check_parent(ok, obj, expected, note) {
10 var utils = SpecialPowers.DOMWindowUtils;
11 ok(utils.getParent(obj) === expected, note);
12 }
13 function run_test(ok, xpcnw, sjow) {
14 // both wrappers should point to our window: XOW
15 check_wrapper(ok, ok, "Proxy", "functions are wrapped properly")
16 check_wrapper(ok, xpcnw, "Proxy", "XPCNWs are transformed correctly");
17 check_wrapper(ok, sjow, "Proxy", "SJOWs are transformed correctly");
18
19 check_wrapper(ok, window.location, "Proxy",
20 "Content needs a same-compartment security wrappers around location");
21
22 ok(defprop1 === 1, "defprop1 exists");
23 window.defprop1 = 2;
24 ok(defprop1 === 2, "defprop1 is properly writable");
25
26 // defprop2 = {}; disabled because the test doesn't work
27 }
28
29 window.xhr = new XMLHttpRequest();
30 </script>
31 </head>
32 <body>
33 </body>
34 </html>

mercurial