Nit: Logic seems to be little twisted and I'd prefer to let `getOwnerWindow` return `thing` back if it's a window and `null` if it has no window associated. In that case code will end up being a lot simpler:

```js
let window = getOwnerWindow(thing)
return window ? isWindowPrivate(window) : getMode()
```