Read settings from browser storage in onBeforeRequest callback

  firefox-addon, javascript, webapi

I’m trying to read a setting from the browser storage before redirecting to a different page in my Firefox add-on.

(async function() {
    function listener(details) {
        //let foo = await{ domain: "" });
        //let foo = await Promise.resolve("")
        let foo = ""

        return { redirectUrl: foo }


        listener, {
            urls: [
            types: ["main_frame"]


The Immediately invoked function expression is to enter a context in which I can use async. If I use one of the await lines, there is not redirect at all. The third line does work.
The script is loaded as a background script.

Source: Ask Javascript Questions