[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "WebExtensionManifest",
        "properties": {
          "sidebar_action": {
            "type": "object",
            "additionalProperties": { "$ref": "UnrecognizedProperty" },
            "properties": {
              "default_title": {
                "type": "string",
                "optional": true,
                "preprocess": "localize"
              },
              "default_icon": {
                "$ref": "IconPath",
                "optional": true
              },
              "browser_style": {
                "type": "boolean",
                "optional": true,
                "description": "Defaults to true in Manifest V2; Deprecated in Manifest V3."
              },
              "default_panel": {
                "type": "string",
                "format": "strictRelativeUrl",
                "preprocess": "localize"
              },
              "open_at_install": {
                "type": "boolean",
                "optional": true,
                "default": true,
                "description": "Whether or not the sidebar is opened at install. Default is <code>true</code>."
              }
            },
            "optional": true
          }
        }
      }
    ]
  },
  {
    "namespace": "sidebarAction",
    "description": "Use sidebar actions to add a sidebar to Firefox.",
    "permissions": ["manifest:sidebar_action"],
    "types": [
      {
        "id": "ImageDataType",
        "type": "object",
        "isInstanceOf": "ImageData",
        "additionalProperties": { "type": "any" },
        "postprocess": "convertImageDataToURL",
        "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)."
      }
    ],
    "functions": [
      {
        "name": "setTitle",
        "type": "function",
        "description": "Sets the title of the sidebar action. This shows up in the tooltip.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "title": {
                "choices": [{ "type": "string" }, { "type": "null" }],
                "description": "The string the sidebar action should display when moused over."
              },
              "tabId": {
                "type": "integer",
                "optional": true,
                "description": "Sets the sidebar title for the tab specified by tabId. Automatically resets when the tab is closed."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": -2,
                "description": "Sets the sidebar title for the window specified by windowId."
              }
            }
          }
        ]
      },
      {
        "name": "getTitle",
        "type": "function",
        "description": "Gets the title of the sidebar action.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "tabId": {
                "type": "integer",
                "optional": true,
                "description": "Specify the tab to get the title from. If no tab nor window is specified, the global title is returned."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": -2,
                "description": "Specify the window to get the title from. If no tab nor window is specified, the global title is returned."
              }
            }
          }
        ]
      },
      {
        "name": "setIcon",
        "type": "function",
        "description": "Sets the icon for the sidebar action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <strong>path</strong> or the <strong>imageData</strong> property must be specified.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "imageData": {
                "choices": [
                  { "$ref": "ImageDataType" },
                  {
                    "type": "object",
                    "patternProperties": {
                      "^[1-9]\\d*$": { "$ref": "ImageDataType" }
                    },
                    "additionalProperties": false
                  }
                ],
                "optional": true,
                "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'"
              },
              "path": {
                "choices": [
                  { "type": "string" },
                  {
                    "type": "object",
                    "additionalProperties": { "type": "string" }
                  }
                ],
                "optional": true,
                "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'"
              },
              "tabId": {
                "type": "integer",
                "optional": true,
                "description": "Sets the sidebar icon for the tab specified by tabId. Automatically resets when the tab is closed."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": -2,
                "description": "Sets the sidebar icon for the window specified by windowId."
              }
            }
          }
        ]
      },
      {
        "name": "setPanel",
        "type": "function",
        "description": "Sets the url to the html document to be opened in the sidebar when the user clicks on the sidebar action's icon.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "tabId": {
                "type": "integer",
                "optional": true,
                "minimum": 0,
                "description": "Sets the sidebar url for the tab specified by tabId. Automatically resets when the tab is closed."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": -2,
                "description": "Sets the sidebar url for the window specified by windowId."
              },
              "panel": {
                "choices": [{ "type": "string" }, { "type": "null" }],
                "description": "The url to the html file to show in a sidebar.  If set to the empty string (''), no sidebar is shown."
              }
            }
          }
        ]
      },
      {
        "name": "getPanel",
        "type": "function",
        "description": "Gets the url to the html document set as the panel for this sidebar action.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "tabId": {
                "type": "integer",
                "optional": true,
                "description": "Specify the tab to get the panel from. If no tab nor window is specified, the global panel is returned."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": -2,
                "description": "Specify the window to get the panel from. If no tab nor window is specified, the global panel is returned."
              }
            }
          }
        ]
      },
      {
        "name": "open",
        "type": "function",
        "requireUserInput": true,
        "description": "Opens the extension sidebar in the active window.",
        "async": true,
        "parameters": []
      },
      {
        "name": "close",
        "type": "function",
        "requireUserInput": true,
        "description": "Closes the extension sidebar in the active window if the sidebar belongs to the extension.",
        "async": true,
        "parameters": []
      },
      {
        "name": "toggle",
        "type": "function",
        "requireUserInput": true,
        "description": "Toggles the extension sidebar in the active window.",
        "async": true,
        "parameters": []
      },
      {
        "name": "isOpen",
        "type": "function",
        "description": "Checks whether the sidebar action is open.",
        "async": true,
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": -2,
                "optional": true,
                "description": "Specify the window to get the openness from."
              }
            }
          }
        ]
      }
    ]
  }
]
