js/xpconnect/tests/mochitest/chrome_wrappers_helper.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/chrome_wrappers_helper.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +<html>
     1.5 +    <head>
     1.6 +        <script>
     1.7 +            function check_wrapper(ok, wrapper, expected, note) {
     1.8 +
     1.9 +                var utils = SpecialPowers.DOMWindowUtils;
    1.10 +                ok(utils.getClassName(wrapper) === expected, note);
    1.11 +            }
    1.12 +            function check_parent(ok, obj, expected, note) {
    1.13 +                var utils = SpecialPowers.DOMWindowUtils;
    1.14 +                ok(utils.getParent(obj) === expected, note);
    1.15 +            }
    1.16 +            function run_test(ok, xpcnw, sjow) {
    1.17 +                // both wrappers should point to our window: XOW
    1.18 +                check_wrapper(ok, ok, "Proxy", "functions are wrapped properly")
    1.19 +                check_wrapper(ok, xpcnw, "Proxy", "XPCNWs are transformed correctly");
    1.20 +                check_wrapper(ok, sjow, "Proxy", "SJOWs are transformed correctly");
    1.21 +
    1.22 +                check_wrapper(ok, window.location, "Proxy",
    1.23 +                              "Content needs a same-compartment security wrappers around location");
    1.24 +
    1.25 +                ok(defprop1 === 1, "defprop1 exists");
    1.26 +                window.defprop1 = 2;
    1.27 +                ok(defprop1 === 2, "defprop1 is properly writable");
    1.28 +
    1.29 +                // defprop2 = {}; disabled because the test doesn't work
    1.30 +            }
    1.31 +
    1.32 +            window.xhr = new XMLHttpRequest();
    1.33 +        </script>
    1.34 +    </head>
    1.35 +    <body>
    1.36 +    </body>
    1.37 +</html>

mercurial