js/xpconnect/tests/mochitest/chrome_wrappers_helper.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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