summaryrefslogtreecommitdiffstats
path: root/browser/components/extensions/schemas/sidebar_action.json
blob: b8bb95976cd1d60d10353f200ae48954255ecc1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

[
  {
    "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."
              }
            }
          }
        ]
      }
    ]
  }
]