I'm afraid this isn't going to work reliably as `Ci.nsIDOMWindow` isn't regular constructor, in such case method uses stratification strategy, but if you query window with more interfaces stringification is going to have different result. We have made a `dispatcher` to similar use cases, which I think you should use instead.

```js
function True() { return true }
const { dispatcher } = require("sdk/util/dispatcher");
dispatcher.when(isPermanentPrivateBrowsing, True);
dispatcher.when(x => x instanceof Ci.nsIDOMWindow, isWindowPrivate);
dispatcher.when(x => Ci.nsIPrivateBrowsingChannel && x instanceof Ci.nsIPrivateBrowsingChannel, x => x.isChannelPrivate);
dispatcher.define(getMode);
```