It's a combination of chrome.runtime messaging api to establish a connection between the calling tab and the service worker and chrome.scripting api to actually execute on the target tabs. Tho you can only send json and not functions over the port so functions have to be stringified and the eval() on the tab main world. Since eval is not possible in extensions itself for good reason the only way is to do this on the tabs, so the tab filtering will also be done in a tab world and will respond the filtered tab ids back to the service worker.
Junior Developers: what’s this do? Probably nothing… yeet