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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Test that asking for isLivemark in a annotationChanged notification
     5 // correctly returns true.
     6 function run_test()
     7 {
     8   do_test_pending();
    10   let annoObserver = {
    11     onItemAnnotationSet:
    12     function AO_onItemAnnotationSet(aItemId, aAnnotationName)
    13     {
    14       if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) {
    15         PlacesUtils.annotations.removeObserver(this);
    16         PlacesUtils.livemarks.getLivemark({ id: aItemId })
    17           .then(aLivemark => {
    18             PlacesUtils.bookmarks.removeItem(aItemId);
    19             do_test_finished();
    20           }, do_throw);
    21       }
    22     },
    24     onItemAnnotationRemoved: function () {},
    25     onPageAnnotationSet: function() {},
    26     onPageAnnotationRemoved: function() {},
    27     QueryInterface: XPCOMUtils.generateQI([
    28       Ci.nsIAnnotationObserver
    29     ]),
    30   }
    31   PlacesUtils.annotations.addObserver(annoObserver, false);
    32   PlacesUtils.livemarks.addLivemark(
    33     { title: "livemark title"
    34     , parentId: PlacesUtils.unfiledBookmarksFolderId
    35     , index: PlacesUtils.bookmarks.DEFAULT_INDEX
    36     , siteURI: uri("http://example.com/")
    37     , feedURI: uri("http://example.com/rdf")
    38     }
    39   ).then(null, do_throw);
    40 }

mercurial