toolkit/components/places/tests/unit/nsDummyObserver.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     7 const Cc = Components.classes;
     8 const Ci = Components.interfaces;
    10 // Dummy boomark/history observer
    11 function DummyObserver() {
    12   let os = Cc["@mozilla.org/observer-service;1"].
    13            getService(Ci.nsIObserverService);
    14   os.notifyObservers(null, "dummy-observer-created", null);
    15 }
    17 DummyObserver.prototype = {
    18   // history observer
    19   onBeginUpdateBatch: function () {},
    20   onEndUpdateBatch: function () {},
    21   onVisit: function (aURI, aVisitID, aTime, aSessionID, aReferringID, aTransitionType) {
    22     let os = Cc["@mozilla.org/observer-service;1"].
    23              getService(Ci.nsIObserverService);
    24     os.notifyObservers(null, "dummy-observer-visited", null);
    25   },
    26   onTitleChanged: function () {},
    27   onDeleteURI: function () {},
    28   onClearHistory: function () {},
    29   onPageChanged: function () {},
    30   onDeleteVisits: function () {},
    32   // bookmark observer
    33   //onBeginUpdateBatch: function() {},
    34   //onEndUpdateBatch: function() {},
    35   onItemAdded: function(aItemId, aParentId, aIndex, aItemType, aURI) {
    36     let os = Cc["@mozilla.org/observer-service;1"].
    37              getService(Ci.nsIObserverService);
    38     os.notifyObservers(null, "dummy-observer-item-added", null);
    39   },
    40   onItemChanged: function () {},
    41   onItemRemoved: function() {},
    42   onItemVisited: function() {},
    43   onItemMoved: function() {},
    45   classID: Components.ID("62e221d3-68c3-4e1a-8943-a27beb5005fe"),
    47   QueryInterface: XPCOMUtils.generateQI([
    48     Ci.nsINavBookmarkObserver,
    49     Ci.nsINavHistoryObserver,
    50   ])
    51 };
    53 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DummyObserver]);

mercurial