fune/docshell/test/unit/test_privacy_transition.js
Toby Ward 415ae552bb Bug 1496082: Enable ESLint for docshell/test/navigation and docshell/test/unit (automatic fixes only). r=bzbarsky
Enabled ESLint for:

* docshell/test/navigation/**
* docshell/test/unit/**
* docshell/test/unit_ipc/**

Changed .eslintignore to allow for this and ran ./mach eslint --fix on the above directories and checked automatic fixes

Differential Revision: https://phabricator.services.mozilla.com/D9430

--HG--
extra : moz-landing-system : lando
2018-11-06 14:48:43 +00:00

20 lines
655 B
JavaScript

var gNotifications = 0;
ChromeUtils.import("resource://gre/modules/Services.jsm");
var observer = {
QueryInterface: ChromeUtils.generateQI(["nsIPrivacyTransitionObserver", "nsISupportsWeakReference"]),
privateModeChanged(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);
}