docshell/test/unit/test_privacy_transition.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 var gNotifications = 0;
     3 var observer = {
     4   QueryInterface: function(iid) {
     5     if (Ci.nsIPrivacyTransitionObserver.equals(iid) ||
     6         Ci.nsISupportsWeakReference.equals(iid) ||
     7         Ci.nsISupports.equals(iid))
     8       return this;
     9     throw Cr.NS_ERROR_NO_INTERFACE;
    10   },
    12   privateModeChanged: function(enabled) {
    13     gNotifications++;
    14   }
    15 }
    17 function run_test() {
    18   var docshell = Cc["@mozilla.org/docshell;1"].createInstance(Ci.nsIDocShell);
    19   docshell.addWeakPrivacyTransitionObserver(observer);
    20   docshell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
    21   docshell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
    22   do_check_eq(gNotifications, 2);
    23 }

mercurial