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 | |
michael@0 | 3 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | - License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | - You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 6 | |
michael@0 | 7 | <window title="Test post pages are not added to history" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 9 | onload="test();"> |
michael@0 | 10 | |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"/> |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 17 | |
michael@0 | 18 | <script type="application/javascript"> |
michael@0 | 19 | <![CDATA[ |
michael@0 | 20 | |
michael@0 | 21 | const Cc = Components.classes; |
michael@0 | 22 | const Ci = Components.interfaces; |
michael@0 | 23 | |
michael@0 | 24 | Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); |
michael@0 | 25 | Components.utils.import("resource://gre/modules/NetUtil.jsm"); |
michael@0 | 26 | |
michael@0 | 27 | const SJS_URI = NetUtil.newURI("http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/history_post.sjs"); |
michael@0 | 28 | |
michael@0 | 29 | function test() |
michael@0 | 30 | { |
michael@0 | 31 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 32 | let submit = document.getElementById("submit"); |
michael@0 | 33 | submit.click(); |
michael@0 | 34 | let iframe = document.getElementById("post_iframe"); |
michael@0 | 35 | iframe.addEventListener("load", function onLoad() { |
michael@0 | 36 | iframe.removeEventListener("load", onLoad); |
michael@0 | 37 | let history = Cc["@mozilla.org/browser/history;1"] |
michael@0 | 38 | .getService(Ci.mozIAsyncHistory); |
michael@0 | 39 | history.isURIVisited(SJS_URI, function (aURI, aIsVisited) { |
michael@0 | 40 | ok(!aIsVisited, "The POST page should not be added to history"); |
michael@0 | 41 | |
michael@0 | 42 | let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase) |
michael@0 | 43 | .DBConnection; |
michael@0 | 44 | let stmt = db.createStatement( |
michael@0 | 45 | "SELECT 1 FROM moz_places WHERE url = :page_url" |
michael@0 | 46 | ); |
michael@0 | 47 | stmt.params.page_url = SJS_URI.spec; |
michael@0 | 48 | ok(!stmt.executeStep(), "The page should not be in the database"); |
michael@0 | 49 | stmt.finalize(); |
michael@0 | 50 | SimpleTest.finish(); |
michael@0 | 51 | }); |
michael@0 | 52 | }); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | ]]> |
michael@0 | 56 | </script> |
michael@0 | 57 | |
michael@0 | 58 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 59 | <iframe name="post_iframe" id="post_iframe"/> |
michael@0 | 60 | <form method="post" action="http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/history_post.sjs" target="post_iframe"> |
michael@0 | 61 | <input type="submit" id="submit"/> |
michael@0 | 62 | </form> |
michael@0 | 63 | <p id="display"></p> |
michael@0 | 64 | <div id="content" style="display:none;"></div> |
michael@0 | 65 | <pre id="test"></pre> |
michael@0 | 66 | </body> |
michael@0 | 67 | </window> |