fune/docshell/test/unit/test_privacy_transition.js
Bogdan Tara 98c46b95b5 Backed out 2 changesets (bug 1496082) for test_bug270414.html failures CLOSED TREE
Backed out changeset 74780d0a4848 (bug 1496082)
Backed out changeset 4f87e383a807 (bug 1496082)
2018-11-06 17:58:24 +02:00

26 lines
797 B
JavaScript

var gNotifications = 0;
ChromeUtils.import("resource://gre/modules/Services.jsm");
var observer = {
QueryInterface: function(iid) {
if (Ci.nsIPrivacyTransitionObserver.equals(iid) ||
Ci.nsISupportsWeakReference.equals(iid) ||
Ci.nsISupports.equals(iid))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
privateModeChanged: function(enabled) {
gNotifications++;
}
}
function run_test() {
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
windowlessBrowser.docShell.addWeakPrivacyTransitionObserver(observer);
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId : 1});
windowlessBrowser.docShell.setOriginAttributes({privateBrowsingId : 0});
windowlessBrowser.close();
Assert.equal(gNotifications, 2);
}