IndexedDB in Containers - contextualIdentities

I think you have access to the background page exactly iff your page is executed in the same storage context, i.e.:

async function iAmInNormalContext() {
    return (await browser.runtime.getBackgroundPage()) != null;
}

Note1: In Firefox, the synchronous version on extension works as well.
Note 2: In Chrome, this would load the “event” background page if suspended.

1 Like