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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * This file tests getFaviconURLForPage. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 9 | /// Tests |
michael@0 | 10 | |
michael@0 | 11 | function run_test() |
michael@0 | 12 | { |
michael@0 | 13 | run_next_test(); |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | add_test(function test_normal() |
michael@0 | 17 | { |
michael@0 | 18 | let pageURI = NetUtil.newURI("http://example.com/normal"); |
michael@0 | 19 | |
michael@0 | 20 | promiseAddVisits(pageURI).then(function () { |
michael@0 | 21 | PlacesUtils.favicons.setAndFetchFaviconForPage( |
michael@0 | 22 | pageURI, SMALLPNG_DATA_URI, true, |
michael@0 | 23 | PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, |
michael@0 | 24 | function () { |
michael@0 | 25 | PlacesUtils.favicons.getFaviconURLForPage(pageURI, |
michael@0 | 26 | function (aURI, aDataLen, aData, aMimeType) { |
michael@0 | 27 | do_check_true(aURI.equals(SMALLPNG_DATA_URI)); |
michael@0 | 28 | |
michael@0 | 29 | // Check also the expected data types. |
michael@0 | 30 | do_check_true(aDataLen === 0); |
michael@0 | 31 | do_check_true(aData.length === 0); |
michael@0 | 32 | do_check_true(aMimeType === ""); |
michael@0 | 33 | run_next_test(); |
michael@0 | 34 | }); |
michael@0 | 35 | }); |
michael@0 | 36 | }); |
michael@0 | 37 | }); |
michael@0 | 38 | |
michael@0 | 39 | add_test(function test_missing() |
michael@0 | 40 | { |
michael@0 | 41 | let pageURI = NetUtil.newURI("http://example.com/missing"); |
michael@0 | 42 | |
michael@0 | 43 | PlacesUtils.favicons.getFaviconURLForPage(pageURI, |
michael@0 | 44 | function (aURI, aDataLen, aData, aMimeType) { |
michael@0 | 45 | // Check also the expected data types. |
michael@0 | 46 | do_check_true(aURI === null); |
michael@0 | 47 | do_check_true(aDataLen === 0); |
michael@0 | 48 | do_check_true(aData.length === 0); |
michael@0 | 49 | do_check_true(aMimeType === ""); |
michael@0 | 50 | run_next_test(); |
michael@0 | 51 | }); |
michael@0 | 52 | }); |