js/xpconnect/tests/mochitest/chrome_wrappers_helper.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <html>
     2     <head>
     3         <script>
     4             function check_wrapper(ok, wrapper, expected, note) {
     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");
    19                 check_wrapper(ok, window.location, "Proxy",
    20                               "Content needs a same-compartment security wrappers around location");
    22                 ok(defprop1 === 1, "defprop1 exists");
    23                 window.defprop1 = 2;
    24                 ok(defprop1 === 2, "defprop1 is properly writable");
    26                 // defprop2 = {}; disabled because the test doesn't work
    27             }
    29             window.xhr = new XMLHttpRequest();
    30         </script>
    31     </head>
    32     <body>
    33     </body>
    34 </html>

mercurial