summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/mochitest/chrome_wrappers_helper.html
blob: a0c1ec87e37594b50f622d4d1ba164e9077117c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
    <head>
        <script>
            function check_wrapper(ok, wrapper, expected, note) {
                let { getClassName } = SpecialPowers.unwrap(
                  SpecialPowers.wrap(window).ChromeUtils
                );
                ok(getClassName(wrapper, false) === 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_wrapper(ok, xpcnw, "Proxy", "XPCNWs are transformed correctly");
                check_wrapper(ok, sjow, "Proxy", "SJOWs are transformed correctly");

                check_wrapper(ok, window.location, "Location",
                              "same-compartment security wrappers are gone");

                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>