Skip to content

Commit a8ba211

Browse files
authored
🤖 Merge PR DefinitelyTyped#73717 updated types for webextension-polyfill by @Lusito
1 parent b826c9c commit a8ba211

18 files changed

+198
-133
lines changed

types/webextension-polyfill/index.d.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,12 @@ declare namespace Browser {
364364
const storage: Storage.Static;
365365

366366
/**
367-
* Chrome API (only available for Chrome)
368-
* Use the <code>chrome.tabGroups</code> API to interact with the browser's tab grouping system.
369-
* You can use this API to modify and rearrange tab groups in the browser. To group and ungroup tabs,
370-
* or to query what tabs are in groups, use the <code>browser.tabs</code> API.
371-
* Optional.
367+
* Use the browser.tabGroups API to interact with the browser's tab grouping system. You can use this API to modify,
368+
* and rearrange tab groups.
369+
*
370+
* Permissions: "tabGroups"
372371
*/
373-
const tabGroups: TabGroups.Static | undefined;
372+
const tabGroups: TabGroups.Static;
374373

375374
/**
376375
* Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify,
@@ -731,13 +730,12 @@ declare namespace Browser {
731730
storage: Storage.Static;
732731

733732
/**
734-
* Chrome API (only available for Chrome)
735-
* Use the <code>chrome.tabGroups</code> API to interact with the browser's tab grouping system.
736-
* You can use this API to modify and rearrange tab groups in the browser. To group and ungroup tabs,
737-
* or to query what tabs are in groups, use the <code>browser.tabs</code> API.
738-
* Optional.
733+
* Use the browser.tabGroups API to interact with the browser's tab grouping system. You can use this API to modify,
734+
* and rearrange tab groups.
735+
*
736+
* Permissions: "tabGroups"
739737
*/
740-
tabGroups?: TabGroups.Static;
738+
tabGroups: TabGroups.Static;
741739

742740
/**
743741
* Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify,

types/webextension-polyfill/namespaces/action.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ export namespace Action {
137137
windowId?: number;
138138
}
139139

140+
interface OnUserSettingsChangedChangeType {
141+
/**
142+
* Whether the extension's action icon is visible on browser windows' top-level toolbar (i.e.,
143+
* whether the extension has been 'pinned' by the user).
144+
* Optional.
145+
*/
146+
isOnToolbar?: boolean;
147+
}
148+
140149
type OnClickDataModifiersItemEnum = "Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl";
141150

142151
interface Static {
@@ -235,5 +244,10 @@ export namespace Action {
235244
* @param info Optional.
236245
*/
237246
onClicked: Events.Event<(tab: Tabs.Tab, info: OnClickData | undefined) => void>;
247+
248+
/**
249+
* Fired when user-specified settings relating to an extension's action change.
250+
*/
251+
onUserSettingsChanged: Events.Event<(change: OnUserSettingsChangedChangeType) => void>;
238252
}
239253
}

types/webextension-polyfill/namespaces/alarms.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export namespace Alarms {
6565
* Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided,
6666
* then the alarm recurs repeatedly after that many minutes.
6767
*/
68-
create(name: string | undefined, alarmInfo: CreateAlarmInfoType): void;
68+
create(name: string | undefined, alarmInfo: CreateAlarmInfoType): Promise<void>;
6969

7070
/**
7171
* Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name
@@ -77,7 +77,7 @@ export namespace Alarms {
7777
* Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided,
7878
* then the alarm recurs repeatedly after that many minutes.
7979
*/
80-
create(alarmInfo: CreateAlarmInfoType): void;
80+
create(alarmInfo: CreateAlarmInfoType): Promise<void>;
8181

8282
/**
8383
* Retrieves details about the specified alarm.

types/webextension-polyfill/namespaces/browserSettings.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ export namespace BrowserSettings {
115115
*/
116116
zoomSiteSpecific: Types.Setting;
117117

118+
/**
119+
* This boolean setting controls whether vertical tabs are enabled.
120+
*/
121+
verticalTabs: Types.Setting;
122+
118123
colorManagement: BrowserSettingsColorManagement.Static;
119124
}
120125
}

types/webextension-polyfill/namespaces/contentScripts.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ export namespace ContentScripts {
7777
*/
7878
world?: ExtensionTypes.ExecutionWorld;
7979

80+
/**
81+
* The css origin of the stylesheet to inject. Defaults to "author".
82+
* Optional.
83+
*/
84+
cssOrigin?: ExtensionTypes.CSSOrigin;
85+
8086
/**
8187
* limit the set of matched tabs to those that belong to the given cookie store id
8288
* Optional.

types/webextension-polyfill/namespaces/cookies.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export namespace Cookies {
1313
* 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax',
1414
* and 'strict' to 'SameSite=Strict'.
1515
*/
16-
type SameSiteStatus = "no_restriction" | "lax" | "strict";
16+
type SameSiteStatus = "unspecified" | "no_restriction" | "lax" | "strict";
1717

1818
/**
1919
* The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.

types/webextension-polyfill/namespaces/declarativeNetRequest.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
export namespace DeclarativeNetRequest {
99
/**
1010
* How the requested resource will be used. Comparable to the webRequest.ResourceType type.
11+
* object_subrequest is unsupported.
1112
*/
1213
type ResourceType =
1314
| "main_frame"

types/webextension-polyfill/namespaces/i18n.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export namespace I18n {
6060
*/
6161
getMessage(messageName: string, substitutions?: string[] | string): string;
6262

63+
/**
64+
* Gets the preferred locales of the operating system. This is different from the locales set in the browser; to get those,
65+
* use $(ref:i18n.getAcceptLanguages).
66+
*/
67+
getPreferredSystemLanguages(): Promise<LanguageCode[]>;
68+
6369
/**
6470
* Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages)
6571
* which returns the preferred user languages.

types/webextension-polyfill/namespaces/manifest.d.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export namespace Manifest {
2727
browser_specific_settings?: BrowserSpecificSettings;
2828

2929
/**
30-
* Name must be at least 2, at should be at most 75 characters
30+
* Name must be at least 2, and should be at most 75 characters
3131
*/
3232
name: string;
3333

@@ -287,6 +287,7 @@ export namespace Manifest {
287287
| "menus.overrideContext"
288288
| "scripting"
289289
| "search"
290+
| "tabGroups"
290291
| "activeTab"
291292
| "webRequest"
292293
| "webRequestAuthProvider"
@@ -315,7 +316,6 @@ export namespace Manifest {
315316
| "proxy"
316317
| "nativeMessaging"
317318
| "sessions"
318-
| "tabGroups"
319319
| "tabs"
320320
| "tabHide"
321321
| "topSites"
@@ -326,6 +326,23 @@ export namespace Manifest {
326326

327327
type PermissionPrivileged = "mozillaAddons" | "activityLog" | "networkStatus" | "normandyAddonStudy";
328328

329+
type CommonDataCollectionPermission =
330+
| "authenticationInfo"
331+
| "bookmarksInfo"
332+
| "browsingActivity"
333+
| "financialAndPaymentInfo"
334+
| "healthInfo"
335+
| "locationInfo"
336+
| "personalCommunications"
337+
| "personallyIdentifyingInfo"
338+
| "searchTerms"
339+
| "websiteActivity"
340+
| "websiteContent";
341+
342+
type DataCollectionPermission = CommonDataCollectionPermission | "none";
343+
344+
type OptionalDataCollectionPermission = CommonDataCollectionPermission | "technicalAndInteraction";
345+
329346
type PermissionNoPrompt =
330347
| OptionalPermissionNoPrompt
331348
| PermissionPrivileged
@@ -381,6 +398,11 @@ export namespace Manifest {
381398
* Optional.
382399
*/
383400
admin_install_only?: boolean;
401+
402+
/**
403+
* Optional.
404+
*/
405+
data_collection_permissions?: FirefoxSpecificPropertiesDataCollectionPermissionsType;
384406
}
385407

386408
interface GeckoAndroidSpecificProperties {
@@ -456,6 +478,11 @@ export namespace Manifest {
456478
*/
457479
css?: ExtensionURL[];
458480

481+
/**
482+
* Optional.
483+
*/
484+
css_origin?: ExtensionTypes.CSSOrigin;
485+
459486
/**
460487
* The list of JS files to inject
461488
* Optional.
@@ -1007,6 +1034,23 @@ export namespace Manifest {
10071034
paths?: string[];
10081035
}
10091036

1037+
interface FirefoxSpecificPropertiesDataCollectionPermissionsType {
1038+
/**
1039+
* Optional.
1040+
*/
1041+
required?: DataCollectionPermission[];
1042+
1043+
/**
1044+
* Optional.
1045+
*/
1046+
optional?: OptionalDataCollectionPermission[];
1047+
1048+
/**
1049+
* Optional.
1050+
*/
1051+
has_previous_consent?: boolean;
1052+
}
1053+
10101054
/**
10111055
* Defines the location the browserAction will appear by default. The default location is navbar.
10121056
*/

types/webextension-polyfill/namespaces/menus.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export namespace Menus {
2727
| "audio"
2828
| "launcher"
2929
| "bookmark"
30+
| "page_action"
3031
| "tab"
3132
| "tools_menu"
3233
| "browser_action"
33-
| "page_action"
3434
| "action";
3535

3636
/**

0 commit comments

Comments
 (0)