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.

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

mercurial