toolkit/components/places/tests/unit/test_452777.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 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim:set ts=2 sw=2 sts=2 expandtab
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8  * This test ensures that when removing a folder within a transaction, undoing
     9  * the transaction restores it with the same id (as received by the observers).
    10  */
    12 var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
    13          getService(Ci.nsINavBookmarksService);
    15 function run_test()
    16 {
    17   const TITLE = "test folder";
    19   // Create two test folders; remove the first one.  This ensures that undoing
    20   // the removal will not get the same id by chance (the insert id's can be
    21   // reused in SQLite).
    22   let id = bs.createFolder(bs.placesRoot, TITLE, -1);
    23   bs.createFolder(bs.placesRoot, "test folder 2", -1);
    24   let transaction = bs.getRemoveFolderTransaction(id);
    25   transaction.doTransaction();
    27   // Now check to make sure it gets added with the right id
    28   bs.addObserver({
    29     onItemAdded: function(aItemId, aFolder, aIndex, aItemType, aURI, aTitle)
    30     {
    31       do_check_eq(aItemId, id);
    32       do_check_eq(aTitle, TITLE);
    33     }
    34   }, false);
    35   transaction.undoTransaction();
    36 }

mercurial