toolkit/components/places/tests/unit/test_bug636917_isLivemark.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 // Test that asking for isLivemark in a annotationChanged notification
michael@0 5 // correctly returns true.
michael@0 6 function run_test()
michael@0 7 {
michael@0 8 do_test_pending();
michael@0 9
michael@0 10 let annoObserver = {
michael@0 11 onItemAnnotationSet:
michael@0 12 function AO_onItemAnnotationSet(aItemId, aAnnotationName)
michael@0 13 {
michael@0 14 if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) {
michael@0 15 PlacesUtils.annotations.removeObserver(this);
michael@0 16 PlacesUtils.livemarks.getLivemark({ id: aItemId })
michael@0 17 .then(aLivemark => {
michael@0 18 PlacesUtils.bookmarks.removeItem(aItemId);
michael@0 19 do_test_finished();
michael@0 20 }, do_throw);
michael@0 21 }
michael@0 22 },
michael@0 23
michael@0 24 onItemAnnotationRemoved: function () {},
michael@0 25 onPageAnnotationSet: function() {},
michael@0 26 onPageAnnotationRemoved: function() {},
michael@0 27 QueryInterface: XPCOMUtils.generateQI([
michael@0 28 Ci.nsIAnnotationObserver
michael@0 29 ]),
michael@0 30 }
michael@0 31 PlacesUtils.annotations.addObserver(annoObserver, false);
michael@0 32 PlacesUtils.livemarks.addLivemark(
michael@0 33 { title: "livemark title"
michael@0 34 , parentId: PlacesUtils.unfiledBookmarksFolderId
michael@0 35 , index: PlacesUtils.bookmarks.DEFAULT_INDEX
michael@0 36 , siteURI: uri("http://example.com/")
michael@0 37 , feedURI: uri("http://example.com/rdf")
michael@0 38 }
michael@0 39 ).then(null, do_throw);
michael@0 40 }

mercurial