docshell/test/unit/test_pb_notification.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/unit/test_pb_notification.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +if (typeof Cc === "undefined")
     1.5 +  Cc = Components.classes;
     1.6 +if (typeof Ci === "undefined")
     1.7 +  Ci = Components.interfaces;
     1.8 +
     1.9 +function destroy_transient_docshell() {
    1.10 +  var docshell = Cc["@mozilla.org/docshell;1"].createInstance(Ci.nsIDocShell);
    1.11 +  docshell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
    1.12 +  do_test_pending();
    1.13 +  do_timeout(0, Components.utils.forceGC);
    1.14 +}
    1.15 +
    1.16 +function run_test() {
    1.17 +  var obs = {
    1.18 +    observe: function(aSubject, aTopic, aData) {
    1.19 +      do_check_eq(aTopic, "last-pb-context-exited");
    1.20 +      do_test_finished();
    1.21 +    }
    1.22 +  };
    1.23 +  var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
    1.24 +  os.addObserver(obs, "last-pb-context-exited", false);
    1.25 +  destroy_transient_docshell();
    1.26 +}
    1.27 \ No newline at end of file

mercurial