so, that would be:
```js
if (has(mod.attachTo, "top") && matchesURI(mod, getTabURI(tab)) && matchesContentType(mod, getTabContentType(tab)))
```
Because we're using such code a lot, we could probably create a module function like:
```js
const matchesDocument = (mod, {URL, contentType}) => matchesURI(mod, URL) && matchesContentType(mod, contentType);
```
In that case of course we need something like `getTabContentDocument` too:
```js
const getTabContentDocument = getBrowserForTab(tab).contentDocument;
```
So that now you can have:
```js
if (has(mod.attachTo, "top") && matchesDocument(mod, getTabContentDocument(tab)))
```
and below, for frames:
```js
filter((frame) => matchesDocument(mod, frame.contentDocument)).
```

Something like that.