js/xpconnect/tests/mochitest/test_bug478438.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 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=478438
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 478438</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 10 <script type="application/javascript;version=1.8">
michael@0 11 function fail(s, e) { ok(false, s + e) }
michael@0 12 function pass(s, e) { ok(true, s) }
michael@0 13 (pass.opposite = fail).opposite = pass;
michael@0 14
michael@0 15 function test() {
michael@0 16 if (test.calledAlready)
michael@0 17 return;
michael@0 18 test.calledAlready = true;
michael@0 19
michael@0 20 var iwin = document.getElementById("f").contentWindow;
michael@0 21
michael@0 22 function testOne(fn, onAllow, infinitive) {
michael@0 23 try { fn(); onAllow("able " + infinitive, "") }
michael@0 24 catch (e) { onAllow.opposite("unable " + infinitive, ": " + e) }
michael@0 25 }
michael@0 26
michael@0 27 testOne(function() iwin.focus, pass,
michael@0 28 "to resolve/get allAccess property iwin.focus");
michael@0 29
michael@0 30 testOne(function() iwin.focus(), pass,
michael@0 31 "to call allAccess method iwin.focus");
michael@0 32
michael@0 33 testOne(function() iwin.alert, fail,
michael@0 34 "to resolve/get restricted property iwin.alert");
michael@0 35
michael@0 36 testOne(function() iwin.alert(), fail,
michael@0 37 "to call restricted method iwin.alert");
michael@0 38
michael@0 39 testOne(function() iwin.location.toString(), fail,
michael@0 40 "to call restricted method iwin.location.toString");
michael@0 41
michael@0 42 testOne(function() { iwin.location = "http://example.org" }, pass,
michael@0 43 "to set writable property iwin.location");
michael@0 44
michael@0 45 SimpleTest.finish();
michael@0 46 }
michael@0 47 </script>
michael@0 48 </head>
michael@0 49 <body>
michael@0 50 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478438">Mozilla Bug 478438</a>
michael@0 51 <p id="display"></p>
michael@0 52 <div id="content">
michael@0 53 <iframe id="f" src="http://example.com" onload="test()"></iframe>
michael@0 54 </div>
michael@0 55 <pre id="test">
michael@0 56 <script type="application/javascript">
michael@0 57
michael@0 58 /** Test for Bug 478438 **/
michael@0 59
michael@0 60 SimpleTest.waitForExplicitFinish();
michael@0 61
michael@0 62 </script>
michael@0 63 </pre>
michael@0 64 </body>
michael@0 65 </html>

mercurial