caps/tests/mochitest/test_app_principal_equality.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=777467
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test app principal's equality</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777467">Mozilla Bug 777467</a>
michael@0 14 <p id="display"></p>
michael@0 15 <script>
michael@0 16 // Initialization.
michael@0 17 SpecialPowers.addPermission("browser", true, document);
michael@0 18 SpecialPowers.addPermission("embed-apps", true, document);
michael@0 19
michael@0 20 SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
michael@0 21 SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
michael@0 22 </script>
michael@0 23 <div id="content" style="display: none;">
michael@0 24 <iframe src="error404"></iframe>
michael@0 25 <iframe mozbrowser src="error404"></iframe>
michael@0 26 <iframe mozapp="http://example.org/manifest.webapp" mozbrowser src="error404"></iframe>
michael@0 27 </div>
michael@0 28 <pre id="test">
michael@0 29 <script type="application/javascript">
michael@0 30
michael@0 31 /** Test for app principal's equality **/
michael@0 32
michael@0 33 SimpleTest.waitForExplicitFinish();
michael@0 34
michael@0 35 function canAccessDocument(win) {
michael@0 36 var result = true;
michael@0 37 try {
michael@0 38 win.document;
michael@0 39 } catch(e) {
michael@0 40 result = false;
michael@0 41 }
michael@0 42 return result;
michael@0 43 }
michael@0 44
michael@0 45 addLoadEvent(function() {
michael@0 46 // Test the witness frame (we can access same-origin frame).
michael@0 47 is(canAccessDocument(frames[0]), true,
michael@0 48 "should be able to access the first frame");
michael@0 49
michael@0 50 // Test different app/browserElement frames.
michael@0 51 for (var i=1; i<frames.length; ++i) {
michael@0 52 is(canAccessDocument(frames[i]), false,
michael@0 53 "should not be able to access the other frames");
michael@0 54 }
michael@0 55
michael@0 56 // Cleanup.
michael@0 57 SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled');
michael@0 58 SpecialPowers.clearUserPref('dom.ipc.browser_frames.oop_by_default');
michael@0 59 SpecialPowers.removePermission("browser", window.document);
michael@0 60 SpecialPowers.removePermission("embed-apps", window.document);
michael@0 61
michael@0 62 SimpleTest.finish();
michael@0 63 });
michael@0 64
michael@0 65 </script>
michael@0 66 </pre>
michael@0 67 </body>
michael@0 68 </html>

mercurial