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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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