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.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
michael@0 | 3 | <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | https://bugzilla.mozilla.org/show_bug.cgi?id=795275 |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="Mozilla Bug 795275" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 10 | |
michael@0 | 11 | <!-- test results are displayed in the html:body --> |
michael@0 | 12 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 13 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=795275" |
michael@0 | 14 | target="_blank">Mozilla Bug 795275</a> |
michael@0 | 15 | </body> |
michael@0 | 16 | |
michael@0 | 17 | <!-- test code goes here --> |
michael@0 | 18 | <script type="application/javascript"> |
michael@0 | 19 | <![CDATA[ |
michael@0 | 20 | /** Test for Warning in content scopes about Components. **/ |
michael@0 | 21 | |
michael@0 | 22 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 23 | SimpleTest.executeSoon(startLoad); |
michael@0 | 24 | function startLoad() { |
michael@0 | 25 | for (var i = 1; i <= document.getElementsByTagName('iframe').length; ++i) { |
michael@0 | 26 | var frame = document.getElementById('frame' + i); |
michael@0 | 27 | frame.contentWindow.location = 'http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_bug795275.html'; |
michael@0 | 28 | frame.onload = frameLoaded; |
michael@0 | 29 | } |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | // Set up our console listener. |
michael@0 | 33 | var gWarnings = 0; |
michael@0 | 34 | function onWarning(consoleMessage) { |
michael@0 | 35 | if (/soon be removed/.test(consoleMessage.message)) |
michael@0 | 36 | gWarnings++; |
michael@0 | 37 | } |
michael@0 | 38 | var gListener = { |
michael@0 | 39 | observe: onWarning, |
michael@0 | 40 | QueryInterface: function (iid) { |
michael@0 | 41 | if (!iid.equals(Components.interfaces.nsIConsoleListener) && |
michael@0 | 42 | !iid.equals(Components.interfaces.nsISupports)) { |
michael@0 | 43 | throw Components.results.NS_ERROR_NO_INTERFACE; |
michael@0 | 44 | } |
michael@0 | 45 | return this; |
michael@0 | 46 | } |
michael@0 | 47 | }; |
michael@0 | 48 | var gConsoleService = Components.classes["@mozilla.org/consoleservice;1"] |
michael@0 | 49 | .getService(Components.interfaces.nsIConsoleService); |
michael@0 | 50 | gConsoleService.registerListener(gListener); |
michael@0 | 51 | |
michael@0 | 52 | // Wait for all four child frame to load. |
michael@0 | 53 | var gLoadCount = 0; |
michael@0 | 54 | function frameLoaded() { |
michael@0 | 55 | if (++gLoadCount == document.getElementsByTagName('iframe').length) |
michael@0 | 56 | go(); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | function getWin(id) { return document.getElementById(id).contentWindow.wrappedJSObject; } |
michael@0 | 60 | function go() { |
michael@0 | 61 | getWin('frame1').touchComponents(); |
michael@0 | 62 | getWin('frame2').touchInterfaces(); |
michael@0 | 63 | getWin('frame4').touchComponents(); |
michael@0 | 64 | getWin('frame4').touchInterfaces(); |
michael@0 | 65 | // This shouldn't warn. |
michael@0 | 66 | getWin('frame5').touchViaXBL(); |
michael@0 | 67 | |
michael@0 | 68 | // Warnings are dispatched async, so stick ourselves at the end of the event |
michael@0 | 69 | // queue. |
michael@0 | 70 | setTimeout(done, 0); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | function done() { |
michael@0 | 74 | gConsoleService.unregisterListener(gListener); |
michael@0 | 75 | is(gWarnings, 3, "Got the right number of warnings"); |
michael@0 | 76 | SimpleTest.finish(); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | ]]> |
michael@0 | 80 | |
michael@0 | 81 | </script> |
michael@0 | 82 | <iframe id="frame1"/> |
michael@0 | 83 | <iframe id="frame2"/> |
michael@0 | 84 | <iframe id="frame3"/> |
michael@0 | 85 | <iframe id="frame4"/> |
michael@0 | 86 | <iframe id="frame5"/> |
michael@0 | 87 | |
michael@0 | 88 | </window> |