Sat, 03 Jan 2015 20:18:00 +0100
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.
1 <!--
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 -->
6 <!DOCTYPE html>
7 <html>
8 <!--
9 https://bugzilla.mozilla.org/show_bug.cgi?id=945363
10 -->
11 <head>
12 <meta charset="utf-8">
13 <title>BrowserID and Firefox Accounts RPs provide requried callbacks - Bug 945363</title>
14 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
15 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
16 </head>
18 <body>
19 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=945363">Mozilla Bug 945363</a>
20 <p id="display"></p>
21 <div id="content">
23 </div>
24 <pre id="test">
25 <script type="application/javascript;version=1.7">
27 /** Test for Bug 945363 **/
29 const BASE_URL = "http://mochi.test:8888/chrome/dom/identity/tests/mochitest/";
31 SimpleTest.waitForExplicitFinish();
33 // Candidate RPs, and whether we expect them to experience an error.
34 // Will will load each of these in turn into an iframe. The candiates
35 // will invoke navigator.mozId.watch(). If they do not provide the
36 // correct arguments to watch(), nsDOMIdentity will throw an exception.
37 let candidates = [
38 [BASE_URL + "file_browserid_rp_ok.html", false],
39 [BASE_URL + "file_browserid_rp_noOnlogin.html", true ],
40 [BASE_URL + "file_fxa_rp_ok.html", false],
41 [BASE_URL + "file_fxa_rp_noOnlogin.html", true ],
42 [BASE_URL + "file_fxa_rp_noOnlogout.html", true ],
43 [BASE_URL + "file_fxa_rp_noOnready.html", true ],
44 ];
46 let checkedCount = 0;
47 let checksTodo = candidates.length;
49 // Each iframe will postMessage to us, telling us whether they caught
50 // an exception or not when calling watch().
51 window.addEventListener('message', function onMessage(event) {
52 let message = JSON.parse(event.data);
53 let [uri, expectedError] = candidates[checkedCount];
55 is(message.error, expectedError, "Unexpected error result from " + uri);
57 if (++checkedCount < checksTodo) {
58 testRunner.next();
59 } else {
60 window.removeEventListener('message', onMessage);
61 SimpleTest.finish();
62 }
63 }, false);
65 let content = document.getElementById('content');
66 function runTest() {
67 for (let [uri, _] of candidates) {
69 let iframe = document.createElement('iframe');
70 iframe.setAttribute('mozbrowser', 'true');
71 iframe.src = uri;
73 content.appendChild(iframe);
75 yield undefined;
76 }
77 }
79 let testRunner = runTest();
81 // Enable the identity systems and use verbose logging
82 SpecialPowers.pushPrefEnv({'set': [
83 ['dom.identity.enabled', true], // navigator.mozId
84 ['identity.fxaccounts.enabled', true], // fx accounts
85 ['dom.identity.syntheticEventsOk', true], // so we can call request()
86 ['toolkit.identity.debug', true], // verbose identity logging
87 ['browser.dom.window.dump.enabled', true],
88 ]},
89 function () { testRunner.next(); }
90 );
92 </script>
93 </pre>
94 </body>
95 </html>