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 | // Tests a zero frecency is correctly updated when inserting new valid visits. |
michael@0 | 5 | |
michael@0 | 6 | function run_test() |
michael@0 | 7 | { |
michael@0 | 8 | run_next_test() |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | add_task(function () |
michael@0 | 12 | { |
michael@0 | 13 | const TEST_URI = NetUtil.newURI("http://example.com/"); |
michael@0 | 14 | let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, |
michael@0 | 15 | TEST_URI, |
michael@0 | 16 | PlacesUtils.bookmarks.DEFAULT_INDEX, |
michael@0 | 17 | "A title"); |
michael@0 | 18 | yield promiseAsyncUpdates(); |
michael@0 | 19 | do_check_true(frecencyForUrl(TEST_URI) > 0); |
michael@0 | 20 | |
michael@0 | 21 | // Removing the bookmark should leave an orphan page with zero frecency. |
michael@0 | 22 | // Note this would usually be expired later by expiration. |
michael@0 | 23 | PlacesUtils.bookmarks.removeItem(id); |
michael@0 | 24 | yield promiseAsyncUpdates(); |
michael@0 | 25 | do_check_eq(frecencyForUrl(TEST_URI), 0); |
michael@0 | 26 | |
michael@0 | 27 | // Now add a valid visit to the page, frecency should increase. |
michael@0 | 28 | yield promiseAddVisits({ uri: TEST_URI }); |
michael@0 | 29 | do_check_true(frecencyForUrl(TEST_URI) > 0); |
michael@0 | 30 | }); |