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 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 5 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 6 | |
michael@0 | 7 | <window id="window" title="Subframe Origin Tests" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 11 | chrome margins rock! |
michael@0 | 12 | <script> |
michael@0 | 13 | |
michael@0 | 14 | // Tests parsing of the chrome margin attrib on a window. |
michael@0 | 15 | |
michael@0 | 16 | function ok(condition, message) { |
michael@0 | 17 | window.opener.wrappedJSObject.SimpleTest.ok(condition, message); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function doSingleTest(param, shouldSucceed) |
michael@0 | 21 | { |
michael@0 | 22 | var exception = null; |
michael@0 | 23 | try { |
michael@0 | 24 | document.documentElement.removeAttribute("chromemargin"); |
michael@0 | 25 | document.documentElement.setAttribute("chromemargin", param); |
michael@0 | 26 | ok(document. |
michael@0 | 27 | documentElement. |
michael@0 | 28 | getAttribute("chromemargin") == param, "couldn't set/get chromemargin?"); |
michael@0 | 29 | } catch (ex) { |
michael@0 | 30 | exception = ex; |
michael@0 | 31 | } |
michael@0 | 32 | if (shouldSucceed) |
michael@0 | 33 | ok(!exception, "failed for param:'" + param + "'"); |
michael@0 | 34 | else |
michael@0 | 35 | ok(exception, "did not fail for invalid param:'" + param + "'"); |
michael@0 | 36 | return true; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function runTests() |
michael@0 | 40 | { |
michael@0 | 41 | var doc = document.documentElement; |
michael@0 | 42 | |
michael@0 | 43 | // make sure we can set and get |
michael@0 | 44 | doc.setAttribute("chromemargin", "0,0,0,0"); |
michael@0 | 45 | ok(doc.getAttribute("chromemargin") == "0,0,0,0", "couldn't set/get chromemargin?"); |
michael@0 | 46 | doc.setAttribute("chromemargin", "-1,-1,-1,-1"); |
michael@0 | 47 | ok(doc.getAttribute("chromemargin") == "-1,-1,-1,-1", "couldn't set/get chromemargin?"); |
michael@0 | 48 | |
michael@0 | 49 | // test remove |
michael@0 | 50 | doc.removeAttribute("chromemargin"); |
michael@0 | 51 | ok(doc.getAttribute("chromemargin") == "", "couldn't remove chromemargin?"); |
michael@0 | 52 | |
michael@0 | 53 | // we already test these really well in a c++ test in widget |
michael@0 | 54 | doSingleTest("1,2,3,4", true); |
michael@0 | 55 | doSingleTest("-2,-2,-2,-2", true); |
michael@0 | 56 | doSingleTest("1,1,1,1", true); |
michael@0 | 57 | doSingleTest("", false); |
michael@0 | 58 | doSingleTest("12123123", false); |
michael@0 | 59 | doSingleTest("0,-1,-1,-1", true); |
michael@0 | 60 | doSingleTest("-1,0,-1,-1", true); |
michael@0 | 61 | doSingleTest("-1,-1,0,-1", true); |
michael@0 | 62 | doSingleTest("-1,-1,-1,0", true); |
michael@0 | 63 | doSingleTest("1234567890,1234567890,1234567890,1234567890", true); |
michael@0 | 64 | doSingleTest("-1,-1,-1,-1", true); |
michael@0 | 65 | |
michael@0 | 66 | window.opener.wrappedJSObject.SimpleTest.finish(); |
michael@0 | 67 | window.close(); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window); |
michael@0 | 71 | |
michael@0 | 72 | </script> |
michael@0 | 73 | </window> |