https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getFrameId
runtime.getFrameId() - Mozilla | MDN
Returns the frame ID of any window global or frame element when called from a content script or extension page, including background pages.
runtimemozillamdn