js/xpconnect/tests/mochitest/file_expandosharing.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 <!DOCTYPE html>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <script type="application/javascript">
michael@0 5 function setup() {
michael@0 6 // Set up different target objects for expandos, one for each binding type.
michael@0 7 window.targetWN = window;
michael@0 8 window.targetDOM = new XMLHttpRequest();
michael@0 9 window.targetJS = new Date();
michael@0 10 }
michael@0 11
michael@0 12 function placeExpando(name, val, target) {
michael@0 13 target[name] = val;
michael@0 14 }
michael@0 15
michael@0 16 // If val === null, then we shouldn't have access.
michael@0 17 function checkExpando(name, val, target, msg) {
michael@0 18 if (val !== null) {
michael@0 19 ok(name in target, msg);
michael@0 20 try {
michael@0 21 is(target[name], val, "Got the right expando value");
michael@0 22 } catch(e) { ok(false, "Threw when accessing same-origin expando"); }
michael@0 23 }
michael@0 24 else {
michael@0 25 ok(!(name in target), msg);
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 </script>
michael@0 30 </head>
michael@0 31 <body onload="setup();">
michael@0 32 <span>Salut, Ma Cherise. ;-)</span>
michael@0 33 </body>
michael@0 34 </html>

mercurial