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