@wxt-dev/browser 0.0.328 → 0.0.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/gen/index.d.ts +1409 -1877
package/src/gen/index.d.ts
CHANGED
|
@@ -2555,52 +2555,9 @@ export namespace Browser {
|
|
|
2555
2555
|
* Permissions: "declarativeContent"
|
|
2556
2556
|
*/
|
|
2557
2557
|
export namespace declarativeContent {
|
|
2558
|
-
export interface PageStateUrlDetails {
|
|
2559
|
-
/** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */
|
|
2560
|
-
hostContains?: string | undefined;
|
|
2561
|
-
/** Optional. Matches if the host name of the URL is equal to a specified string. */
|
|
2562
|
-
hostEquals?: string | undefined;
|
|
2563
|
-
/** Optional. Matches if the host name of the URL starts with a specified string. */
|
|
2564
|
-
hostPrefix?: string | undefined;
|
|
2565
|
-
/** Optional. Matches if the host name of the URL ends with a specified string. */
|
|
2566
|
-
hostSuffix?: string | undefined;
|
|
2567
|
-
/** Optional. Matches if the path segment of the URL contains a specified string. */
|
|
2568
|
-
pathContains?: string | undefined;
|
|
2569
|
-
/** Optional. Matches if the path segment of the URL is equal to a specified string. */
|
|
2570
|
-
pathEquals?: string | undefined;
|
|
2571
|
-
/** Optional. Matches if the path segment of the URL starts with a specified string. */
|
|
2572
|
-
pathPrefix?: string | undefined;
|
|
2573
|
-
/** Optional. Matches if the path segment of the URL ends with a specified string. */
|
|
2574
|
-
pathSuffix?: string | undefined;
|
|
2575
|
-
/** Optional. Matches if the query segment of the URL contains a specified string. */
|
|
2576
|
-
queryContains?: string | undefined;
|
|
2577
|
-
/** Optional. Matches if the query segment of the URL is equal to a specified string. */
|
|
2578
|
-
queryEquals?: string | undefined;
|
|
2579
|
-
/** Optional. Matches if the query segment of the URL starts with a specified string. */
|
|
2580
|
-
queryPrefix?: string | undefined;
|
|
2581
|
-
/** Optional. Matches if the query segment of the URL ends with a specified string. */
|
|
2582
|
-
querySuffix?: string | undefined;
|
|
2583
|
-
/** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
2584
|
-
urlContains?: string | undefined;
|
|
2585
|
-
/** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
2586
|
-
urlEquals?: string | undefined;
|
|
2587
|
-
/** Optional. Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
|
2588
|
-
urlMatches?: string | undefined;
|
|
2589
|
-
/** Optional. Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
|
2590
|
-
originAndPathMatches?: string | undefined;
|
|
2591
|
-
/** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
2592
|
-
urlPrefix?: string | undefined;
|
|
2593
|
-
/** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
2594
|
-
urlSuffix?: string | undefined;
|
|
2595
|
-
/** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
|
2596
|
-
schemes?: string[] | undefined;
|
|
2597
|
-
/** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */
|
|
2598
|
-
ports?: Array<number | number[]> | undefined;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
2558
|
export class PageStateMatcherProperties {
|
|
2602
2559
|
/** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */
|
|
2603
|
-
pageUrl?:
|
|
2560
|
+
pageUrl?: events.UrlFilter | undefined;
|
|
2604
2561
|
/** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */
|
|
2605
2562
|
css?: string[] | undefined;
|
|
2606
2563
|
/**
|
|
@@ -3721,58 +3678,70 @@ export namespace Browser {
|
|
|
3721
3678
|
value: string;
|
|
3722
3679
|
}
|
|
3723
3680
|
|
|
3724
|
-
export
|
|
3681
|
+
export enum FilenameConflictAction {
|
|
3682
|
+
/** To avoid duplication, the filename is changed to include a counter before the filename extension. */
|
|
3683
|
+
UNIQUIFY = "uniquify",
|
|
3684
|
+
/** The existing file will be overwritten with the new file. */
|
|
3685
|
+
OVERWRITE = "overwrite",
|
|
3686
|
+
/** The user will be prompted with a file chooser dialog. */
|
|
3687
|
+
PROMPT = "prompt",
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3690
|
+
export enum HttpMethod {
|
|
3691
|
+
GET = "GET",
|
|
3692
|
+
POST = "POST",
|
|
3693
|
+
}
|
|
3725
3694
|
|
|
3726
3695
|
export interface DownloadOptions {
|
|
3727
|
-
/**
|
|
3696
|
+
/** Post body. */
|
|
3728
3697
|
body?: string | undefined;
|
|
3729
|
-
/**
|
|
3698
|
+
/** Use a file-chooser to allow the user to select a filename regardless of whether `filename` is set or already exists. */
|
|
3730
3699
|
saveAs?: boolean | undefined;
|
|
3731
3700
|
/** The URL to download. */
|
|
3732
3701
|
url: string;
|
|
3733
|
-
/**
|
|
3702
|
+
/** A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will cause an error. {@link onDeterminingFilename} allows suggesting a filename after the file's MIME type and a tentative filename have been determined. */
|
|
3734
3703
|
filename?: string | undefined;
|
|
3735
|
-
/**
|
|
3704
|
+
/** Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys `name` and either `value` or `binaryValue`, restricted to those allowed by XMLHttpRequest. */
|
|
3736
3705
|
headers?: HeaderNameValuePair[] | undefined;
|
|
3737
|
-
/**
|
|
3738
|
-
method?:
|
|
3739
|
-
/**
|
|
3740
|
-
conflictAction?: FilenameConflictAction | undefined;
|
|
3706
|
+
/** The HTTP method to use if the URL uses the HTTP[S] protocol. */
|
|
3707
|
+
method?: `${HttpMethod}` | undefined;
|
|
3708
|
+
/** The action to take if `filename` already exists. */
|
|
3709
|
+
conflictAction?: `${FilenameConflictAction}` | undefined;
|
|
3741
3710
|
}
|
|
3742
3711
|
|
|
3743
3712
|
export interface DownloadDelta {
|
|
3744
|
-
/** The id of the DownloadItem that changed. */
|
|
3713
|
+
/** The id of the {@link DownloadItem} that changed. */
|
|
3745
3714
|
id: number;
|
|
3746
|
-
/**
|
|
3715
|
+
/** The change in `danger`, if any. */
|
|
3747
3716
|
danger?: StringDelta | undefined;
|
|
3748
|
-
/**
|
|
3717
|
+
/** The change in `url`, if any. */
|
|
3749
3718
|
url?: StringDelta | undefined;
|
|
3750
3719
|
/**
|
|
3751
|
-
*
|
|
3720
|
+
* The change in `finalUrl`, if any.
|
|
3752
3721
|
* @since Chrome 54
|
|
3753
3722
|
*/
|
|
3754
3723
|
finalUrl?: StringDelta | undefined;
|
|
3755
|
-
/**
|
|
3724
|
+
/** The change in `totalBytes`, if any. */
|
|
3756
3725
|
totalBytes?: DoubleDelta | undefined;
|
|
3757
|
-
/**
|
|
3726
|
+
/** The change in `filename`, if any. */
|
|
3758
3727
|
filename?: StringDelta | undefined;
|
|
3759
|
-
/**
|
|
3728
|
+
/** The change in `paused`, if any. */
|
|
3760
3729
|
paused?: BooleanDelta | undefined;
|
|
3761
|
-
/**
|
|
3730
|
+
/** The change in `state`, if any. */
|
|
3762
3731
|
state?: StringDelta | undefined;
|
|
3763
|
-
/**
|
|
3732
|
+
/** The change in `mime`, if any. */
|
|
3764
3733
|
mime?: StringDelta | undefined;
|
|
3765
|
-
/**
|
|
3734
|
+
/** The change in `fileSize`, if any. */
|
|
3766
3735
|
fileSize?: DoubleDelta | undefined;
|
|
3767
|
-
/**
|
|
3736
|
+
/** The change in `startTime`, if any. */
|
|
3768
3737
|
startTime?: StringDelta | undefined;
|
|
3769
|
-
/**
|
|
3738
|
+
/** The change in `error`, if any. */
|
|
3770
3739
|
error?: StringDelta | undefined;
|
|
3771
|
-
/**
|
|
3740
|
+
/** The change in `endTime`, if any. */
|
|
3772
3741
|
endTime?: StringDelta | undefined;
|
|
3773
|
-
/**
|
|
3742
|
+
/** The change in `canResume`, if any. */
|
|
3774
3743
|
canResume?: BooleanDelta | undefined;
|
|
3775
|
-
/**
|
|
3744
|
+
/** The change in `exists`, if any. */
|
|
3776
3745
|
exists?: BooleanDelta | undefined;
|
|
3777
3746
|
}
|
|
3778
3747
|
|
|
@@ -3781,7 +3750,6 @@ export namespace Browser {
|
|
|
3781
3750
|
previous?: boolean | undefined;
|
|
3782
3751
|
}
|
|
3783
3752
|
|
|
3784
|
-
/** @since Chrome 34 */
|
|
3785
3753
|
export interface DoubleDelta {
|
|
3786
3754
|
current?: number | undefined;
|
|
3787
3755
|
previous?: number | undefined;
|
|
@@ -3792,46 +3760,85 @@ export namespace Browser {
|
|
|
3792
3760
|
previous?: string | undefined;
|
|
3793
3761
|
}
|
|
3794
3762
|
|
|
3795
|
-
export
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3763
|
+
export enum InterruptReason {
|
|
3764
|
+
FILE_FAILED = "FILE_FAILED",
|
|
3765
|
+
FILE_ACCESS_DENIED = "FILE_ACCESS_DENIED",
|
|
3766
|
+
FILE_NO_SPACE = "FILE_NO_SPACE",
|
|
3767
|
+
FILE_NAME_TOO_LONG = "FILE_NAME_TOO_LONG",
|
|
3768
|
+
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
3769
|
+
FILE_VIRUS_INFECTED = "FILE_VIRUS_INFECTED",
|
|
3770
|
+
FILE_TRANSIENT_ERROR = "FILE_TRANSIENT_ERROR",
|
|
3771
|
+
FILE_BLOCKED = "FILE_BLOCKED",
|
|
3772
|
+
FILE_SECURITY_CHECK_FAILED = "FILE_SECURITY_CHECK_FAILED",
|
|
3773
|
+
FILE_TOO_SHORT = "FILE_TOO_SHORT",
|
|
3774
|
+
FILE_HASH_MISMATCH = "FILE_HASH_MISMATCH",
|
|
3775
|
+
FILE_SAME_AS_SOURCE = "FILE_SAME_AS_SOURCE",
|
|
3776
|
+
NETWORK_FAILED = "NETWORK_FAILED",
|
|
3777
|
+
NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
|
|
3778
|
+
NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED",
|
|
3779
|
+
NETWORK_SERVER_DOWN = "NETWORK_SERVER_DOWN",
|
|
3780
|
+
NETWORK_INVALID_REQUEST = "NETWORK_INVALID_REQUEST",
|
|
3781
|
+
SERVER_FAILED = "SERVER_FAILED",
|
|
3782
|
+
SERVER_NO_RANGE = "SERVER_NO_RANGE",
|
|
3783
|
+
SERVER_BAD_CONTENT = "SERVER_BAD_CONTENT",
|
|
3784
|
+
SERVER_UNAUTHORIZED = "SERVER_UNAUTHORIZED",
|
|
3785
|
+
SERVER_CERT_PROBLEM = "SERVER_CERT_PROBLEM",
|
|
3786
|
+
SERVER_FORBIDDEN = "SERVER_FORBIDDEN",
|
|
3787
|
+
SERVER_UNREACHABLE = "SERVER_UNREACHABLE",
|
|
3788
|
+
SERVER_CONTENT_LENGTH_MISMATCH = "SERVER_CONTENT_LENGTH_MISMATCH",
|
|
3789
|
+
SERVER_CROSS_ORIGIN_REDIRECT = "SERVER_CROSS_ORIGIN_REDIRECT",
|
|
3790
|
+
USER_CANCELED = "USER_CANCELED",
|
|
3791
|
+
USER_SHUTDOWN = "USER_SHUTDOWN",
|
|
3792
|
+
CRASH = "CRASH",
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
export enum State {
|
|
3796
|
+
/** The download is currently receiving data from the server. */
|
|
3797
|
+
IN_PROGRESS = "in_progress",
|
|
3798
|
+
/** An error broke the connection with the file host. */
|
|
3799
|
+
INTERRUPTED = "interrupted",
|
|
3800
|
+
/** The download completed successfully. */
|
|
3801
|
+
COMPLETE = "complete",
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
export enum DangerType {
|
|
3805
|
+
/** The download's filename is suspicious. */
|
|
3806
|
+
FILE = "file",
|
|
3807
|
+
/** The download's URL is known to be malicious. */
|
|
3808
|
+
URL = "url",
|
|
3809
|
+
/** The downloaded file is known to be malicious. */
|
|
3810
|
+
CONTENT = "content",
|
|
3811
|
+
/** The download's URL is not commonly downloaded and could be dangerous. */
|
|
3812
|
+
UNCOMMON = "uncommon",
|
|
3813
|
+
/** The download came from a host known to distribute malicious binaries and is likely dangerous. */
|
|
3814
|
+
HOST = "host",
|
|
3815
|
+
/** The download is potentially unwanted or unsafe. E.g. it could make changes to browser or computer settings. */
|
|
3816
|
+
UNWANTED = "unwanted",
|
|
3817
|
+
/** The download presents no known danger to the user's computer. */
|
|
3818
|
+
SAFE = "safe",
|
|
3819
|
+
/** The user has accepted the dangerous download. */
|
|
3820
|
+
ACCEPTED = "accepted",
|
|
3821
|
+
ALLOWLISTED_BY_POLICY = "allowlistedByPolicy",
|
|
3822
|
+
ASYNC_SCANNING = "asyncScanning",
|
|
3823
|
+
ASYNC_LOCAL_PASSWORD_SCANNING = "asyncLocalPasswordScanning",
|
|
3824
|
+
PASSWORD_PROTECTED = "passwordProtected",
|
|
3825
|
+
BLOCKED_TOO_LARGE = "blockedTooLarge",
|
|
3826
|
+
SENSITIVE_CONTENT_WARNING = "sensitiveContentWarning",
|
|
3827
|
+
SENSITIVE_CONTENT_BLOCK = "sensitiveContentBlock",
|
|
3828
|
+
DEEP_SCANNED_FAILED = "deepScannedFailed",
|
|
3829
|
+
DEEP_SCANNED_SAFE = "deepScannedSafe",
|
|
3830
|
+
DEEP_SCANNED_OPENED_DANGEROUS = "deepScannedOpenedDangerous",
|
|
3831
|
+
PROMPT_FOR_SCANNING = "promptForScanning",
|
|
3832
|
+
PROMPT_FOR_LOCAL_PASSWORD_SCANNING = "promptForLocalPasswordScanning",
|
|
3833
|
+
ACCOUNT_COMPROMISE = "accountCompromise",
|
|
3834
|
+
BLOCKED_SCAN_FAILED = "blockedScanFailed",
|
|
3835
|
+
}
|
|
3829
3836
|
|
|
3830
3837
|
export interface DownloadItem {
|
|
3831
3838
|
/** Number of bytes received so far from the host, without considering file compression. */
|
|
3832
3839
|
bytesReceived: number;
|
|
3833
3840
|
/** Indication of whether this download is thought to be safe or known to be suspicious. */
|
|
3834
|
-
danger: DangerType
|
|
3841
|
+
danger: `${DangerType}`;
|
|
3835
3842
|
/** The absolute URL that this download initiated from, before any redirects. */
|
|
3836
3843
|
url: string;
|
|
3837
3844
|
/**
|
|
@@ -3846,16 +3853,16 @@ export namespace Browser {
|
|
|
3846
3853
|
/** True if the download has stopped reading data from the host, but kept the connection open. */
|
|
3847
3854
|
paused: boolean;
|
|
3848
3855
|
/** Indicates whether the download is progressing, interrupted, or complete. */
|
|
3849
|
-
state:
|
|
3856
|
+
state: `${State}`;
|
|
3850
3857
|
/** The file's MIME type. */
|
|
3851
3858
|
mime: string;
|
|
3852
3859
|
/** Number of bytes in the whole file post-decompression, or -1 if unknown. */
|
|
3853
3860
|
fileSize: number;
|
|
3854
|
-
/** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: Browser.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})}) */
|
|
3861
|
+
/** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: `Browser.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})})` */
|
|
3855
3862
|
startTime: string;
|
|
3856
|
-
/**
|
|
3857
|
-
error?:
|
|
3858
|
-
/**
|
|
3863
|
+
/** Why the download was interrupted. Several kinds of HTTP errors may be grouped under one of the errors beginning with `SERVER_`. Errors relating to the network begin with `NETWORK_`, errors relating to the process of writing the file to the file system begin with `FILE_`, and interruptions initiated by the user begin with `USER_`. */
|
|
3864
|
+
error?: `${InterruptReason}` | undefined;
|
|
3865
|
+
/** The time when the download ended in ISO 8601 format. May be passed directly to the Date constructor: `Browser.downloads.search({}, function(items){items.forEach(function(item){if (item.endTime) console.log(new Date(item.endTime))})})` */
|
|
3859
3866
|
endTime?: string | undefined;
|
|
3860
3867
|
/** An identifier that is persistent across browser sessions. */
|
|
3861
3868
|
id: number;
|
|
@@ -3863,248 +3870,232 @@ export namespace Browser {
|
|
|
3863
3870
|
incognito: boolean;
|
|
3864
3871
|
/** Absolute URL. */
|
|
3865
3872
|
referrer: string;
|
|
3866
|
-
/**
|
|
3873
|
+
/** Estimated time when the download will complete in ISO 8601 format. May be passed directly to the Date constructor: `Browser.downloads.search({}, function(items){items.forEach(function(item){if (item.estimatedEndTime) console.log(new Date(item.estimatedEndTime))})})` */
|
|
3867
3874
|
estimatedEndTime?: string | undefined;
|
|
3868
3875
|
/** True if the download is in progress and paused, or else if it is interrupted and can be resumed starting from where it was interrupted. */
|
|
3869
3876
|
canResume: boolean;
|
|
3870
|
-
/** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call search() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an onChanged event will fire. Note that search() does not wait for the existence check to finish before returning, so results from search() may not accurately reflect the file system. Also, search() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */
|
|
3877
|
+
/** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call {@link search}() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an {@link onChanged} event will fire. Note that {@link search}() does not wait for the existence check to finish before returning, so results from {@link search}() may not accurately reflect the file system. Also, {@link search}() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */
|
|
3871
3878
|
exists: boolean;
|
|
3872
|
-
/**
|
|
3879
|
+
/** The identifier for the extension that initiated this download if this download was initiated by an extension. Does not change once it is set. */
|
|
3873
3880
|
byExtensionId?: string | undefined;
|
|
3874
|
-
/**
|
|
3881
|
+
/** The localized name of the extension that initiated this download if this download was initiated by an extension. May change if the extension changes its name or if the user changes their locale. */
|
|
3875
3882
|
byExtensionName?: string | undefined;
|
|
3876
3883
|
}
|
|
3877
3884
|
|
|
3878
3885
|
export interface GetFileIconOptions {
|
|
3879
|
-
/**
|
|
3880
|
-
*/
|
|
3886
|
+
/** The size of the returned icon. The icon will be square with dimensions size * size pixels. The default and largest size for the icon is 32x32 pixels. The only supported sizes are 16 and 32. It is an error to specify any other size. */
|
|
3881
3887
|
size?: 16 | 32 | undefined;
|
|
3882
3888
|
}
|
|
3883
3889
|
|
|
3884
3890
|
export interface DownloadQuery {
|
|
3885
|
-
/**
|
|
3891
|
+
/** Set elements of this array to {@link DownloadItem} properties in order to sort search results. For example, setting `orderBy=['startTime']` sorts the {@link DownloadItem} by their start time in ascending order. To specify descending order, prefix with a hyphen: '-startTime'. */
|
|
3886
3892
|
orderBy?: string[] | undefined;
|
|
3887
|
-
/**
|
|
3893
|
+
/** Limits results to {@link DownloadItem} whose `url` matches the given regular expression. */
|
|
3888
3894
|
urlRegex?: string | undefined;
|
|
3889
|
-
/**
|
|
3895
|
+
/** Limits results to {@link DownloadItem} that ended before the time in ISO 8601 format. */
|
|
3890
3896
|
endedBefore?: string | undefined;
|
|
3891
|
-
/**
|
|
3897
|
+
/** Limits results to {@link DownloadItem} whose `totalBytes` is greater than the given integer. */
|
|
3892
3898
|
totalBytesGreater?: number | undefined;
|
|
3893
|
-
/**
|
|
3894
|
-
danger?:
|
|
3895
|
-
/**
|
|
3899
|
+
/** Indication of whether this download is thought to be safe or known to be suspicious. */
|
|
3900
|
+
danger?: `${DangerType}` | undefined;
|
|
3901
|
+
/** Number of bytes in the whole file, without considering file compression, or -1 if unknown. */
|
|
3896
3902
|
totalBytes?: number | undefined;
|
|
3897
|
-
/**
|
|
3903
|
+
/** True if the download has stopped reading data from the host, but kept the connection open. */
|
|
3898
3904
|
paused?: boolean | undefined;
|
|
3899
|
-
/**
|
|
3905
|
+
/** Limits results to {@link DownloadItem} whose `filename` matches the given regular expression. */
|
|
3900
3906
|
filenameRegex?: string | undefined;
|
|
3901
|
-
/**
|
|
3907
|
+
/**
|
|
3908
|
+
* The absolute URL that this download is being made from, after all redirects.
|
|
3909
|
+
* @since Chrome 54
|
|
3910
|
+
*/
|
|
3911
|
+
finalUrl?: string;
|
|
3912
|
+
/**
|
|
3913
|
+
* Limits results to {@link DownloadItem} whose `finalUrl` matches the given regular expression.
|
|
3914
|
+
* @since Chrome 54
|
|
3915
|
+
*/
|
|
3916
|
+
finalUrlRegex?: string;
|
|
3917
|
+
/** This array of search terms limits results to {@link DownloadItem} whose `filename` or `url` or `finalUrl` contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash. */
|
|
3902
3918
|
query?: string[] | undefined;
|
|
3903
|
-
/**
|
|
3919
|
+
/** Limits results to {@link DownloadItem} whose `totalBytes` is less than the given integer. */
|
|
3904
3920
|
totalBytesLess?: number | undefined;
|
|
3905
|
-
/**
|
|
3921
|
+
/** The `id` of the {@link DownloadItem} to query. */
|
|
3906
3922
|
id?: number | undefined;
|
|
3907
|
-
/**
|
|
3923
|
+
/** Number of bytes received so far from the host, without considering file compression. */
|
|
3908
3924
|
bytesReceived?: number | undefined;
|
|
3909
|
-
/**
|
|
3925
|
+
/** Limits results to {@link DownloadItem} that ended after the time in ISO 8601 format. */
|
|
3910
3926
|
endedAfter?: string | undefined;
|
|
3911
|
-
/**
|
|
3927
|
+
/** Absolute local path. */
|
|
3912
3928
|
filename?: string | undefined;
|
|
3913
|
-
/**
|
|
3914
|
-
state?:
|
|
3915
|
-
/**
|
|
3929
|
+
/** Indicates whether the download is progressing, interrupted, or complete. */
|
|
3930
|
+
state?: `${State}` | undefined;
|
|
3931
|
+
/** Limits results to {@link DownloadItem} that started after the time in ISO 8601 format. */
|
|
3916
3932
|
startedAfter?: string | undefined;
|
|
3917
|
-
/**
|
|
3933
|
+
/** The file's MIME type. */
|
|
3918
3934
|
mime?: string | undefined;
|
|
3919
|
-
/**
|
|
3935
|
+
/** Number of bytes in the whole file post-decompression, or -1 if unknown. */
|
|
3920
3936
|
fileSize?: number | undefined;
|
|
3921
|
-
/**
|
|
3937
|
+
/** The time when the download began in ISO 8601 format. */
|
|
3922
3938
|
startTime?: string | undefined;
|
|
3923
|
-
/**
|
|
3939
|
+
/** The absolute URL that this download initiated from, before any redirects. */
|
|
3924
3940
|
url?: string | undefined;
|
|
3925
|
-
/**
|
|
3941
|
+
/** Limits results to {@link DownloadItem} that started before the time in ISO 8601 format. */
|
|
3926
3942
|
startedBefore?: string | undefined;
|
|
3927
|
-
/**
|
|
3943
|
+
/** The maximum number of matching {@link DownloadItem} returned. Defaults to 1000. Set to 0 in order to return all matching {@link DownloadItem}. See {@link search} for how to page through results. */
|
|
3928
3944
|
limit?: number | undefined;
|
|
3929
|
-
/**
|
|
3930
|
-
error?:
|
|
3931
|
-
/**
|
|
3945
|
+
/** Why a download was interrupted. */
|
|
3946
|
+
error?: `${InterruptReason}` | undefined;
|
|
3947
|
+
/** The time when the download ended in ISO 8601 format. */
|
|
3932
3948
|
endTime?: string | undefined;
|
|
3933
|
-
/**
|
|
3949
|
+
/** Whether the downloaded file exists; */
|
|
3934
3950
|
exists?: boolean | undefined;
|
|
3935
3951
|
}
|
|
3936
3952
|
|
|
3937
|
-
export interface
|
|
3938
|
-
/** The DownloadItem's new target DownloadItem.filename, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. */
|
|
3953
|
+
export interface FilenameSuggestion {
|
|
3954
|
+
/** The {@link DownloadItem}'s new target {@link DownloadItem.filename}, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. `filename` is ignored if there are any {@link onDeterminingFilename} listeners registered by any extensions. */
|
|
3939
3955
|
filename: string;
|
|
3940
|
-
/**
|
|
3941
|
-
conflictAction?:
|
|
3956
|
+
/** The action to take if `filename` already exists. */
|
|
3957
|
+
conflictAction?: `${FilenameConflictAction}` | undefined;
|
|
3942
3958
|
}
|
|
3943
3959
|
|
|
3960
|
+
/** @since Chrome 105 */
|
|
3944
3961
|
export interface UiOptions {
|
|
3945
3962
|
/** Enable or disable the download UI. */
|
|
3946
3963
|
enabled: boolean;
|
|
3947
3964
|
}
|
|
3948
3965
|
|
|
3949
|
-
export interface DownloadChangedEvent extends Browser.events.Event<(downloadDelta: DownloadDelta) => void> {}
|
|
3950
|
-
|
|
3951
|
-
export interface DownloadCreatedEvent extends Browser.events.Event<(downloadItem: DownloadItem) => void> {}
|
|
3952
|
-
|
|
3953
|
-
export interface DownloadErasedEvent extends Browser.events.Event<(downloadId: number) => void> {}
|
|
3954
|
-
|
|
3955
|
-
export interface DownloadDeterminingFilenameEvent extends
|
|
3956
|
-
Browser.events.Event<
|
|
3957
|
-
(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void
|
|
3958
|
-
>
|
|
3959
|
-
{}
|
|
3960
|
-
|
|
3961
3966
|
/**
|
|
3962
|
-
* Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime']
|
|
3963
|
-
*
|
|
3967
|
+
* Find {@link DownloadItem}. Set `query` to the empty object to get all {@link DownloadItem}. To get a specific {@link DownloadItem}, set only the `id` field. To page through a large number of items, set `orderBy: ['-startTime']`, set `limit` to the number of items per page, and set `startedAfter` to the `startTime` of the last item from the last page.
|
|
3968
|
+
*
|
|
3969
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
3964
3970
|
*/
|
|
3965
3971
|
export function search(query: DownloadQuery): Promise<DownloadItem[]>;
|
|
3966
|
-
/**
|
|
3967
|
-
* Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page.
|
|
3968
|
-
*/
|
|
3969
3972
|
export function search(query: DownloadQuery, callback: (results: DownloadItem[]) => void): void;
|
|
3973
|
+
|
|
3970
3974
|
/**
|
|
3971
|
-
* Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
|
3975
|
+
* Pause the download. If the request was successful the download is in a paused state. Otherwise {@link runtime.lastError} contains an error message. The request will fail if the download is not active.
|
|
3972
3976
|
* @param downloadId The id of the download to pause.
|
|
3973
|
-
*
|
|
3977
|
+
*
|
|
3978
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
3974
3979
|
*/
|
|
3975
3980
|
export function pause(downloadId: number): Promise<void>;
|
|
3976
|
-
/**
|
|
3977
|
-
* Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
|
3978
|
-
* @param downloadId The id of the download to pause.
|
|
3979
|
-
* @param callback Called when the pause request is completed.
|
|
3980
|
-
*/
|
|
3981
3981
|
export function pause(downloadId: number, callback: () => void): void;
|
|
3982
|
+
|
|
3982
3983
|
/**
|
|
3983
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
|
3984
|
-
* @param downloadId The identifier for the download.
|
|
3985
|
-
* @return The `getFileIcon` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
3986
|
-
*/
|
|
3987
|
-
export function getFileIcon(downloadId: number, options?: GetFileIconOptions): Promise<string>;
|
|
3988
|
-
/**
|
|
3989
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
|
3990
|
-
* @param downloadId The identifier for the download.
|
|
3991
|
-
* @param callback A URL to an image that represents the download.
|
|
3992
|
-
*/
|
|
3993
|
-
export function getFileIcon(downloadId: number, callback: (iconURL: string) => void): void;
|
|
3994
|
-
/**
|
|
3995
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
|
3984
|
+
* Retrieve an icon for the specified download. For new downloads, file icons are available after the {@link onCreated} event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, {@link runtime.lastError} will contain an error message.
|
|
3996
3985
|
* @param downloadId The identifier for the download.
|
|
3997
|
-
*
|
|
3986
|
+
*
|
|
3987
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
3998
3988
|
*/
|
|
3989
|
+
export function getFileIcon(downloadId: number, options?: GetFileIconOptions): Promise<string | undefined>;
|
|
3990
|
+
export function getFileIcon(downloadId: number, callback: (iconURL?: string) => void): void;
|
|
3999
3991
|
export function getFileIcon(
|
|
4000
3992
|
downloadId: number,
|
|
4001
3993
|
options: GetFileIconOptions,
|
|
4002
|
-
callback: (iconURL
|
|
3994
|
+
callback: (iconURL?: string) => void,
|
|
4003
3995
|
): void;
|
|
3996
|
+
|
|
4004
3997
|
/**
|
|
4005
|
-
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
|
3998
|
+
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise {@link runtime.lastError} contains an error message. The request will fail if the download is not active.
|
|
4006
3999
|
* @param downloadId The id of the download to resume.
|
|
4007
|
-
*
|
|
4000
|
+
*
|
|
4001
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4008
4002
|
*/
|
|
4009
4003
|
export function resume(downloadId: number): Promise<void>;
|
|
4010
|
-
/**
|
|
4011
|
-
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
|
4012
|
-
* @param downloadId The id of the download to resume.
|
|
4013
|
-
* @param callback Called when the resume request is completed.
|
|
4014
|
-
*/
|
|
4015
4004
|
export function resume(downloadId: number, callback: () => void): void;
|
|
4005
|
+
|
|
4016
4006
|
/**
|
|
4017
|
-
* Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
|
4007
|
+
* Cancel a download. When `callback` is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
|
4018
4008
|
* @param downloadId The id of the download to cancel.
|
|
4019
|
-
*
|
|
4009
|
+
*
|
|
4010
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4020
4011
|
*/
|
|
4021
4012
|
export function cancel(downloadId: number): Promise<void>;
|
|
4022
|
-
/**
|
|
4023
|
-
* Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
|
4024
|
-
* @param downloadId The id of the download to cancel.
|
|
4025
|
-
* @param callback Called when the cancel request is completed.
|
|
4026
|
-
*/
|
|
4027
4013
|
export function cancel(downloadId: number, callback: () => void): void;
|
|
4014
|
+
|
|
4028
4015
|
/**
|
|
4029
|
-
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename
|
|
4016
|
+
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both `filename` and `saveAs` are specified, then the Save As dialog will be displayed, pre-populated with the specified `filename`. If the download started successfully, `callback` will be called with the new {@link DownloadItem}'s `downloadId`. If there was an error starting the download, then `callback` will be called with `downloadId=undefined` and {@link runtime.lastError} will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it.
|
|
4030
4017
|
* @param options What to download and how.
|
|
4031
|
-
*
|
|
4018
|
+
*
|
|
4019
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4032
4020
|
*/
|
|
4033
4021
|
export function download(options: DownloadOptions): Promise<number>;
|
|
4034
|
-
/**
|
|
4035
|
-
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it.
|
|
4036
|
-
* @param options What to download and how.
|
|
4037
|
-
* @param callback Called with the id of the new DownloadItem.
|
|
4038
|
-
*/
|
|
4039
4022
|
export function download(options: DownloadOptions, callback: (downloadId: number) => void): void;
|
|
4023
|
+
|
|
4040
4024
|
/**
|
|
4041
|
-
*
|
|
4025
|
+
* Opens the downloaded file now if the {@link DownloadItem} is complete; otherwise returns an error through {@link runtime.lastError}. This method requires the `"downloads.open"` permission in addition to the `"downloads"` permission. An {@link onChanged} event fires when the item is opened for the first time. This method can only be called in response to a user gesture.
|
|
4042
4026
|
* @param downloadId The identifier for the downloaded file.
|
|
4027
|
+
*
|
|
4028
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 123.
|
|
4043
4029
|
*/
|
|
4044
|
-
export function open(downloadId: number): void
|
|
4030
|
+
export function open(downloadId: number): Promise<void>;
|
|
4031
|
+
export function open(
|
|
4032
|
+
downloadId: number,
|
|
4033
|
+
/** @since Chrome 123 */
|
|
4034
|
+
callback: () => void,
|
|
4035
|
+
): void;
|
|
4036
|
+
|
|
4045
4037
|
/**
|
|
4046
4038
|
* Show the downloaded file in its folder in a file manager.
|
|
4047
4039
|
* @param downloadId The identifier for the downloaded file.
|
|
4048
4040
|
*/
|
|
4049
4041
|
export function show(downloadId: number): void;
|
|
4042
|
+
|
|
4050
4043
|
/** Show the default Downloads folder in a file manager. */
|
|
4051
4044
|
export function showDefaultFolder(): void;
|
|
4045
|
+
|
|
4052
4046
|
/**
|
|
4053
|
-
* Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query
|
|
4054
|
-
*
|
|
4047
|
+
* Erase matching {@link DownloadItem} from history without deleting the downloaded file. An {@link onErased} event will fire for each {@link DownloadItem} that matches `query`, then `callback` will be called.
|
|
4048
|
+
*
|
|
4049
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4055
4050
|
*/
|
|
4056
4051
|
export function erase(query: DownloadQuery): Promise<number[]>;
|
|
4057
|
-
/**
|
|
4058
|
-
* Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query, then callback will be called.
|
|
4059
|
-
*/
|
|
4060
4052
|
export function erase(query: DownloadQuery, callback: (erasedIds: number[]) => void): void;
|
|
4053
|
+
|
|
4061
4054
|
/**
|
|
4062
|
-
* Remove the downloaded file if it exists and the DownloadItem is complete; otherwise return an error through runtime.lastError.
|
|
4063
|
-
*
|
|
4055
|
+
* Remove the downloaded file if it exists and the {@link DownloadItem} is complete; otherwise return an error through {@link runtime.lastError}.
|
|
4056
|
+
*
|
|
4057
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4064
4058
|
*/
|
|
4065
4059
|
export function removeFile(downloadId: number): Promise<void>;
|
|
4060
|
+
export function removeFile(downloadId: number, callback: () => void): void;
|
|
4061
|
+
|
|
4066
4062
|
/**
|
|
4067
|
-
*
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
* Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an onChanged event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and onChanged fires.
|
|
4072
|
-
* @param downloadId The identifier for the DownloadItem.
|
|
4073
|
-
* @return The `acceptDanger` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
4063
|
+
* Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an {@link onChanged} event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the `state` changes to 'complete', and {@link onChanged} fires.
|
|
4064
|
+
* @param downloadId The identifier for the {@link DownloadItem}.
|
|
4065
|
+
*
|
|
4066
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
4074
4067
|
*/
|
|
4075
4068
|
export function acceptDanger(downloadId: number): Promise<void>;
|
|
4069
|
+
export function acceptDanger(downloadId: number, callback: () => void): void;
|
|
4070
|
+
|
|
4076
4071
|
/**
|
|
4077
|
-
*
|
|
4078
|
-
* @
|
|
4079
|
-
* @param callback Called when the danger prompt dialog closes.
|
|
4072
|
+
* Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through {@link runtime.lastError}. Requires the `"downloads.shelf"` permission in addition to the `"downloads"` permission.
|
|
4073
|
+
* @deprecated since Chrome 117. Use {@link setUiOptions} instead.
|
|
4080
4074
|
*/
|
|
4081
|
-
export function acceptDanger(downloadId: number, callback: () => void): void;
|
|
4082
|
-
/** Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler. */
|
|
4083
|
-
export function drag(downloadId: number): void;
|
|
4084
|
-
/** Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.shelf" permission in addition to the "downloads" permission. */
|
|
4085
4075
|
export function setShelfEnabled(enabled: boolean): void;
|
|
4076
|
+
|
|
4086
4077
|
/**
|
|
4087
|
-
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set UiOptions.enabled to false, the download UI will be hidden. Setting UiOptions.enabled to true while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.ui" permission in addition to the "downloads" permission.
|
|
4088
|
-
* @param options Encapsulate a change to the download UI.
|
|
4078
|
+
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set {@link UiOptions.enabled} to false, the download UI will be hidden. Setting {@link UiOptions.enabled} to true while at least one other extension has disabled it will return an error through {@link runtime.lastError}. Requires the `"downloads.ui"` permission in addition to the `"downloads"` permission.
|
|
4089
4079
|
* @since Chrome 105
|
|
4080
|
+
*
|
|
4081
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 105.
|
|
4090
4082
|
*/
|
|
4091
4083
|
export function setUiOptions(options: UiOptions): Promise<void>;
|
|
4092
|
-
/**
|
|
4093
|
-
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set UiOptions.enabled to false, the download UI will be hidden. Setting UiOptions.enabled to true while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.ui" permission in addition to the "downloads" permission.
|
|
4094
|
-
* @param options Encapsulate a change to the download UI.
|
|
4095
|
-
* @param callback Called when the setUiOptions request is completed.
|
|
4096
|
-
* @since Chrome 105
|
|
4097
|
-
*/
|
|
4098
4084
|
export function setUiOptions(options: UiOptions, callback: () => void): void;
|
|
4099
4085
|
|
|
4100
|
-
/** When any of a DownloadItem's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. */
|
|
4101
|
-
export
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
/**
|
|
4107
|
-
export
|
|
4086
|
+
/** When any of a {@link DownloadItem}'s properties except `bytesReceived` and `estimatedEndTime` changes, this event fires with the `downloadId` and an object containing the properties that changed. */
|
|
4087
|
+
export const onChanged: events.Event<(downloadDelta: DownloadDelta) => void>;
|
|
4088
|
+
|
|
4089
|
+
/** This event fires with the {@link DownloadItem} object when a download begins. */
|
|
4090
|
+
export const onCreated: events.Event<(downloadItem: DownloadItem) => void>;
|
|
4091
|
+
|
|
4092
|
+
/** Fires with the `downloadId` when a download is erased from history. */
|
|
4093
|
+
export const onErased: events.Event<(downloadId: number) => void>;
|
|
4094
|
+
|
|
4095
|
+
/** During the filename determination process, extensions will be given the opportunity to override the target {@link DownloadItem.filename}. Each extension may not register more than one listener for this event. Each listener must call `suggest` exactly once, either synchronously or asynchronously. If the listener calls `suggest` asynchronously, then it must return `true`. If the listener neither calls `suggest` synchronously nor returns `true`, then `suggest` will be called automatically. The {@link DownloadItem} will not complete until all listeners have called `suggest`. Listeners may call `suggest` without any arguments in order to allow the download to use `downloadItem.filename` for its filename, or pass a `suggestion` object to `suggest` in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a `suggestion` object to `suggest` wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by {@link download} and the target filename is known before the MIME type and tentative filename have been determined, pass `filename` to {@link download} instead. */
|
|
4096
|
+
export const onDeterminingFilename: events.Event<
|
|
4097
|
+
(downloadItem: DownloadItem, suggest: (suggestion?: FilenameSuggestion) => void) => void
|
|
4098
|
+
>;
|
|
4108
4099
|
}
|
|
4109
4100
|
|
|
4110
4101
|
////////////////////
|
|
@@ -4408,53 +4399,50 @@ export namespace Browser {
|
|
|
4408
4399
|
export namespace events {
|
|
4409
4400
|
/** Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */
|
|
4410
4401
|
export interface UrlFilter {
|
|
4411
|
-
/** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
|
4412
|
-
schemes?: string[] | undefined;
|
|
4413
4402
|
/**
|
|
4414
|
-
*
|
|
4415
|
-
* @since Chrome
|
|
4416
|
-
* Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax.
|
|
4403
|
+
* Matches if the host part of the URL is an IP address and is contained in any of the CIDR blocks specified in the array.
|
|
4404
|
+
* @since Chrome 123
|
|
4417
4405
|
*/
|
|
4406
|
+
cidrBlocks?: string[] | undefined;
|
|
4407
|
+
/** Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
|
4408
|
+
schemes?: string[] | undefined;
|
|
4409
|
+
/** Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
|
4418
4410
|
urlMatches?: string | undefined;
|
|
4419
|
-
/**
|
|
4411
|
+
/** Matches if the path segment of the URL contains a specified string. */
|
|
4420
4412
|
pathContains?: string | undefined;
|
|
4421
|
-
/**
|
|
4413
|
+
/** Matches if the host name of the URL ends with a specified string. */
|
|
4422
4414
|
hostSuffix?: string | undefined;
|
|
4423
|
-
/**
|
|
4415
|
+
/** Matches if the host name of the URL starts with a specified string. */
|
|
4424
4416
|
hostPrefix?: string | undefined;
|
|
4425
|
-
/**
|
|
4417
|
+
/** Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */
|
|
4426
4418
|
hostContains?: string | undefined;
|
|
4427
|
-
/**
|
|
4419
|
+
/** Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
4428
4420
|
urlContains?: string | undefined;
|
|
4429
|
-
/**
|
|
4421
|
+
/** Matches if the query segment of the URL ends with a specified string. */
|
|
4430
4422
|
querySuffix?: string | undefined;
|
|
4431
|
-
/**
|
|
4423
|
+
/** Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
4432
4424
|
urlPrefix?: string | undefined;
|
|
4433
|
-
/**
|
|
4425
|
+
/** Matches if the host name of the URL is equal to a specified string. */
|
|
4434
4426
|
hostEquals?: string | undefined;
|
|
4435
|
-
/**
|
|
4427
|
+
/** Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
4436
4428
|
urlEquals?: string | undefined;
|
|
4437
|
-
/**
|
|
4429
|
+
/** Matches if the query segment of the URL contains a specified string. */
|
|
4438
4430
|
queryContains?: string | undefined;
|
|
4439
|
-
/**
|
|
4431
|
+
/** Matches if the path segment of the URL starts with a specified string. */
|
|
4440
4432
|
pathPrefix?: string | undefined;
|
|
4441
|
-
/**
|
|
4433
|
+
/** Matches if the path segment of the URL is equal to a specified string. */
|
|
4442
4434
|
pathEquals?: string | undefined;
|
|
4443
|
-
/**
|
|
4435
|
+
/** Matches if the path segment of the URL ends with a specified string. */
|
|
4444
4436
|
pathSuffix?: string | undefined;
|
|
4445
|
-
/**
|
|
4437
|
+
/** Matches if the query segment of the URL is equal to a specified string. */
|
|
4446
4438
|
queryEquals?: string | undefined;
|
|
4447
|
-
/**
|
|
4439
|
+
/** Matches if the query segment of the URL starts with a specified string. */
|
|
4448
4440
|
queryPrefix?: string | undefined;
|
|
4449
|
-
/**
|
|
4441
|
+
/** Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
|
4450
4442
|
urlSuffix?: string | undefined;
|
|
4451
|
-
/**
|
|
4443
|
+
/** Matches if the port of the URL is contained in any of the specified port lists. For example `[80, 443, [1000, 1200]]` matches all requests on port 80, 443 and in the range 1000-1200. */
|
|
4452
4444
|
ports?: Array<number | number[]> | undefined;
|
|
4453
|
-
/**
|
|
4454
|
-
* Optional.
|
|
4455
|
-
* @since Chrome 28
|
|
4456
|
-
* Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax.
|
|
4457
|
-
*/
|
|
4445
|
+
/** Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
|
4458
4446
|
originAndPathMatches?: string | undefined;
|
|
4459
4447
|
}
|
|
4460
4448
|
|
|
@@ -4464,43 +4452,33 @@ export namespace Browser {
|
|
|
4464
4452
|
* @param callback Called when an event occurs. The parameters of this function depend on the type of event.
|
|
4465
4453
|
*/
|
|
4466
4454
|
addListener(callback: T): void;
|
|
4455
|
+
|
|
4467
4456
|
/**
|
|
4468
4457
|
* Returns currently registered rules.
|
|
4469
|
-
* @param
|
|
4458
|
+
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned.
|
|
4470
4459
|
*/
|
|
4471
4460
|
getRules(
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
rules: Rule[],
|
|
4475
|
-
) => void,
|
|
4461
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
|
4462
|
+
callback: (rules: Rule[]) => void,
|
|
4476
4463
|
): void;
|
|
4477
|
-
/**
|
|
4478
|
-
* Returns currently registered rules.
|
|
4479
|
-
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned.
|
|
4480
|
-
* @param callback Called with registered rules.
|
|
4481
|
-
*/
|
|
4482
4464
|
getRules(
|
|
4483
4465
|
ruleIdentifiers: string[],
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
rules: Rule[],
|
|
4487
|
-
) => void,
|
|
4466
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
|
4467
|
+
callback: (rules: Rule[]) => void,
|
|
4488
4468
|
): void;
|
|
4469
|
+
|
|
4489
4470
|
/**
|
|
4490
4471
|
* @param callback Listener whose registration status shall be tested.
|
|
4472
|
+
* @returns True if _callback_ is registered to the event.
|
|
4491
4473
|
*/
|
|
4492
4474
|
hasListener(callback: T): boolean;
|
|
4475
|
+
|
|
4493
4476
|
/**
|
|
4494
4477
|
* Unregisters currently registered rules.
|
|
4495
4478
|
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
|
|
4496
|
-
* @param callback Called when rules were unregistered.
|
|
4497
4479
|
*/
|
|
4498
|
-
removeRules(ruleIdentifiers?: string[], callback?: () => void): void;
|
|
4499
|
-
|
|
4500
|
-
* Unregisters currently registered rules.
|
|
4501
|
-
* @param callback Called when rules were unregistered.
|
|
4502
|
-
*/
|
|
4503
|
-
removeRules(callback?: () => void): void;
|
|
4480
|
+
removeRules(ruleIdentifiers?: string[] | undefined, callback?: () => void): void;
|
|
4481
|
+
|
|
4504
4482
|
/**
|
|
4505
4483
|
* Registers rules to handle events.
|
|
4506
4484
|
* @param rules Rules to be registered. These do not replace previously registered rules.
|
|
@@ -4508,34 +4486,31 @@ export namespace Browser {
|
|
|
4508
4486
|
*/
|
|
4509
4487
|
addRules(
|
|
4510
4488
|
rules: Rule[],
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
rules: Rule[],
|
|
4514
|
-
) => void,
|
|
4489
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
|
4490
|
+
callback?: (rules: Rule[]) => void,
|
|
4515
4491
|
): void;
|
|
4492
|
+
|
|
4516
4493
|
/**
|
|
4517
4494
|
* Deregisters an event listener callback from an event.
|
|
4518
4495
|
* @param callback Listener that shall be unregistered.
|
|
4519
4496
|
*/
|
|
4520
4497
|
removeListener(callback: T): void;
|
|
4498
|
+
|
|
4499
|
+
/** @returns True if any event listeners are registered to the event. */
|
|
4521
4500
|
hasListeners(): boolean;
|
|
4522
4501
|
}
|
|
4523
4502
|
|
|
4524
4503
|
/** Description of a declarative rule for handling events. */
|
|
4525
4504
|
export interface Rule {
|
|
4526
|
-
/** Optional
|
|
4505
|
+
/** Optional priority of this rule. Defaults to 100. */
|
|
4527
4506
|
priority?: number | undefined;
|
|
4528
4507
|
/** List of conditions that can trigger the actions. */
|
|
4529
4508
|
conditions: any[];
|
|
4530
|
-
/** Optional
|
|
4509
|
+
/** Optional identifier that allows referencing this rule. */
|
|
4531
4510
|
id?: string | undefined;
|
|
4532
|
-
/** List of actions that are triggered if one of the
|
|
4511
|
+
/** List of actions that are triggered if one of the conditions is fulfilled. */
|
|
4533
4512
|
actions: any[];
|
|
4534
|
-
/**
|
|
4535
|
-
* Optional.
|
|
4536
|
-
* @since Chrome 28
|
|
4537
|
-
* Tags can be used to annotate rules and perform operations on sets of rules.
|
|
4538
|
-
*/
|
|
4513
|
+
/** Tags can be used to annotate rules and perform operations on sets of rules. */
|
|
4539
4514
|
tags?: string[] | undefined;
|
|
4540
4515
|
}
|
|
4541
4516
|
}
|
|
@@ -5793,72 +5768,67 @@ export namespace Browser {
|
|
|
5793
5768
|
destinationId: string;
|
|
5794
5769
|
/** The ID of the message. It must be unique for each message in scope of the applications. See the Cloud Messaging documentation for advice for picking and handling an ID. */
|
|
5795
5770
|
messageId: string;
|
|
5796
|
-
/**
|
|
5771
|
+
/** Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The default value of time-to-live is 86,400 seconds (1 day) and the maximum value is 2,419,200 seconds (28 days). */
|
|
5797
5772
|
timeToLive?: number | undefined;
|
|
5798
|
-
/** Message data to send to the server. Case-insensitive goog
|
|
5773
|
+
/** Message data to send to the server. Case-insensitive `goog.` and `google`, as well as case-sensitive `collapse_key` are disallowed as key prefixes. Sum of all key/value pairs should not exceed {@link gcm.MAX_MESSAGE_SIZE}. */
|
|
5799
5774
|
data: { [key: string]: unknown };
|
|
5800
5775
|
}
|
|
5801
5776
|
|
|
5802
|
-
export interface IncomingMessage {
|
|
5803
|
-
/** The message data. */
|
|
5804
|
-
data: { [key: string]: unknown };
|
|
5805
|
-
/**
|
|
5806
|
-
* Optional.
|
|
5807
|
-
* The sender who issued the message.
|
|
5808
|
-
* @since Chrome 41
|
|
5809
|
-
*/
|
|
5810
|
-
from?: string | undefined;
|
|
5811
|
-
/**
|
|
5812
|
-
* Optional.
|
|
5813
|
-
* The collapse key of a message. See Collapsible Messages section of Cloud Messaging documentation for details.
|
|
5814
|
-
*/
|
|
5815
|
-
collapseKey?: string | undefined;
|
|
5816
|
-
}
|
|
5817
|
-
|
|
5818
|
-
export interface GcmError {
|
|
5819
|
-
/** The error message describing the problem. */
|
|
5820
|
-
errorMessage: string;
|
|
5821
|
-
/** Optional. The ID of the message with this error, if error is related to a specific message. */
|
|
5822
|
-
messageId?: string | undefined;
|
|
5823
|
-
/** Additional details related to the error, when available. */
|
|
5824
|
-
detail: object;
|
|
5825
|
-
}
|
|
5826
|
-
|
|
5827
|
-
export interface MessageReceptionEvent extends Browser.events.Event<(message: IncomingMessage) => void> {}
|
|
5828
|
-
|
|
5829
|
-
export interface MessageDeletionEvent extends Browser.events.Event<() => void> {}
|
|
5830
|
-
|
|
5831
|
-
export interface GcmErrorEvent extends Browser.events.Event<(error: GcmError) => void> {}
|
|
5832
|
-
|
|
5833
5777
|
/** The maximum size (in bytes) of all key/value pairs in a message. */
|
|
5834
|
-
export
|
|
5778
|
+
export const MAX_MESSAGE_SIZE: 4096;
|
|
5835
5779
|
|
|
5836
5780
|
/**
|
|
5837
|
-
* Registers the application with
|
|
5781
|
+
* Registers the application with FCM. The registration ID will be returned by the `callback`. If `register` is called again with the same list of `senderIds`, the same registration ID will be returned.
|
|
5782
|
+
*
|
|
5783
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
|
5838
5784
|
* @param senderIds A list of server IDs that are allowed to send messages to the application. It should contain at least one and no more than 100 sender IDs.
|
|
5839
|
-
* @param callback Function called when registration completes. It should check runtime.lastError for error when registrationId is empty.
|
|
5840
|
-
* Parameter registrationId: A registration ID assigned to the application by the GCM.
|
|
5841
5785
|
*/
|
|
5786
|
+
export function register(senderIds: string[]): Promise<string>;
|
|
5842
5787
|
export function register(senderIds: string[], callback: (registrationId: string) => void): void;
|
|
5788
|
+
|
|
5843
5789
|
/**
|
|
5844
|
-
*
|
|
5845
|
-
*
|
|
5790
|
+
* Unregister the application from FCM.
|
|
5791
|
+
*
|
|
5792
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
|
5846
5793
|
*/
|
|
5794
|
+
export function unregister(): Promise<void>;
|
|
5847
5795
|
export function unregister(callback: () => void): void;
|
|
5796
|
+
|
|
5848
5797
|
/**
|
|
5849
5798
|
* Sends a message according to its contents.
|
|
5850
|
-
*
|
|
5851
|
-
*
|
|
5852
|
-
*
|
|
5799
|
+
*
|
|
5800
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
|
5801
|
+
* @param message A message to send to the other party via FCM.
|
|
5853
5802
|
*/
|
|
5803
|
+
export function send(message: OutgoingMessage): Promise<string>;
|
|
5854
5804
|
export function send(message: OutgoingMessage, callback: (messageId: string) => void): void;
|
|
5855
5805
|
|
|
5856
|
-
/** Fired when a message is received through
|
|
5857
|
-
export
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5806
|
+
/** Fired when a message is received through FCM. */
|
|
5807
|
+
export const onMessage: events.Event<
|
|
5808
|
+
(message: {
|
|
5809
|
+
/** The collapse key of a message. See the Non-collapsible and collapsible messages for details. */
|
|
5810
|
+
collapseKey?: string;
|
|
5811
|
+
/** The message data. */
|
|
5812
|
+
data: { [key: string]: unknown };
|
|
5813
|
+
/** The sender who issued the message. */
|
|
5814
|
+
from?: string;
|
|
5815
|
+
}) => void
|
|
5816
|
+
>;
|
|
5817
|
+
|
|
5818
|
+
/** Fired when a FCM server had to delete messages sent by an app server to the application. See Lifetime of a message for details on handling this event. */
|
|
5819
|
+
export const onMessagesDeleted: events.Event<() => void>;
|
|
5820
|
+
|
|
5821
|
+
/** Fired when it was not possible to send a message to the FCM server. */
|
|
5822
|
+
export const onSendError: events.Event<
|
|
5823
|
+
(error: {
|
|
5824
|
+
/** Additional details related to the error, when available. */
|
|
5825
|
+
details: { [key: string]: unknown };
|
|
5826
|
+
/** The error message describing the problem. */
|
|
5827
|
+
errorMessage: string;
|
|
5828
|
+
/** The ID of the message with this error, if error is related to a specific message. */
|
|
5829
|
+
messageId?: string;
|
|
5830
|
+
}) => void
|
|
5831
|
+
>;
|
|
5862
5832
|
}
|
|
5863
5833
|
|
|
5864
5834
|
////////////////////
|
|
@@ -8971,37 +8941,114 @@ export namespace Browser {
|
|
|
8971
8941
|
* Use the `Browser.runtime` API to retrieve the service worker, return details about the manifest, and listen for and respond to events in the extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.
|
|
8972
8942
|
*/
|
|
8973
8943
|
export namespace runtime {
|
|
8974
|
-
/** This
|
|
8975
|
-
export
|
|
8944
|
+
/** Populated with an error message if calling an API function fails; otherwise undefined. This is only defined within the scope of that function's callback. If an error is produced, but `runtime.lastError` is not accessed within the callback, a message is logged to the console listing the API function that produced the error. API functions that return promises do not set this property. */
|
|
8945
|
+
export const lastError: {
|
|
8946
|
+
/** Details about the error which occurred. */
|
|
8947
|
+
message?: string;
|
|
8948
|
+
} | undefined;
|
|
8949
|
+
|
|
8976
8950
|
/** The ID of the extension/app. */
|
|
8977
|
-
export
|
|
8978
|
-
|
|
8979
|
-
/**
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8951
|
+
export const id: string;
|
|
8952
|
+
|
|
8953
|
+
/**
|
|
8954
|
+
* The operating system Chrome is running on.
|
|
8955
|
+
* @since Chrome 44
|
|
8956
|
+
*/
|
|
8957
|
+
export enum PlatformOs {
|
|
8958
|
+
/** Specifies the MacOS operating system. */
|
|
8959
|
+
MAC = "mac",
|
|
8960
|
+
/** Specifies the Windows operating system. */
|
|
8961
|
+
WIN = "win",
|
|
8962
|
+
/** Specifies the Android operating system. */
|
|
8963
|
+
ANDROID = "android",
|
|
8964
|
+
/** Specifies the Chrome operating system. */
|
|
8965
|
+
CROS = "cros",
|
|
8966
|
+
/** Specifies the Linux operating system. */
|
|
8967
|
+
LINUX = "linux",
|
|
8968
|
+
/** Specifies the OpenBSD operating system. */
|
|
8969
|
+
OPENBSD = "openbsd",
|
|
8970
|
+
/** Specifies the Fuchsia operating system. */
|
|
8971
|
+
FUCHSIA = "fuchsia",
|
|
8972
|
+
}
|
|
8973
|
+
|
|
8974
|
+
/**
|
|
8975
|
+
* The machine's processor architecture.
|
|
8976
|
+
* @since Chrome 44
|
|
8977
|
+
*/
|
|
8978
|
+
export enum PlatformArch {
|
|
8979
|
+
/** Specifies the processer architecture as arm. */
|
|
8980
|
+
ARM = "arm",
|
|
8981
|
+
/** Specifies the processer architecture as arm64. */
|
|
8982
|
+
ARM64 = "arm64",
|
|
8983
|
+
/** Specifies the processer architecture as x86-32. */
|
|
8984
|
+
X86_32 = "x86-32",
|
|
8985
|
+
/** Specifies the processer architecture as x86-64. */
|
|
8986
|
+
X86_64 = "x86-64",
|
|
8987
|
+
/** Specifies the processer architecture as mips. */
|
|
8988
|
+
MIPS = "mips",
|
|
8989
|
+
/** Specifies the processer architecture as mips64. */
|
|
8990
|
+
MIPS64 = "mips64",
|
|
8991
|
+
}
|
|
8992
|
+
|
|
8993
|
+
/**
|
|
8994
|
+
* The native client architecture. This may be different from arch on some platforms.
|
|
8995
|
+
* @since Chrome 44
|
|
8996
|
+
*/
|
|
8997
|
+
export enum PlatformNaclArch {
|
|
8998
|
+
/** Specifies the native client architecture as arm. */
|
|
8999
|
+
ARM = "arm",
|
|
9000
|
+
/** Specifies the native client architecture as x86-32. */
|
|
9001
|
+
X86_32 = "x86-32",
|
|
9002
|
+
/** Specifies the native client architecture as x86-64. */
|
|
9003
|
+
X86_64 = "x86-64",
|
|
9004
|
+
/** Specifies the native client architecture as mips. */
|
|
9005
|
+
MIPS = "mips",
|
|
9006
|
+
/** Specifies the native client architecture as mips64. */
|
|
9007
|
+
MIPS64 = "mips64",
|
|
9008
|
+
}
|
|
9009
|
+
|
|
9010
|
+
/** @since Chrome 114 */
|
|
8986
9011
|
export enum ContextType {
|
|
9012
|
+
/** Specifies the context type as a tab */
|
|
8987
9013
|
TAB = "TAB",
|
|
9014
|
+
/** Specifies the context type as an extension popup window */
|
|
8988
9015
|
POPUP = "POPUP",
|
|
9016
|
+
/** Specifies the context type as a service worker. */
|
|
8989
9017
|
BACKGROUND = "BACKGROUND",
|
|
9018
|
+
/** Specifies the context type as an offscreen document. */
|
|
8990
9019
|
OFFSCREEN_DOCUMENT = "OFFSCREEN_DOCUMENT",
|
|
9020
|
+
/** Specifies the context type as a side panel. */
|
|
8991
9021
|
SIDE_PANEL = "SIDE_PANEL",
|
|
9022
|
+
/** Specifies the context type as developer tools. */
|
|
8992
9023
|
DEVELOPER_TOOLS = "DEVELOPER_TOOLS",
|
|
8993
9024
|
}
|
|
8994
|
-
|
|
9025
|
+
|
|
9026
|
+
/**
|
|
9027
|
+
* The reason that this event is being dispatched.
|
|
9028
|
+
* @since Chrome 44
|
|
9029
|
+
*/
|
|
8995
9030
|
export enum OnInstalledReason {
|
|
9031
|
+
/** Specifies the event reason as an installation. */
|
|
8996
9032
|
INSTALL = "install",
|
|
9033
|
+
/** Specifies the event reason as an extension update. */
|
|
8997
9034
|
UPDATE = "update",
|
|
9035
|
+
/** Specifies the event reason as a Chrome update. */
|
|
8998
9036
|
CHROME_UPDATE = "chrome_update",
|
|
9037
|
+
/** Specifies the event reason as an update to a shared module. */
|
|
8999
9038
|
SHARED_MODULE_UPDATE = "shared_module_update",
|
|
9000
9039
|
}
|
|
9001
9040
|
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9041
|
+
/**
|
|
9042
|
+
* The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.
|
|
9043
|
+
* @since Chrome 44
|
|
9044
|
+
*/
|
|
9045
|
+
export enum OnRestartRequiredReason {
|
|
9046
|
+
/** Specifies the event reason as an update to the app. */
|
|
9047
|
+
APP_UPDATE = "app_update",
|
|
9048
|
+
/** Specifies the event reason as an update to the operating system. */
|
|
9049
|
+
OS_UPDATE = "os_update",
|
|
9050
|
+
/** Specifies the event reason as a periodic restart of the app. */
|
|
9051
|
+
PERIODIC = "periodic",
|
|
9005
9052
|
}
|
|
9006
9053
|
|
|
9007
9054
|
/**
|
|
@@ -9010,7 +9057,7 @@ export namespace Browser {
|
|
|
9010
9057
|
*/
|
|
9011
9058
|
export interface ContextFilter {
|
|
9012
9059
|
contextIds?: string[] | undefined;
|
|
9013
|
-
contextTypes?: ContextType[] | undefined;
|
|
9060
|
+
contextTypes?: `${ContextType}`[] | undefined;
|
|
9014
9061
|
documentIds?: string[] | undefined;
|
|
9015
9062
|
documentOrigins?: string[] | undefined;
|
|
9016
9063
|
documentUrls?: string[] | undefined;
|
|
@@ -9021,26 +9068,19 @@ export namespace Browser {
|
|
|
9021
9068
|
}
|
|
9022
9069
|
|
|
9023
9070
|
export interface ConnectInfo {
|
|
9071
|
+
/** Will be passed into onConnect for processes that are listening for the connection event. */
|
|
9024
9072
|
name?: string | undefined;
|
|
9073
|
+
/** Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event. */
|
|
9025
9074
|
includeTlsChannelId?: boolean | undefined;
|
|
9026
9075
|
}
|
|
9027
9076
|
|
|
9028
9077
|
export interface InstalledDetails {
|
|
9029
|
-
/**
|
|
9030
|
-
* The reason that this event is being dispatched.
|
|
9031
|
-
*/
|
|
9078
|
+
/** The reason that this event is being dispatched. */
|
|
9032
9079
|
reason: `${OnInstalledReason}`;
|
|
9033
|
-
/**
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
previousVersion?: string | undefined;
|
|
9038
|
-
/**
|
|
9039
|
-
* Optional.
|
|
9040
|
-
* Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'.
|
|
9041
|
-
* @since Chrome 29
|
|
9042
|
-
*/
|
|
9043
|
-
id?: string | undefined;
|
|
9080
|
+
/** Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'. */
|
|
9081
|
+
previousVersion?: string;
|
|
9082
|
+
/** Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'. */
|
|
9083
|
+
id?: string;
|
|
9044
9084
|
}
|
|
9045
9085
|
|
|
9046
9086
|
/**
|
|
@@ -9051,29 +9091,20 @@ export namespace Browser {
|
|
|
9051
9091
|
/** A unique identifier for this context */
|
|
9052
9092
|
contextId: string;
|
|
9053
9093
|
/** The type of context this corresponds to. */
|
|
9054
|
-
contextType: ContextType
|
|
9055
|
-
/**
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
* The origin of the document associated with this context, or undefined if the context is not hosted in a document.
|
|
9063
|
-
*/
|
|
9064
|
-
documentOrigin?: string | undefined;
|
|
9065
|
-
/**
|
|
9066
|
-
* Optional.
|
|
9067
|
-
* The URL of the document associated with this context, or undefined if the context is not hosted in a document.
|
|
9068
|
-
*/
|
|
9069
|
-
documentUrl?: string | undefined;
|
|
9070
|
-
/** The ID of the frame for this context, or -1 if this context is not hosted in a frame. */
|
|
9094
|
+
contextType: `${ContextType}`;
|
|
9095
|
+
/** A UUID for the document associated with this context, or undefined if this context is hosted not in a document.*/
|
|
9096
|
+
documentId?: string;
|
|
9097
|
+
/** The origin of the document associated with this context, or undefined if the context is not hosted in a document. */
|
|
9098
|
+
documentOrigin?: string;
|
|
9099
|
+
/** The URL of the document associated with this context, or undefined if the context is not hosted in a document. */
|
|
9100
|
+
documentUrl?: string;
|
|
9101
|
+
/** The ID of the frame for this context, or `-1` if this context is not hosted in a frame. */
|
|
9071
9102
|
frameId: number;
|
|
9072
9103
|
/** Whether the context is associated with an incognito profile. */
|
|
9073
9104
|
incognito: boolean;
|
|
9074
|
-
/** The ID of the tab for this context, or
|
|
9105
|
+
/** The ID of the tab for this context, or `-1` if this context is not hosted in a tab. */
|
|
9075
9106
|
tabId: number;
|
|
9076
|
-
/** The ID of the window for this context, or
|
|
9107
|
+
/** The ID of the window for this context, or `-1` if this context is not hosted in a window. */
|
|
9077
9108
|
windowId: number;
|
|
9078
9109
|
}
|
|
9079
9110
|
|
|
@@ -9082,132 +9113,91 @@ export namespace Browser {
|
|
|
9082
9113
|
includeTlsChannelId?: boolean | undefined;
|
|
9083
9114
|
}
|
|
9084
9115
|
|
|
9085
|
-
/**
|
|
9086
|
-
* An object containing information about the script context that sent a message or request.
|
|
9087
|
-
* @since Chrome 26
|
|
9088
|
-
*/
|
|
9116
|
+
/** An object containing information about the script context that sent a message or request */
|
|
9089
9117
|
export interface MessageSender {
|
|
9090
|
-
/** The ID of the extension
|
|
9091
|
-
id?: string
|
|
9092
|
-
/** The tabs.Tab which opened the connection, if any. This property will only be present when the connection was opened from a tab (including content scripts), and only if the receiver is an extension, not an app. */
|
|
9093
|
-
tab?: Browser.tabs.Tab
|
|
9094
|
-
/** The name of the native application that opened the connection, if any.
|
|
9095
|
-
* @since Chrome 74
|
|
9096
|
-
*/
|
|
9097
|
-
nativeApplication?: string | undefined;
|
|
9098
|
-
/**
|
|
9099
|
-
* The frame that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when tab is set.
|
|
9100
|
-
* @since Chrome 41
|
|
9101
|
-
*/
|
|
9102
|
-
frameId?: number | undefined;
|
|
9103
|
-
/**
|
|
9104
|
-
* The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it.
|
|
9105
|
-
* @since Chrome 28
|
|
9106
|
-
*/
|
|
9107
|
-
url?: string | undefined;
|
|
9118
|
+
/** The ID of the extension that opened the connection, if any. */
|
|
9119
|
+
id?: string;
|
|
9120
|
+
/** The {@link tabs.Tab} which opened the connection, if any. This property will **only** be present when the connection was opened from a tab (including content scripts), and **only** if the receiver is an extension, not an app. */
|
|
9121
|
+
tab?: Browser.tabs.Tab;
|
|
9108
9122
|
/**
|
|
9109
|
-
* The
|
|
9110
|
-
* @since Chrome
|
|
9123
|
+
* The name of the native application that opened the connection, if any.
|
|
9124
|
+
* @since Chrome 74
|
|
9111
9125
|
*/
|
|
9112
|
-
|
|
9126
|
+
nativeApplication?: string;
|
|
9127
|
+
/** The frame that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when tab is set. */
|
|
9128
|
+
frameId?: number;
|
|
9129
|
+
/** The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it. */
|
|
9130
|
+
url?: string;
|
|
9131
|
+
/** The TLS channel ID of the page or frame that opened the connection, if requested by the extension, and if available */
|
|
9132
|
+
tlsChannelId?: string;
|
|
9113
9133
|
/**
|
|
9114
9134
|
* The origin of the page or frame that opened the connection. It can vary from the url property (e.g., about:blank) or can be opaque (e.g., sandboxed iframes). This is useful for identifying if the origin can be trusted if we can't immediately tell from the URL.
|
|
9115
9135
|
* @since Chrome 80
|
|
9116
9136
|
*/
|
|
9117
|
-
origin?: string
|
|
9137
|
+
origin?: string;
|
|
9118
9138
|
/**
|
|
9119
9139
|
* The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation.
|
|
9120
9140
|
* @since Chrome 106
|
|
9121
9141
|
*/
|
|
9122
|
-
documentLifecycle?: extensionTypes.DocumentLifecycle
|
|
9142
|
+
documentLifecycle?: extensionTypes.DocumentLifecycle;
|
|
9123
9143
|
/**
|
|
9124
9144
|
* A UUID of the document that opened the connection.
|
|
9125
9145
|
* @since Chrome 106
|
|
9126
9146
|
*/
|
|
9127
|
-
documentId?: string
|
|
9147
|
+
documentId?: string;
|
|
9128
9148
|
}
|
|
9129
9149
|
|
|
9130
|
-
/**
|
|
9131
|
-
* An object containing information about the current platform.
|
|
9132
|
-
* @since Chrome 36
|
|
9133
|
-
*/
|
|
9150
|
+
/** An object containing information about the current platform. */
|
|
9134
9151
|
export interface PlatformInfo {
|
|
9135
|
-
/**
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
/**
|
|
9140
|
-
|
|
9141
|
-
*/
|
|
9142
|
-
arch: PlatformArch;
|
|
9143
|
-
/**
|
|
9144
|
-
* The native client architecture. This may be different from arch on some platforms.
|
|
9145
|
-
*/
|
|
9146
|
-
nacl_arch: PlatformNaclArch;
|
|
9152
|
+
/** The operating system Chrome is running on. */
|
|
9153
|
+
os: `${PlatformOs}`;
|
|
9154
|
+
/** The machine's processor architecture. */
|
|
9155
|
+
arch: `${PlatformArch}`;
|
|
9156
|
+
/** The native client architecture. This may be different from arch on some platforms. */
|
|
9157
|
+
nacl_arch: `${PlatformNaclArch}`;
|
|
9147
9158
|
}
|
|
9148
9159
|
|
|
9149
|
-
/**
|
|
9150
|
-
* An object which allows two way communication with other pages.
|
|
9151
|
-
* @since Chrome 26
|
|
9152
|
-
*/
|
|
9160
|
+
/** An object which allows two way communication with other pages. */
|
|
9153
9161
|
export interface Port {
|
|
9162
|
+
/** Send a message to the other end of the port. If the port is disconnected, an error is thrown. */
|
|
9154
9163
|
postMessage: (message: any) => void;
|
|
9164
|
+
/** Immediately disconnect the port. Calling `disconnect()` on an already-disconnected port has no effect. When a port is disconnected, no new events will be dispatched to this port. */
|
|
9155
9165
|
disconnect: () => void;
|
|
9156
|
-
/**
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
/** An object which allows the addition and removal of listeners for a Chrome event. */
|
|
9164
|
-
onMessage: PortMessageEvent;
|
|
9166
|
+
/** This property will **only** be present on ports passed to {@link runtime.onConnect onConnect} / {@link runtime.onConnectExternal onConnectExternal} / {@link runtime.onConnectExternal onConnectNative} listeners. */
|
|
9167
|
+
sender?: MessageSender;
|
|
9168
|
+
/** Fired when the port is disconnected from the other end(s). {@link runtime.lastError} may be set if the port was disconnected by an error. If the port is closed via {@link Port.disconnect disconnect}, then this event is _only_ fired on the other end. This event is fired at most once (see also Port lifetime). */
|
|
9169
|
+
onDisconnect: events.Event<(port: Port) => void>;
|
|
9170
|
+
/** This event is fired when {@link Port.postMessage postMessage} is called by the other end of the port. */
|
|
9171
|
+
onMessage: events.Event<(message: any, port: Port) => void>;
|
|
9172
|
+
/** The name of the port, as specified in the call to {@link runtime.connect}. */
|
|
9165
9173
|
name: string;
|
|
9166
9174
|
}
|
|
9167
9175
|
|
|
9168
|
-
export interface UpdateAvailableDetails {
|
|
9169
|
-
/** The version number of the available update. */
|
|
9170
|
-
version: string;
|
|
9171
|
-
}
|
|
9172
|
-
|
|
9173
9176
|
export interface UpdateCheckDetails {
|
|
9174
9177
|
/** The version of the available update. */
|
|
9175
9178
|
version: string;
|
|
9176
9179
|
}
|
|
9177
9180
|
|
|
9178
|
-
/**
|
|
9179
|
-
|
|
9181
|
+
/**
|
|
9182
|
+
* Result of the update check.
|
|
9183
|
+
* @since Chrome 44
|
|
9184
|
+
*/
|
|
9185
|
+
export enum RequestUpdateCheckStatus {
|
|
9186
|
+
/** Specifies that the status check has been throttled. This can occur after repeated checks within a short amount of time. */
|
|
9187
|
+
THROTTLED = "throttled",
|
|
9188
|
+
/** Specifies that there are no available updates to install. */
|
|
9189
|
+
NO_UPDATE = "no_update",
|
|
9190
|
+
/** Specifies that there is an available update to install. */
|
|
9191
|
+
UPDATE_AVAILABLE = "update_available",
|
|
9192
|
+
}
|
|
9180
9193
|
|
|
9181
|
-
/** Result of the update check. */
|
|
9182
9194
|
export interface RequestUpdateCheckResult {
|
|
9183
|
-
/**
|
|
9184
|
-
status: RequestUpdateCheckStatus
|
|
9185
|
-
/**
|
|
9186
|
-
version
|
|
9195
|
+
/** Result of the update check. */
|
|
9196
|
+
status: `${RequestUpdateCheckStatus}`;
|
|
9197
|
+
/** If an update is available, this contains the version of the available update. */
|
|
9198
|
+
version?: string;
|
|
9187
9199
|
}
|
|
9188
9200
|
|
|
9189
|
-
export interface PortDisconnectEvent extends Browser.events.Event<(port: Port) => void> {}
|
|
9190
|
-
|
|
9191
|
-
export interface PortMessageEvent extends Browser.events.Event<(message: any, port: Port) => void> {}
|
|
9192
|
-
|
|
9193
|
-
export interface ExtensionMessageEvent extends
|
|
9194
|
-
Browser.events.Event<
|
|
9195
|
-
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9196
|
-
>
|
|
9197
|
-
{}
|
|
9198
|
-
|
|
9199
|
-
export interface ExtensionConnectEvent extends Browser.events.Event<(port: Port) => void> {}
|
|
9200
|
-
|
|
9201
|
-
export interface RuntimeInstalledEvent extends Browser.events.Event<(details: InstalledDetails) => void> {}
|
|
9202
|
-
|
|
9203
|
-
export interface RuntimeEvent extends Browser.events.Event<() => void> {}
|
|
9204
|
-
|
|
9205
|
-
export interface RuntimeRestartRequiredEvent extends Browser.events.Event<(reason: string) => void> {}
|
|
9206
|
-
|
|
9207
|
-
export interface RuntimeUpdateAvailableEvent
|
|
9208
|
-
extends Browser.events.Event<(details: UpdateAvailableDetails) => void>
|
|
9209
|
-
{}
|
|
9210
|
-
|
|
9211
9201
|
export interface ManifestIcons {
|
|
9212
9202
|
[size: number]: string;
|
|
9213
9203
|
}
|
|
@@ -9583,282 +9573,225 @@ export namespace Browser {
|
|
|
9583
9573
|
export type Manifest = ManifestV2 | ManifestV3;
|
|
9584
9574
|
|
|
9585
9575
|
/**
|
|
9586
|
-
* Attempts to connect
|
|
9587
|
-
*
|
|
9576
|
+
* Attempts to connect listeners within an extension (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and web messaging. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via {@link tabs.connect}.
|
|
9577
|
+
*
|
|
9578
|
+
* @param extensionId The ID of the extension to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging.
|
|
9579
|
+
* @returns Port through which messages can be sent and received. The port's {@link Port onDisconnect} event is fired if the extension does not exist.
|
|
9588
9580
|
*/
|
|
9589
9581
|
export function connect(connectInfo?: ConnectInfo): Port;
|
|
9582
|
+
export function connect(extensionId: string | undefined, connectInfo?: ConnectInfo): Port;
|
|
9583
|
+
|
|
9590
9584
|
/**
|
|
9591
|
-
*
|
|
9592
|
-
* @since Chrome 26
|
|
9593
|
-
* @param extensionId Optional.
|
|
9594
|
-
* The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging.
|
|
9595
|
-
*/
|
|
9596
|
-
export function connect(extensionId: string, connectInfo?: ConnectInfo): Port;
|
|
9597
|
-
/**
|
|
9598
|
-
* Connects to a native application in the host machine.
|
|
9599
|
-
* @since Chrome 28
|
|
9585
|
+
* Connects to a native application in the host machine. This method requires the `"nativeMessaging"` permission. See Native Messaging for more information.
|
|
9600
9586
|
* @param application The name of the registered application to connect to.
|
|
9601
9587
|
*/
|
|
9602
9588
|
export function connectNative(application: string): Port;
|
|
9603
9589
|
/**
|
|
9604
9590
|
* Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.
|
|
9605
|
-
*
|
|
9591
|
+
*
|
|
9592
|
+
* Foreground only
|
|
9593
|
+
*
|
|
9594
|
+
* Can return its result via Promise since Chrome 99.
|
|
9595
|
+
* @deprecated since Chrome 133. Background pages do not exist in MV3 extensions.
|
|
9606
9596
|
*/
|
|
9607
|
-
export function getBackgroundPage(): Promise<Window>;
|
|
9608
|
-
/** Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set. */
|
|
9597
|
+
export function getBackgroundPage(): Promise<Window | undefined>;
|
|
9609
9598
|
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
|
|
9599
|
+
|
|
9610
9600
|
/**
|
|
9611
9601
|
* Fetches information about active contexts associated with this extension
|
|
9612
|
-
* @since Chrome 116 MV3.
|
|
9613
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
|
9614
9602
|
* @param filter A filter to find matching contexts. A context matches if it matches all specified fields in the filter. Any unspecified field in the filter matches all contexts.
|
|
9615
|
-
*/
|
|
9616
|
-
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
|
9617
|
-
/**
|
|
9618
|
-
* Fetches information about active contexts associated with this extension
|
|
9619
9603
|
* @since Chrome 116 MV3.
|
|
9620
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
|
9621
|
-
* @param filter A filter to find matching contexts. A context matches if it matches all specified fields in the filter. Any unspecified field in the filter matches all contexts.
|
|
9622
|
-
* @param callback Called with results
|
|
9623
9604
|
*/
|
|
9605
|
+
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
|
9624
9606
|
export function getContexts(filter: ContextFilter, callback: (contexts: ExtensionContext[]) => void): void;
|
|
9607
|
+
|
|
9625
9608
|
/**
|
|
9626
9609
|
* Returns details about the app or extension from the manifest. The object returned is a serialization of the full manifest file.
|
|
9627
9610
|
* @return The manifest details.
|
|
9628
9611
|
*/
|
|
9629
9612
|
export function getManifest(): Manifest;
|
|
9613
|
+
|
|
9630
9614
|
/**
|
|
9631
9615
|
* Returns a DirectoryEntry for the package directory.
|
|
9632
|
-
*
|
|
9616
|
+
*
|
|
9617
|
+
* Foreground only
|
|
9618
|
+
*
|
|
9619
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 122.
|
|
9633
9620
|
*/
|
|
9621
|
+
export function getPackageDirectoryEntry(): Promise<DirectoryEntry>;
|
|
9634
9622
|
export function getPackageDirectoryEntry(callback: (directoryEntry: DirectoryEntry) => void): void;
|
|
9623
|
+
|
|
9635
9624
|
/**
|
|
9636
9625
|
* Returns information about the current platform.
|
|
9637
|
-
*
|
|
9638
|
-
*
|
|
9639
|
-
*/
|
|
9640
|
-
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
|
9641
|
-
/**
|
|
9642
|
-
* Returns information about the current platform.
|
|
9643
|
-
* @since Chrome 29
|
|
9644
|
-
* @return The `getPlatformInfo` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
9626
|
+
*
|
|
9627
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
9645
9628
|
*/
|
|
9646
9629
|
export function getPlatformInfo(): Promise<PlatformInfo>;
|
|
9630
|
+
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
|
9631
|
+
|
|
9647
9632
|
/**
|
|
9648
9633
|
* Converts a relative path within an app/extension install directory to a fully-qualified URL.
|
|
9649
9634
|
* @param path A path to a resource within an app/extension expressed relative to its install directory.
|
|
9635
|
+
* @returns The fully-qualified URL to the resource.
|
|
9650
9636
|
*/
|
|
9651
9637
|
export function getURL(path: string): string;
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
* @since Chrome 25
|
|
9655
|
-
*/
|
|
9638
|
+
|
|
9639
|
+
/** Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use {@link Browser.runtime.restart()} method. */
|
|
9656
9640
|
export function reload(): void;
|
|
9641
|
+
|
|
9657
9642
|
/**
|
|
9658
|
-
* Requests an update check for this app/extension.
|
|
9659
|
-
*
|
|
9660
|
-
*
|
|
9643
|
+
* Requests an immediate update check be done for this app/extension.
|
|
9644
|
+
*
|
|
9645
|
+
* **Important**: Most extensions/apps should **not** use this method, since Chrome already does automatic checks every few hours, and you can listen for the {@link runtime.onUpdateAvailable} event without needing to call requestUpdateCheck.
|
|
9646
|
+
*
|
|
9647
|
+
* This method is only appropriate to call in very limited circumstances, such as if your extension talks to a backend service, and the backend service has determined that the client extension version is very far out of date and you'd like to prompt a user to update. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources.
|
|
9648
|
+
*
|
|
9649
|
+
* Note: When called with a callback, instead of returning an object this function will return the two properties as separate arguments passed to the callback.
|
|
9650
|
+
*
|
|
9651
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 109.
|
|
9661
9652
|
*/
|
|
9662
9653
|
export function requestUpdateCheck(): Promise<RequestUpdateCheckResult>;
|
|
9663
|
-
/**
|
|
9664
|
-
* Requests an update check for this app/extension.
|
|
9665
|
-
* @since Chrome 25
|
|
9666
|
-
* @param callback
|
|
9667
|
-
* Parameter status: Result of the update check. One of: "throttled", "no_update", or "update_available"
|
|
9668
|
-
* Optional parameter details: If an update is available, this contains more information about the available update.
|
|
9669
|
-
*/
|
|
9670
9654
|
export function requestUpdateCheck(
|
|
9671
|
-
callback: (status: RequestUpdateCheckStatus
|
|
9655
|
+
callback: (status: `${RequestUpdateCheckStatus}`, details?: { version: string }) => void,
|
|
9672
9656
|
): void;
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
* @since Chrome 32
|
|
9676
|
-
*/
|
|
9657
|
+
|
|
9658
|
+
/** Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's no-op. */
|
|
9677
9659
|
export function restart(): void;
|
|
9660
|
+
|
|
9678
9661
|
/**
|
|
9679
|
-
* Restart the ChromeOS device when the app runs in kiosk mode after the
|
|
9680
|
-
*
|
|
9681
|
-
*
|
|
9682
|
-
* cancelled. It's a no-op in non-kiosk mode. It's only allowed to be
|
|
9683
|
-
* called repeatedly by the first extension to invoke this API.
|
|
9662
|
+
* Restart the ChromeOS device when the app runs in kiosk mode after the given seconds. If called again before the time ends, the reboot will be delayed. If called with a value of `-1`, the reboot will be cancelled. It's a no-op in non-kiosk mode. It's only allowed to be called repeatedly by the first extension to invoke this API.
|
|
9663
|
+
*
|
|
9664
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
9684
9665
|
* @since Chrome 53
|
|
9685
|
-
* @param seconds
|
|
9686
|
-
* @param callback
|
|
9687
9666
|
*/
|
|
9688
|
-
export function restartAfterDelay(seconds: number
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
* @since Chrome 26
|
|
9692
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
|
9693
|
-
*/
|
|
9694
|
-
export function sendMessage<M = any, R = any>(message: M, responseCallback: (response: R) => void): void;
|
|
9667
|
+
export function restartAfterDelay(seconds: number): Promise<void>;
|
|
9668
|
+
export function restartAfterDelay(seconds: number, callback: () => void): void;
|
|
9669
|
+
|
|
9695
9670
|
/**
|
|
9696
|
-
* Sends a single message to event listeners within your extension
|
|
9697
|
-
*
|
|
9698
|
-
*
|
|
9671
|
+
* Sends a single message to event listeners within your extension or a different extension/app. Similar to {@link runtime.connect} but only sends a single message, with an optional response. If sending to your extension, the {@link runtime.onMessage} event will be fired in every frame of your extension (except for the sender's frame), or {@link runtime.onMessageExternal}, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use {@link tabs.sendMessage}.
|
|
9672
|
+
*
|
|
9673
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
9674
|
+
* @param extensionId The ID of the extension to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
|
9675
|
+
* @param message The message to send. This message should be a JSON-ifiable object.
|
|
9699
9676
|
*/
|
|
9677
|
+
export function sendMessage<M = any, R = any>(message: M, options?: MessageOptions): Promise<R>;
|
|
9678
|
+
export function sendMessage<M = any, R = any>(message: M, callback: (response: R) => void): void;
|
|
9700
9679
|
export function sendMessage<M = any, R = any>(
|
|
9701
9680
|
message: M,
|
|
9702
|
-
options: MessageOptions,
|
|
9703
|
-
|
|
9681
|
+
options: MessageOptions | undefined,
|
|
9682
|
+
callback: (response: R) => void,
|
|
9704
9683
|
): void;
|
|
9705
|
-
/**
|
|
9706
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9707
|
-
* @since Chrome 26
|
|
9708
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
|
9709
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
|
9710
|
-
*/
|
|
9711
9684
|
export function sendMessage<M = any, R = any>(
|
|
9712
9685
|
extensionId: string | undefined | null,
|
|
9713
9686
|
message: M,
|
|
9714
|
-
|
|
9715
|
-
):
|
|
9716
|
-
|
|
9717
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9718
|
-
* @since Chrome 32
|
|
9719
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
|
9720
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
|
9721
|
-
*/
|
|
9722
|
-
export function sendMessage<Message = any, Response = any>(
|
|
9687
|
+
options?: MessageOptions,
|
|
9688
|
+
): Promise<R>;
|
|
9689
|
+
export function sendMessage<M = any, R = any>(
|
|
9723
9690
|
extensionId: string | undefined | null,
|
|
9724
|
-
message:
|
|
9725
|
-
|
|
9726
|
-
responseCallback: (response: Response) => void,
|
|
9691
|
+
message: M,
|
|
9692
|
+
callback: (response: R) => void,
|
|
9727
9693
|
): void;
|
|
9728
|
-
/**
|
|
9729
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9730
|
-
* @since Chrome 26
|
|
9731
|
-
*/
|
|
9732
|
-
export function sendMessage<M = any, R = any>(message: M): Promise<R>;
|
|
9733
|
-
/**
|
|
9734
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9735
|
-
* @since Chrome 32
|
|
9736
|
-
*/
|
|
9737
9694
|
export function sendMessage<M = any, R = any>(
|
|
9738
|
-
message: M,
|
|
9739
|
-
options: MessageOptions,
|
|
9740
|
-
): Promise<R>;
|
|
9741
|
-
/**
|
|
9742
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9743
|
-
* @since Chrome 26
|
|
9744
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
|
9745
|
-
*/
|
|
9746
|
-
export function sendMessage<M = any, R = any>(extensionId: string | undefined | null, message: M): Promise<R>;
|
|
9747
|
-
/**
|
|
9748
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
|
9749
|
-
* @since Chrome 32
|
|
9750
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
|
9751
|
-
*/
|
|
9752
|
-
export function sendMessage<Message = any, Response = any>(
|
|
9753
9695
|
extensionId: string | undefined | null,
|
|
9754
|
-
message:
|
|
9755
|
-
options: MessageOptions,
|
|
9756
|
-
|
|
9757
|
-
/**
|
|
9758
|
-
* Send a single message to a native application.
|
|
9759
|
-
* @since Chrome 28
|
|
9760
|
-
* @param application The of the native messaging host.
|
|
9761
|
-
* @param message The message that will be passed to the native messaging host.
|
|
9762
|
-
* Parameter response: The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
|
9763
|
-
*/
|
|
9764
|
-
export function sendNativeMessage(
|
|
9765
|
-
application: string,
|
|
9766
|
-
message: object,
|
|
9767
|
-
responseCallback: (response: any) => void,
|
|
9696
|
+
message: M,
|
|
9697
|
+
options: MessageOptions | undefined,
|
|
9698
|
+
callback: (response: R) => void,
|
|
9768
9699
|
): void;
|
|
9700
|
+
|
|
9769
9701
|
/**
|
|
9770
|
-
* Send a single message to a native application.
|
|
9771
|
-
*
|
|
9772
|
-
*
|
|
9702
|
+
* Send a single message to a native application. This method requires the `"nativeMessaging"` permission
|
|
9703
|
+
*
|
|
9704
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
9705
|
+
* @param application The name of the native messaging host.
|
|
9773
9706
|
* @param message The message that will be passed to the native messaging host.
|
|
9774
9707
|
*/
|
|
9708
|
+
export function sendNativeMessage(application: string, message: object): Promise<any>;
|
|
9775
9709
|
export function sendNativeMessage(
|
|
9776
9710
|
application: string,
|
|
9777
9711
|
message: object,
|
|
9778
|
-
|
|
9712
|
+
callback: (response: any) => void,
|
|
9713
|
+
): void;
|
|
9714
|
+
|
|
9779
9715
|
/**
|
|
9780
|
-
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum
|
|
9781
|
-
*
|
|
9782
|
-
*
|
|
9783
|
-
* URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation.
|
|
9784
|
-
* @param callback Called when the uninstall URL is set. If the given URL is invalid, runtime.lastError will be set.
|
|
9716
|
+
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 1023 characters.
|
|
9717
|
+
*
|
|
9718
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
9719
|
+
* @param url URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation.
|
|
9785
9720
|
*/
|
|
9786
|
-
export function setUninstallURL(url: string
|
|
9721
|
+
export function setUninstallURL(url: string): Promise<void>;
|
|
9722
|
+
export function setUninstallURL(url: string, callback: () => void): void;
|
|
9723
|
+
|
|
9787
9724
|
/**
|
|
9788
9725
|
* Open your Extension's options page, if possible.
|
|
9726
|
+
*
|
|
9789
9727
|
* The precise behavior may depend on your manifest's options_ui or options_page key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload.
|
|
9790
|
-
*
|
|
9791
|
-
* @
|
|
9728
|
+
*
|
|
9729
|
+
* If your Extension does not declare an options page, or Chrome failed to create one for some other reason, the callback will set {@link runtime.lastError lastError} .
|
|
9730
|
+
*
|
|
9731
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99
|
|
9792
9732
|
*/
|
|
9793
9733
|
export function openOptionsPage(): Promise<void>;
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
export
|
|
9734
|
+
export function openOptionsPage(callback: () => void): void;
|
|
9735
|
+
|
|
9736
|
+
/** Fired when a connection is made from either an extension process or a content script (by {@link runtime.connect}). */
|
|
9737
|
+
export const onConnect: events.Event<(port: Port) => void>;
|
|
9738
|
+
|
|
9739
|
+
/** Fired when a connection is made from another extension (by {@link runtime.connect}), or from an externally connectable web site. */
|
|
9740
|
+
export const onConnectExternal: events.Event<(port: Port) => void>;
|
|
9801
9741
|
|
|
9802
9742
|
/**
|
|
9803
|
-
* Fired when a connection is made from
|
|
9804
|
-
* @since Chrome
|
|
9805
|
-
*/
|
|
9806
|
-
export var onConnect: ExtensionConnectEvent;
|
|
9807
|
-
/**
|
|
9808
|
-
* Fired when a connection is made from another extension.
|
|
9809
|
-
* @since Chrome 26
|
|
9743
|
+
* Fired when a connection is made from a native application. This event requires the `"nativeMessaging"` permission. It is only supported on Chrome OS.
|
|
9744
|
+
* @since Chrome 76
|
|
9810
9745
|
*/
|
|
9811
|
-
export
|
|
9746
|
+
export const onConnectNative: events.Event<(port: Port) => void>;
|
|
9747
|
+
|
|
9812
9748
|
/** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */
|
|
9813
|
-
export
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
export var onStartup: RuntimeEvent;
|
|
9749
|
+
export const onSuspend: events.Event<() => void>;
|
|
9750
|
+
|
|
9751
|
+
/** Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. */
|
|
9752
|
+
export const onStartup: events.Event<() => void>;
|
|
9753
|
+
|
|
9819
9754
|
/** Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. */
|
|
9820
|
-
export
|
|
9755
|
+
export const onInstalled: events.Event<(details: InstalledDetails) => void>;
|
|
9756
|
+
|
|
9821
9757
|
/** Sent after onSuspend to indicate that the app won't be unloaded after all. */
|
|
9822
|
-
export
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
* @since Chrome 25
|
|
9841
|
-
*/
|
|
9842
|
-
export var onUpdateAvailable: RuntimeUpdateAvailableEvent;
|
|
9758
|
+
export const onSuspendCanceled: events.Event<() => void>;
|
|
9759
|
+
|
|
9760
|
+
/** Fired when a message is sent from either an extension process (by {@link runtime.sendMessage}) or a content script (by {@link tabs.sendMessage}). */
|
|
9761
|
+
export const onMessage: events.Event<
|
|
9762
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9763
|
+
>;
|
|
9764
|
+
|
|
9765
|
+
/** Fired when a message is sent from another extension (by {@link runtime.sendMessage}). Cannot be used in a content script. */
|
|
9766
|
+
export const onMessageExternal: events.Event<
|
|
9767
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9768
|
+
>;
|
|
9769
|
+
|
|
9770
|
+
/** Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. */
|
|
9771
|
+
export const onRestartRequired: events.Event<(reason: `${OnRestartRequiredReason}`) => void>;
|
|
9772
|
+
|
|
9773
|
+
/** Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call Browser.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call Browser.runtime.reload() manually in response to this event the update will not get installed until the next time Chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if Browser.runtime.reload() is called in response to this event. */
|
|
9774
|
+
export const onUpdateAvailable: events.Event<(details: { version: string }) => void>;
|
|
9775
|
+
|
|
9843
9776
|
/**
|
|
9844
|
-
* @deprecated since Chrome 33. Please use Browser.runtime.onRestartRequired.
|
|
9845
9777
|
* Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required.
|
|
9778
|
+
* @deprecated Please use {@link runtime.onRestartRequired}.
|
|
9846
9779
|
*/
|
|
9847
|
-
export
|
|
9780
|
+
export const onBrowserUpdateAvailable: events.Event<() => void>;
|
|
9848
9781
|
|
|
9849
9782
|
/**
|
|
9850
|
-
*
|
|
9851
|
-
* @
|
|
9852
|
-
* Listens for connections made from user scripts associated with this extension.
|
|
9783
|
+
* Fired when a connection is made from a user script from this extension.
|
|
9784
|
+
* @since chrome 115 MV3
|
|
9853
9785
|
*/
|
|
9854
|
-
export
|
|
9786
|
+
export const onUserScriptConnect: events.Event<(port: Port) => void>;
|
|
9855
9787
|
|
|
9856
9788
|
/**
|
|
9857
|
-
*
|
|
9858
|
-
* @
|
|
9859
|
-
* Listens for messages sent from user scripts associated with this extension.
|
|
9789
|
+
* Fired when a message is sent from a user script associated with the same extension.
|
|
9790
|
+
* @since chrome 115, MV3
|
|
9860
9791
|
*/
|
|
9861
|
-
export
|
|
9792
|
+
export const onUserScriptMessage: events.Event<
|
|
9793
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
|
9794
|
+
>;
|
|
9862
9795
|
}
|
|
9863
9796
|
|
|
9864
9797
|
////////////////////
|
|
@@ -9871,11 +9804,22 @@ export namespace Browser {
|
|
|
9871
9804
|
* @since Chrome 88, MV3
|
|
9872
9805
|
*/
|
|
9873
9806
|
export namespace scripting {
|
|
9874
|
-
|
|
9875
|
-
export
|
|
9807
|
+
/** The origin for a style change. See style origins for more info. */
|
|
9808
|
+
export enum StyleOrigin {
|
|
9809
|
+
AUTHOR = "AUTHOR",
|
|
9810
|
+
USER = "USER",
|
|
9811
|
+
}
|
|
9876
9812
|
|
|
9877
|
-
|
|
9878
|
-
|
|
9813
|
+
/**
|
|
9814
|
+
* The JavaScript world for a script to execute within.
|
|
9815
|
+
* @since Chrome 95
|
|
9816
|
+
*/
|
|
9817
|
+
export enum ExecutionWorld {
|
|
9818
|
+
/** Specifies the isolated world, which is the execution environment unique to this extension. */
|
|
9819
|
+
ISOLATED = "ISOLATED",
|
|
9820
|
+
/** Specifies the main world of the DOM, which is the execution environment shared with the host page's JavaScript. */
|
|
9821
|
+
MAIN = "MAIN",
|
|
9822
|
+
}
|
|
9879
9823
|
|
|
9880
9824
|
export interface InjectionResult<T extends any = any> {
|
|
9881
9825
|
/**
|
|
@@ -9888,100 +9832,162 @@ export namespace Browser {
|
|
|
9888
9832
|
* @since Chrome 90
|
|
9889
9833
|
*/
|
|
9890
9834
|
frameId: number;
|
|
9891
|
-
|
|
9892
|
-
result?: T
|
|
9835
|
+
/** The result of the script execution. */
|
|
9836
|
+
result?: T;
|
|
9893
9837
|
}
|
|
9894
9838
|
|
|
9895
|
-
export
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9839
|
+
export type InjectionTarget =
|
|
9840
|
+
& {
|
|
9841
|
+
/** The ID of the tab into which to inject. */
|
|
9842
|
+
tabId: number;
|
|
9843
|
+
}
|
|
9844
|
+
& (
|
|
9845
|
+
| {
|
|
9846
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
|
9847
|
+
allFrames?: boolean | undefined;
|
|
9848
|
+
/**
|
|
9849
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
|
9850
|
+
* @since Chrome 106
|
|
9851
|
+
*/
|
|
9852
|
+
documentIds?: never | undefined;
|
|
9853
|
+
/** The IDs of specific frames to inject into. */
|
|
9854
|
+
frameIds?: never | undefined;
|
|
9855
|
+
}
|
|
9856
|
+
| {
|
|
9857
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
|
9858
|
+
allFrames?: false | undefined;
|
|
9859
|
+
/**
|
|
9860
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
|
9861
|
+
* @since Chrome 106
|
|
9862
|
+
*/
|
|
9863
|
+
documentIds?: never | undefined;
|
|
9864
|
+
/** The IDs of specific frames to inject into. */
|
|
9865
|
+
frameIds: number[] | undefined;
|
|
9866
|
+
}
|
|
9867
|
+
| {
|
|
9868
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
|
9869
|
+
allFrames?: false | undefined;
|
|
9870
|
+
/**
|
|
9871
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
|
9872
|
+
* @since Chrome 106
|
|
9873
|
+
*/
|
|
9874
|
+
documentIds?: string[] | undefined;
|
|
9875
|
+
/** The IDs of specific frames to inject into. */
|
|
9876
|
+
frameIds?: never | undefined;
|
|
9877
|
+
}
|
|
9878
|
+
);
|
|
9908
9879
|
|
|
9909
|
-
export
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9880
|
+
export type CSSInjection =
|
|
9881
|
+
& {
|
|
9882
|
+
/** The style origin for the injection. Defaults to `'AUTHOR'`. */
|
|
9883
|
+
origin?: `${StyleOrigin}` | undefined;
|
|
9884
|
+
/** Details specifying the target into which to insert the CSS. */
|
|
9885
|
+
target: InjectionTarget;
|
|
9886
|
+
}
|
|
9887
|
+
& (
|
|
9888
|
+
| {
|
|
9889
|
+
/** A string containing the CSS to inject. Exactly one of `files` and `css` must be specified. */
|
|
9890
|
+
css: string;
|
|
9891
|
+
/** The path of the CSS files to inject, relative to the extension's root directory. Exactly one of `files` and `css` must be specified. */
|
|
9892
|
+
files?: never | undefined;
|
|
9893
|
+
}
|
|
9894
|
+
| {
|
|
9895
|
+
/** A string containing the CSS to inject. Exactly one of `files` and `css` must be specified. */
|
|
9896
|
+
css?: never | undefined;
|
|
9897
|
+
/** The path of the CSS files to inject, relative to the extension's root directory. Exactly one of `files` and `css` must be specified. */
|
|
9898
|
+
files: string[];
|
|
9899
|
+
}
|
|
9900
|
+
);
|
|
9919
9901
|
|
|
9920
9902
|
export type ScriptInjection<Args extends any[], Result> =
|
|
9921
9903
|
& {
|
|
9922
|
-
|
|
9904
|
+
/** Details specifying the target into which to inject the script. */
|
|
9923
9905
|
target: InjectionTarget;
|
|
9924
|
-
|
|
9925
|
-
world?: ExecutionWorld
|
|
9926
|
-
|
|
9906
|
+
/** The JavaScript "world" to run the script in. Defaults to `ISOLATED`. */
|
|
9907
|
+
world?: `${ExecutionWorld}`;
|
|
9908
|
+
/**
|
|
9909
|
+
* Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target.
|
|
9910
|
+
* @since Chrome 102
|
|
9911
|
+
*/
|
|
9927
9912
|
injectImmediately?: boolean;
|
|
9928
9913
|
}
|
|
9929
9914
|
& (
|
|
9930
9915
|
| {
|
|
9931
|
-
|
|
9916
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
|
9917
|
+
func?: never | undefined;
|
|
9918
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
|
9932
9919
|
files: string[];
|
|
9933
9920
|
}
|
|
9934
9921
|
| ({
|
|
9935
|
-
|
|
9922
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
|
9936
9923
|
func: () => Result;
|
|
9924
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
|
9925
|
+
files?: never | undefined;
|
|
9937
9926
|
} | {
|
|
9938
|
-
|
|
9939
|
-
func: (...args: Args) => Result;
|
|
9940
|
-
/* The arguments to carry into a provided function. This is only valid if the func parameter is specified. These arguments must be JSON-serializable. */
|
|
9927
|
+
/** The arguments to pass to the provided function. This is only valid if the `func` parameter is specified. These arguments must be JSON-serializable. */
|
|
9941
9928
|
args: Args;
|
|
9929
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
|
9930
|
+
func: (...args: Args) => Result;
|
|
9931
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
|
9932
|
+
files?: never | undefined;
|
|
9942
9933
|
})
|
|
9943
9934
|
);
|
|
9944
9935
|
|
|
9945
9936
|
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
|
9946
9937
|
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9938
|
+
/** @since Chrome 96 */
|
|
9939
|
+
type RegisteredContentScript =
|
|
9940
|
+
& {
|
|
9941
|
+
/** The id of the content script, specified in the API call. Must not start with a '_' as it's reserved as a prefix for generated script IDs. */
|
|
9942
|
+
id: string;
|
|
9943
|
+
/** If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
|
|
9944
|
+
allFrames?: boolean | undefined;
|
|
9945
|
+
/** Excludes pages that this content script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
|
|
9946
|
+
excludeMatches?: string[] | undefined;
|
|
9947
|
+
/**
|
|
9948
|
+
* Indicates whether the script can be injected into frames where the URL contains an unsupported scheme; specifically: about:, data:, blob:, or filesystem:. In these cases, the URL's origin is checked to determine if the script should be injected. If the origin is `null` (as is the case for data: URLs) then the used origin is either the frame that created the current frame or the frame that initiated the navigation to this frame. Note that this may not be the parent frame.
|
|
9949
|
+
* @since Chrome 119
|
|
9950
|
+
*/
|
|
9951
|
+
matchOriginAsFallback?: boolean | undefined;
|
|
9952
|
+
/** Specifies which pages this content script will be injected into. See Match Patterns for more details on the syntax of these strings. Must be specified for {@link registerContentScripts}. */
|
|
9953
|
+
matches?: string[] | undefined;
|
|
9954
|
+
/** Specifies if this content script will persist into future sessions. The default is true. */
|
|
9955
|
+
persistAcrossSessions?: boolean | undefined;
|
|
9956
|
+
/** Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle`. */
|
|
9957
|
+
runAt?: extensionTypes.RunAt | undefined;
|
|
9958
|
+
/** The JavaScript "world" to run the script in. Defaults to `ISOLATED`. */
|
|
9959
|
+
world?: `${ExecutionWorld}` | undefined;
|
|
9960
|
+
}
|
|
9961
|
+
& (
|
|
9962
|
+
| {
|
|
9963
|
+
/** The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array. */
|
|
9964
|
+
js: string[];
|
|
9965
|
+
/** The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page. */
|
|
9966
|
+
css?: string[] | undefined;
|
|
9967
|
+
}
|
|
9968
|
+
| {
|
|
9969
|
+
/** The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array. */
|
|
9970
|
+
js?: string[] | undefined;
|
|
9971
|
+
/** The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page. */
|
|
9972
|
+
css: string[];
|
|
9973
|
+
}
|
|
9974
|
+
);
|
|
9959
9975
|
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
origin?: StyleOrigin;
|
|
9965
|
-
target?: InjectionTarget;
|
|
9976
|
+
/** @since Chrome 96 */
|
|
9977
|
+
export interface ContentScriptFilter {
|
|
9978
|
+
/** If specified, {@link getRegisteredContentScripts} will only return scripts with an id specified in this list. */
|
|
9979
|
+
ids?: string[] | undefined;
|
|
9966
9980
|
}
|
|
9967
9981
|
|
|
9968
9982
|
/**
|
|
9969
|
-
* Injects a script into a target context.
|
|
9970
|
-
*
|
|
9971
|
-
*
|
|
9972
|
-
* @
|
|
9983
|
+
* Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
|
|
9984
|
+
*
|
|
9985
|
+
* Can return its result via Promise since Chrome 90.
|
|
9986
|
+
* @param injection The details of the script which to inject.
|
|
9973
9987
|
*/
|
|
9974
9988
|
export function executeScript<Args extends any[], Result>(
|
|
9975
9989
|
injection: ScriptInjection<Args, Result>,
|
|
9976
9990
|
): Promise<Array<InjectionResult<Awaited<Result>>>>;
|
|
9977
|
-
|
|
9978
|
-
/**
|
|
9979
|
-
* Injects a script into a target context. The script will be run at document_end.
|
|
9980
|
-
* @param injection
|
|
9981
|
-
* The details of the script which to inject.
|
|
9982
|
-
* @param callback
|
|
9983
|
-
* Invoked upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.
|
|
9984
|
-
*/
|
|
9985
9991
|
export function executeScript<Args extends any[], Result>(
|
|
9986
9992
|
injection: ScriptInjection<Args, Result>,
|
|
9987
9993
|
callback: (results: Array<InjectionResult<Awaited<Result>>>) => void,
|
|
@@ -9989,102 +9995,56 @@ export namespace Browser {
|
|
|
9989
9995
|
|
|
9990
9996
|
/**
|
|
9991
9997
|
* Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
|
|
9992
|
-
*
|
|
9993
|
-
*
|
|
9994
|
-
* @
|
|
9998
|
+
*
|
|
9999
|
+
* Can return its result via Promise since Chrome 90.
|
|
10000
|
+
* @param injection The details of the styles to insert.
|
|
9995
10001
|
*/
|
|
9996
10002
|
export function insertCSS(injection: CSSInjection): Promise<void>;
|
|
9997
|
-
|
|
9998
|
-
/**
|
|
9999
|
-
* Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
|
|
10000
|
-
* @param injection
|
|
10001
|
-
* The details of the styles to insert.
|
|
10002
|
-
* @param callback
|
|
10003
|
-
* Invoked upon completion of the injection.
|
|
10004
|
-
*/
|
|
10005
10003
|
export function insertCSS(injection: CSSInjection, callback: () => void): void;
|
|
10006
10004
|
|
|
10007
10005
|
/**
|
|
10008
10006
|
* Removes a CSS stylesheet that was previously inserted by this extension from a target context.
|
|
10009
|
-
* @param injection
|
|
10010
|
-
* The details of the styles to remove.
|
|
10011
|
-
* Note that the css, files, and origin properties must exactly match the stylesheet inserted through `insertCSS`.
|
|
10012
|
-
* Attempting to remove a non-existent stylesheet is a no-op.
|
|
10013
|
-
* @return This only returns a Promise when the callback parameter is not specified, and with MV3.
|
|
10007
|
+
* @param injection The details of the styles to remove. Note that the `css`, `files`, and `origin` properties must exactly match the stylesheet inserted through {@link insertCSS}. Attempting to remove a non-existent stylesheet is a no-op.
|
|
10014
10008
|
* @since Chrome 90
|
|
10015
10009
|
*/
|
|
10016
10010
|
export function removeCSS(injection: CSSInjection): Promise<void>;
|
|
10017
|
-
|
|
10018
|
-
/**
|
|
10019
|
-
* Removes a CSS stylesheet that was previously inserted by this extension from a target context.
|
|
10020
|
-
* @param injection
|
|
10021
|
-
* The details of the styles to remove.
|
|
10022
|
-
* Note that the css, files, and origin properties must exactly match the stylesheet inserted through `insertCSS`.
|
|
10023
|
-
* Attempting to remove a non-existent stylesheet is a no-op.
|
|
10024
|
-
* @param callback
|
|
10025
|
-
* Invoked upon completion of the removal.
|
|
10026
|
-
* @since Chrome 90
|
|
10027
|
-
*/
|
|
10028
10011
|
export function removeCSS(injection: CSSInjection, callback: () => void): void;
|
|
10029
10012
|
|
|
10030
10013
|
/**
|
|
10031
|
-
* Registers one or more content scripts
|
|
10032
|
-
* @param scripts
|
|
10014
|
+
* Registers one or more content scripts for this extension
|
|
10015
|
+
* @param scripts Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.
|
|
10016
|
+
* @since Chrome 96
|
|
10033
10017
|
*/
|
|
10034
10018
|
export function registerContentScripts(scripts: RegisteredContentScript[]): Promise<void>;
|
|
10035
|
-
|
|
10036
|
-
/**
|
|
10037
|
-
* Registers one or more content scripts.
|
|
10038
|
-
* @param scripts
|
|
10039
|
-
* @param callback
|
|
10040
|
-
*/
|
|
10041
10019
|
export function registerContentScripts(scripts: RegisteredContentScript[], callback: () => void): void;
|
|
10042
10020
|
|
|
10043
10021
|
/**
|
|
10044
|
-
*
|
|
10045
|
-
* @param filter
|
|
10046
|
-
* @
|
|
10022
|
+
* Unregisters content scripts for this extension.
|
|
10023
|
+
* @param filter If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered.
|
|
10024
|
+
* @since Chrome 96
|
|
10047
10025
|
*/
|
|
10048
10026
|
export function unregisterContentScripts(filter?: ContentScriptFilter): Promise<void>;
|
|
10027
|
+
export function unregisterContentScripts(callback: () => void): void;
|
|
10028
|
+
export function unregisterContentScripts(filter: ContentScriptFilter | undefined, callback: () => void): void;
|
|
10049
10029
|
|
|
10050
10030
|
/**
|
|
10051
|
-
*
|
|
10052
|
-
* @param filter
|
|
10053
|
-
* @
|
|
10054
|
-
*/
|
|
10055
|
-
export function unregisterContentScripts(callback: () => void): void;
|
|
10056
|
-
export function unregisterContentScripts(filter: ContentScriptFilter, callback: () => void): void;
|
|
10057
|
-
|
|
10058
|
-
/**
|
|
10059
|
-
* Returns all the content scripts registered with scripting.registerContentScripts()
|
|
10060
|
-
* or a subset of the registered scripts when using a filter.
|
|
10061
|
-
* @param filter
|
|
10031
|
+
* Returns all dynamically registered content scripts for this extension that match the given filter.
|
|
10032
|
+
* @param filter An object to filter the extension's dynamically registered scripts.
|
|
10033
|
+
* @since Chrome 96
|
|
10062
10034
|
*/
|
|
10063
10035
|
export function getRegisteredContentScripts(filter?: ContentScriptFilter): Promise<RegisteredContentScript[]>;
|
|
10064
|
-
|
|
10065
|
-
/**
|
|
10066
|
-
* Returns all the content scripts registered with scripting.registerContentScripts()
|
|
10067
|
-
* or a subset of the registered scripts when using a filter.
|
|
10068
|
-
* @param filter
|
|
10069
|
-
* @param callback
|
|
10070
|
-
*/
|
|
10071
10036
|
export function getRegisteredContentScripts(callback: (scripts: RegisteredContentScript[]) => void): void;
|
|
10072
10037
|
export function getRegisteredContentScripts(
|
|
10073
|
-
filter: ContentScriptFilter,
|
|
10038
|
+
filter: ContentScriptFilter | undefined,
|
|
10074
10039
|
callback: (scripts: RegisteredContentScript[]) => void,
|
|
10075
10040
|
): void;
|
|
10076
10041
|
|
|
10077
10042
|
/**
|
|
10078
|
-
* Updates one or more content scripts.
|
|
10079
|
-
* @param scripts
|
|
10043
|
+
* Updates one or more content scripts for this extension.
|
|
10044
|
+
* @param scripts Contains a list of scripts to be updated. A property is only updated for the existing script if it is specified in this object. If there are errors during script parsing/file validation, or if the IDs specified do not correspond to a fully registered script, then no scripts are updated.
|
|
10045
|
+
* @since Chrome 96
|
|
10080
10046
|
*/
|
|
10081
10047
|
export function updateContentScripts(scripts: RegisteredContentScript[]): Promise<void>;
|
|
10082
|
-
|
|
10083
|
-
/**
|
|
10084
|
-
* Updates one or more content scripts.
|
|
10085
|
-
* @param scripts
|
|
10086
|
-
* @param callback
|
|
10087
|
-
*/
|
|
10088
10048
|
export function updateContentScripts(scripts: RegisteredContentScript[], callback: () => void): void;
|
|
10089
10049
|
}
|
|
10090
10050
|
|
|
@@ -11240,67 +11200,54 @@ export namespace Browser {
|
|
|
11240
11200
|
*/
|
|
11241
11201
|
export namespace tabs {
|
|
11242
11202
|
/**
|
|
11243
|
-
*
|
|
11203
|
+
* The tab's muted state and the reason for the last state change.
|
|
11244
11204
|
* @since Chrome 46
|
|
11245
11205
|
*/
|
|
11246
11206
|
export interface MutedInfo {
|
|
11247
|
-
/** Whether the tab is prevented from playing sound
|
|
11207
|
+
/** Whether the tab is muted (prevented from playing sound). The tab may be muted even if it has not played or is not currently playing sound. Equivalent to whether the 'muted' audio indicator is showing. */
|
|
11248
11208
|
muted: boolean;
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
* "user": A user input action has set/overridden the muted state.
|
|
11253
|
-
* "capture": Tab capture started, forcing a muted state change.
|
|
11254
|
-
* "extension": An extension, identified by the extensionId field, set the muted state.
|
|
11255
|
-
*/
|
|
11256
|
-
reason?: string | undefined;
|
|
11257
|
-
/**
|
|
11258
|
-
* Optional.
|
|
11259
|
-
* The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed.
|
|
11260
|
-
*/
|
|
11209
|
+
/* The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed. */
|
|
11210
|
+
reason?: `${MutedInfoReason}` | undefined;
|
|
11211
|
+
/** The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed. */
|
|
11261
11212
|
extensionId?: string | undefined;
|
|
11262
11213
|
}
|
|
11263
11214
|
|
|
11215
|
+
/**
|
|
11216
|
+
* An event that caused a muted state change.
|
|
11217
|
+
* @since Chrome 46
|
|
11218
|
+
*/
|
|
11219
|
+
export enum MutedInfoReason {
|
|
11220
|
+
/** A user input action set the muted state. */
|
|
11221
|
+
USER = "user",
|
|
11222
|
+
/** Tab capture was started, forcing a muted state change. */
|
|
11223
|
+
CAPTURE = "capture",
|
|
11224
|
+
/** An extension set the muted state. */
|
|
11225
|
+
EXTENSION = "extension",
|
|
11226
|
+
}
|
|
11227
|
+
|
|
11264
11228
|
export interface Tab {
|
|
11265
|
-
/**
|
|
11266
|
-
|
|
11267
|
-
* Either loading or complete.
|
|
11268
|
-
*/
|
|
11269
|
-
status?: string | undefined;
|
|
11229
|
+
/** The tab's loading status. */
|
|
11230
|
+
status?: `${TabStatus}` | undefined;
|
|
11270
11231
|
/** The zero-based index of the tab within its window. */
|
|
11271
11232
|
index: number;
|
|
11272
|
-
/**
|
|
11273
|
-
* Optional.
|
|
11274
|
-
* The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists.
|
|
11275
|
-
* @since Chrome 18
|
|
11276
|
-
*/
|
|
11233
|
+
/** The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists. */
|
|
11277
11234
|
openerTabId?: number | undefined;
|
|
11278
|
-
/** The title of the tab. This property is only present if the extension has the `tabs` permission or has host permissions for the page. */
|
|
11235
|
+
/** The title of the tab. This property is only present if the extension has the `"tabs"` permission or has host permissions for the page. */
|
|
11279
11236
|
title?: string | undefined;
|
|
11280
|
-
/** The last committed URL of the main frame of the tab. This property is only present if the extension has the `tabs` permission or has host permissions for the page. May be an empty string if the tab has not yet committed. See also {@link Tab.pendingUrl}. */
|
|
11237
|
+
/** The last committed URL of the main frame of the tab. This property is only present if the extension has the `"tabs"` permission or has host permissions for the page. May be an empty string if the tab has not yet committed. See also {@link Tab.pendingUrl}. */
|
|
11281
11238
|
url?: string | undefined;
|
|
11282
11239
|
/**
|
|
11283
|
-
* The URL the tab is navigating to, before it has committed. This property is only present if the extension has the `tabs` permission or has host permissions for the page and there is a pending navigation.
|
|
11284
|
-
* This property is only present if the extension's manifest includes the "tabs" permission and there is a pending navigation.
|
|
11240
|
+
* The URL the tab is navigating to, before it has committed. This property is only present if the extension has the `"tabs"` permission or has host permissions for the page and there is a pending navigation.
|
|
11285
11241
|
* @since Chrome 79
|
|
11286
11242
|
*/
|
|
11287
11243
|
pendingUrl?: string | undefined;
|
|
11288
|
-
/**
|
|
11289
|
-
* Whether the tab is pinned.
|
|
11290
|
-
* @since Chrome 9
|
|
11291
|
-
*/
|
|
11244
|
+
/** Whether the tab is pinned. */
|
|
11292
11245
|
pinned: boolean;
|
|
11293
|
-
/**
|
|
11294
|
-
* Whether the tab is highlighted.
|
|
11295
|
-
* @since Chrome 16
|
|
11296
|
-
*/
|
|
11246
|
+
/** Whether the tab is highlighted. */
|
|
11297
11247
|
highlighted: boolean;
|
|
11298
|
-
/** The ID of the window the tab
|
|
11248
|
+
/** The ID of the window that contains the tab. */
|
|
11299
11249
|
windowId: number;
|
|
11300
|
-
/**
|
|
11301
|
-
* Whether the tab is active in its window. (Does not necessarily mean the window is focused.)
|
|
11302
|
-
* @since Chrome 16
|
|
11303
|
-
*/
|
|
11250
|
+
/** Whether the tab is active in its window. Does not necessarily mean the window is focused. */
|
|
11304
11251
|
active: boolean;
|
|
11305
11252
|
/** The URL of the tab's favicon. This property is only present if the extension has the `tabs` permission or has host permissions for the page. It may also be an empty string if the tab is loading. */
|
|
11306
11253
|
favIconUrl?: string | undefined;
|
|
@@ -11309,26 +11256,22 @@ export namespace Browser {
|
|
|
11309
11256
|
* @since Chrome 132
|
|
11310
11257
|
*/
|
|
11311
11258
|
frozen: boolean;
|
|
11312
|
-
/**
|
|
11313
|
-
* Optional.
|
|
11314
|
-
* The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the sessions API, in which case a session ID may be present. Tab ID can also be set to Browser.tabs.TAB_ID_NONE for apps and devtools windows.
|
|
11315
|
-
*/
|
|
11259
|
+
/** The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a tab may not be assigned an ID; for example, when querying foreign tabs using the {@link sessions} API, in which case a session ID may be present. Tab ID can also be set to `Browser.tabs.TAB_ID_NONE` for apps and devtools windows. */
|
|
11316
11260
|
id?: number | undefined;
|
|
11317
11261
|
/** Whether the tab is in an incognito window. */
|
|
11318
11262
|
incognito: boolean;
|
|
11319
11263
|
/**
|
|
11320
11264
|
* Whether the tab is selected.
|
|
11321
|
-
* @deprecated since Chrome 33. Please use
|
|
11265
|
+
* @deprecated since Chrome 33. Please use {@link Tab.highlighted}.
|
|
11322
11266
|
*/
|
|
11323
11267
|
selected: boolean;
|
|
11324
11268
|
/**
|
|
11325
|
-
*
|
|
11326
|
-
* Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing.
|
|
11269
|
+
* Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the 'speaker audio' indicator is showing.
|
|
11327
11270
|
* @since Chrome 45
|
|
11328
11271
|
*/
|
|
11329
11272
|
audible?: boolean | undefined;
|
|
11330
11273
|
/**
|
|
11331
|
-
* Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content
|
|
11274
|
+
* Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content is reloaded the next time it is activated.
|
|
11332
11275
|
* @since Chrome 54
|
|
11333
11276
|
*/
|
|
11334
11277
|
discarded: boolean;
|
|
@@ -11338,25 +11281,15 @@ export namespace Browser {
|
|
|
11338
11281
|
*/
|
|
11339
11282
|
autoDiscardable: boolean;
|
|
11340
11283
|
/**
|
|
11341
|
-
*
|
|
11342
|
-
* Current tab muted state and the reason for the last state change.
|
|
11284
|
+
* The tab's muted state and the reason for the last state change.
|
|
11343
11285
|
* @since Chrome 46
|
|
11344
11286
|
*/
|
|
11345
11287
|
mutedInfo?: MutedInfo | undefined;
|
|
11346
|
-
/**
|
|
11347
|
-
* Optional. The width of the tab in pixels.
|
|
11348
|
-
* @since Chrome 31
|
|
11349
|
-
*/
|
|
11288
|
+
/** The width of the tab in pixels. */
|
|
11350
11289
|
width?: number | undefined;
|
|
11351
|
-
/**
|
|
11352
|
-
* Optional. The height of the tab in pixels.
|
|
11353
|
-
* @since Chrome 31
|
|
11354
|
-
*/
|
|
11290
|
+
/** The height of the tab in pixels. */
|
|
11355
11291
|
height?: number | undefined;
|
|
11356
|
-
/**
|
|
11357
|
-
* Optional. The session ID used to uniquely identify a Tab obtained from the sessions API.
|
|
11358
|
-
* @since Chrome 31
|
|
11359
|
-
*/
|
|
11292
|
+
/** The session ID used to uniquely identify a tab obtained from the {@link sessions} API. */
|
|
11360
11293
|
sessionId?: string | undefined;
|
|
11361
11294
|
/**
|
|
11362
11295
|
* The ID of the group that the tab belongs to.
|
|
@@ -11370,203 +11303,201 @@ export namespace Browser {
|
|
|
11370
11303
|
lastAccessed?: number | undefined;
|
|
11371
11304
|
}
|
|
11372
11305
|
|
|
11373
|
-
/**
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11306
|
+
/** The tab's loading status. */
|
|
11307
|
+
export enum TabStatus {
|
|
11308
|
+
UNLOADED = "unloaded",
|
|
11309
|
+
LOADING = "loading",
|
|
11310
|
+
COMPLETE = "complete",
|
|
11311
|
+
}
|
|
11312
|
+
|
|
11313
|
+
/** The type of window. */
|
|
11314
|
+
export enum WindowType {
|
|
11315
|
+
NORMAL = "normal",
|
|
11316
|
+
POPUP = "popup",
|
|
11317
|
+
PANEL = "panel",
|
|
11318
|
+
APP = "app",
|
|
11319
|
+
DEVTOOLS = "devtools",
|
|
11320
|
+
}
|
|
11321
|
+
|
|
11322
|
+
/** Defines how zoom changes in a tab are handled and at what scope. */
|
|
11377
11323
|
export interface ZoomSettings {
|
|
11324
|
+
/** Defines how zoom changes are handled, i.e., which entity is responsible for the actual scaling of the page; defaults to `automatic`. */
|
|
11325
|
+
mode?: `${ZoomSettingsMode}` | undefined;
|
|
11326
|
+
/** Defines whether zoom changes persist for the page's origin, or only take effect in this tab; defaults to `per-origin` when in `automatic` mode, and `per-tab` otherwise. */
|
|
11327
|
+
scope?: `${ZoomSettingsScope}` | undefined;
|
|
11378
11328
|
/**
|
|
11379
|
-
*
|
|
11380
|
-
* Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to "automatic".
|
|
11381
|
-
* "automatic": Zoom changes are handled automatically by the browser.
|
|
11382
|
-
* "manual": Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support per-origin zooming, and will thus ignore the scope zoom setting and assume per-tab.
|
|
11383
|
-
* "disabled": Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored.
|
|
11384
|
-
*/
|
|
11385
|
-
mode?: string | undefined;
|
|
11386
|
-
/**
|
|
11387
|
-
* Optional.
|
|
11388
|
-
* Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise.
|
|
11389
|
-
* "per-origin": Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode.
|
|
11390
|
-
* "per-tab": Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab will always load pages with their per-origin zoom factors.
|
|
11391
|
-
*/
|
|
11392
|
-
scope?: string | undefined;
|
|
11393
|
-
/**
|
|
11394
|
-
* Optional.
|
|
11395
|
-
* Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings.
|
|
11329
|
+
* Used to return the default zoom level for the current tab in calls to {@link tabs.getZoomSettings}.
|
|
11396
11330
|
* @since Chrome 43
|
|
11397
11331
|
*/
|
|
11398
11332
|
defaultZoomFactor?: number | undefined;
|
|
11399
11333
|
}
|
|
11400
11334
|
|
|
11335
|
+
/**
|
|
11336
|
+
* Defines how zoom changes are handled, i.e., which entity is responsible for the actual scaling of the page; defaults to `automatic`.
|
|
11337
|
+
* @since Chrome 44
|
|
11338
|
+
*/
|
|
11339
|
+
export enum ZoomSettingsMode {
|
|
11340
|
+
/** Zoom changes are handled automatically by the browser. */
|
|
11341
|
+
AUTOMATIC = "automatic",
|
|
11342
|
+
/** Overrides the automatic handling of zoom changes. The `onZoomChange` event will still be dispatched, and it is the extension's responsibility to listen for this event and manually scale the page. This mode does not support `per-origin` zooming, and thus ignores the `scope` zoom setting and assumes `per-tab`. */
|
|
11343
|
+
MANUAL = "manual",
|
|
11344
|
+
/** Disables all zooming in the tab. The tab reverts to the default zoom level, and all attempted zoom changes are ignored. */
|
|
11345
|
+
DISABLED = "disabled",
|
|
11346
|
+
}
|
|
11347
|
+
|
|
11348
|
+
/**
|
|
11349
|
+
* Defines whether zoom changes persist for the page's origin, or only take effect in this tab; defaults to `per-origin` when in `automatic` mode, and `per-tab` otherwise.
|
|
11350
|
+
* @since Chrome 44
|
|
11351
|
+
*/
|
|
11352
|
+
export enum ZoomSettingsScope {
|
|
11353
|
+
/** Zoom changes persist in the zoomed page's origin, i.e., all other tabs navigated to that same origin are zoomed as well. Moreover, `per-origin` zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they are all zoomed to the same zoom factor. The `per-origin` scope is only available in the `automatic` mode. */
|
|
11354
|
+
PER_ORIGIN = "per-origin",
|
|
11355
|
+
/** Zoom changes only take effect in this tab, and zoom changes in other tabs do not affect the zooming of this tab. Also, `per-tab` zoom changes are reset on navigation; navigating a tab always loads pages with their `per-origin` zoom factors. */
|
|
11356
|
+
PER_TAB = "per-tab",
|
|
11357
|
+
}
|
|
11358
|
+
|
|
11359
|
+
/**
|
|
11360
|
+
* The maximum number of times that {@link captureVisibleTab} can be called per second. {@link captureVisibleTab} is expensive and should not be called too often.
|
|
11361
|
+
* @since Chrome 92
|
|
11362
|
+
*/
|
|
11363
|
+
export const MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND = 2;
|
|
11364
|
+
|
|
11365
|
+
/**
|
|
11366
|
+
* An ID that represents the absence of a browser tab.
|
|
11367
|
+
* @since Chrome 46
|
|
11368
|
+
*/
|
|
11369
|
+
export const TAB_ID_NONE = -1;
|
|
11370
|
+
|
|
11371
|
+
/**
|
|
11372
|
+
* An index that represents the absence of a tab index in a tab_strip.
|
|
11373
|
+
* @since Chrome 123
|
|
11374
|
+
*/
|
|
11375
|
+
export const TAB_INDEX_NONE = -1;
|
|
11376
|
+
|
|
11401
11377
|
export interface CreateProperties {
|
|
11402
|
-
/**
|
|
11378
|
+
/** The position the tab should take in the window. The provided value is clamped to between zero and the number of tabs in the window. */
|
|
11403
11379
|
index?: number | undefined;
|
|
11404
|
-
/**
|
|
11405
|
-
* Optional.
|
|
11406
|
-
* The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab.
|
|
11407
|
-
* @since Chrome 18
|
|
11408
|
-
*/
|
|
11380
|
+
/** The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab. */
|
|
11409
11381
|
openerTabId?: number | undefined;
|
|
11410
|
-
/**
|
|
11411
|
-
* Optional.
|
|
11412
|
-
* The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.
|
|
11413
|
-
*/
|
|
11382
|
+
/** The URL to initially navigate the tab to. Fully-qualified URLs must include a scheme (i.e., 'http://www.google.com', not 'www.google.com'). Relative URLs are relative to the current page within the extension. Defaults to the New Tab Page. */
|
|
11414
11383
|
url?: string | undefined;
|
|
11415
|
-
/**
|
|
11416
|
-
* Optional. Whether the tab should be pinned. Defaults to false
|
|
11417
|
-
* @since Chrome 9
|
|
11418
|
-
*/
|
|
11384
|
+
/** Whether the tab should be pinned. Defaults to `false` */
|
|
11419
11385
|
pinned?: boolean | undefined;
|
|
11420
|
-
/**
|
|
11386
|
+
/** The window in which to create the new tab. Defaults to the current window. */
|
|
11421
11387
|
windowId?: number | undefined;
|
|
11422
|
-
/**
|
|
11423
|
-
* Optional.
|
|
11424
|
-
* Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults to true.
|
|
11425
|
-
* @since Chrome 16
|
|
11426
|
-
*/
|
|
11388
|
+
/** Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see {@link windows.update}). Defaults to `true`. */
|
|
11427
11389
|
active?: boolean | undefined;
|
|
11428
11390
|
/**
|
|
11429
|
-
*
|
|
11430
|
-
* @deprecated since Chrome 33. Please use active.
|
|
11391
|
+
* Whether the tab should become the selected tab in the window. Defaults to `true`
|
|
11392
|
+
* @deprecated since Chrome 33. Please use {@link CreateProperties.active active}.
|
|
11431
11393
|
*/
|
|
11432
11394
|
selected?: boolean | undefined;
|
|
11433
11395
|
}
|
|
11434
11396
|
|
|
11435
11397
|
export interface MoveProperties {
|
|
11436
|
-
/** The position to move the window to.
|
|
11398
|
+
/** The position to move the window to. Use `-1` to place the tab at the end of the window. */
|
|
11437
11399
|
index: number;
|
|
11438
|
-
/**
|
|
11400
|
+
/** Defaults to the window the tab is currently in. */
|
|
11439
11401
|
windowId?: number | undefined;
|
|
11440
11402
|
}
|
|
11441
11403
|
|
|
11442
11404
|
export interface UpdateProperties {
|
|
11443
|
-
/**
|
|
11444
|
-
* Optional. Whether the tab should be pinned.
|
|
11445
|
-
* @since Chrome 9
|
|
11446
|
-
*/
|
|
11405
|
+
/** Whether the tab should be pinned. */
|
|
11447
11406
|
pinned?: boolean | undefined;
|
|
11448
|
-
/**
|
|
11449
|
-
* Optional. The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab.
|
|
11450
|
-
* @since Chrome 18
|
|
11451
|
-
*/
|
|
11407
|
+
/** The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. */
|
|
11452
11408
|
openerTabId?: number | undefined;
|
|
11453
|
-
/**
|
|
11409
|
+
/** A URL to navigate the tab to. JavaScript URLs are not supported; use {@link scripting.executeScript} instead. */
|
|
11454
11410
|
url?: string | undefined;
|
|
11455
|
-
/**
|
|
11456
|
-
* Optional. Adds or removes the tab from the current selection.
|
|
11457
|
-
* @since Chrome 16
|
|
11458
|
-
*/
|
|
11411
|
+
/** Adds or removes the tab from the current selection. */
|
|
11459
11412
|
highlighted?: boolean | undefined;
|
|
11460
|
-
/**
|
|
11461
|
-
* Optional. Whether the tab should be active. Does not affect whether the window is focused (see windows.update).
|
|
11462
|
-
* @since Chrome 16
|
|
11463
|
-
*/
|
|
11413
|
+
/** Whether the tab should be active. Does not affect whether the window is focused (see {@link windows.update}).*/
|
|
11464
11414
|
active?: boolean | undefined;
|
|
11465
11415
|
/**
|
|
11466
|
-
*
|
|
11467
|
-
* @deprecated since Chrome 33. Please use highlighted.
|
|
11416
|
+
* Whether the tab should be selected.
|
|
11417
|
+
* @deprecated since Chrome 33. Please use {@link highlighted}.
|
|
11468
11418
|
*/
|
|
11469
11419
|
selected?: boolean | undefined;
|
|
11470
11420
|
/**
|
|
11471
|
-
*
|
|
11421
|
+
* Whether the tab should be muted.
|
|
11472
11422
|
* @since Chrome 45
|
|
11473
11423
|
*/
|
|
11474
11424
|
muted?: boolean | undefined;
|
|
11475
11425
|
/**
|
|
11476
|
-
*
|
|
11426
|
+
* Whether the tab should be discarded automatically by the browser when resources are low.
|
|
11477
11427
|
* @since Chrome 54
|
|
11478
11428
|
*/
|
|
11479
11429
|
autoDiscardable?: boolean | undefined;
|
|
11480
11430
|
}
|
|
11481
11431
|
|
|
11482
11432
|
export interface ReloadProperties {
|
|
11483
|
-
/**
|
|
11433
|
+
/** Whether to bypass local caching. Defaults to `false`. */
|
|
11484
11434
|
bypassCache?: boolean | undefined;
|
|
11485
11435
|
}
|
|
11486
11436
|
|
|
11487
11437
|
export interface ConnectInfo {
|
|
11488
|
-
/**
|
|
11438
|
+
/** Is passed into onConnect for content scripts that are listening for the connection event. */
|
|
11489
11439
|
name?: string | undefined;
|
|
11490
|
-
/**
|
|
11491
|
-
* Open a port to a specific frame identified by frameId instead of all frames in the tab.
|
|
11492
|
-
* @since Chrome 41
|
|
11493
|
-
*/
|
|
11440
|
+
/** Open a port to a specific frame identified by `frameId` instead of all frames in the tab. */
|
|
11494
11441
|
frameId?: number | undefined;
|
|
11495
11442
|
/**
|
|
11496
|
-
*
|
|
11443
|
+
* Open a port to a specific document identified by `documentId` instead of all frames in the tab.
|
|
11497
11444
|
* @since Chrome 106
|
|
11498
11445
|
*/
|
|
11499
11446
|
documentId?: string;
|
|
11500
11447
|
}
|
|
11501
11448
|
|
|
11502
11449
|
export interface MessageSendOptions {
|
|
11503
|
-
/**
|
|
11450
|
+
/** Send a message to a specific frame identified by `frameId` instead of all frames in the tab. */
|
|
11504
11451
|
frameId?: number | undefined;
|
|
11505
11452
|
/**
|
|
11506
|
-
*
|
|
11453
|
+
* Send a message to a specific document identified by `documentId` instead of all frames in the tab.
|
|
11507
11454
|
* @since Chrome 106
|
|
11508
11455
|
*/
|
|
11509
11456
|
documentId?: string;
|
|
11510
11457
|
}
|
|
11511
11458
|
|
|
11512
11459
|
export interface GroupOptions {
|
|
11513
|
-
/**
|
|
11460
|
+
/** Configurations for creating a group. Cannot be used if groupId is already specified. */
|
|
11514
11461
|
createProperties?: {
|
|
11515
|
-
/**
|
|
11462
|
+
/** The window of the new group. Defaults to the current window. */
|
|
11516
11463
|
windowId?: number | undefined;
|
|
11517
11464
|
} | undefined;
|
|
11518
|
-
/**
|
|
11465
|
+
/** The ID of the group to add the tabs to. If not specified, a new group will be created. */
|
|
11519
11466
|
groupId?: number | undefined;
|
|
11520
|
-
/**
|
|
11521
|
-
tabIds?: number | number[] | undefined;
|
|
11467
|
+
/** The tab ID or list of tab IDs to add to the specified group. */
|
|
11468
|
+
tabIds?: number | [number, ...number[]] | undefined;
|
|
11522
11469
|
}
|
|
11523
11470
|
|
|
11524
11471
|
export interface HighlightInfo {
|
|
11525
11472
|
/** One or more tab indices to highlight. */
|
|
11526
11473
|
tabs: number | number[];
|
|
11527
|
-
/**
|
|
11474
|
+
/** The window that contains the tabs. */
|
|
11528
11475
|
windowId?: number | undefined;
|
|
11529
11476
|
}
|
|
11530
11477
|
|
|
11531
11478
|
export interface QueryInfo {
|
|
11532
|
-
/**
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
*/
|
|
11536
|
-
status?: "loading" | "complete" | undefined;
|
|
11537
|
-
/**
|
|
11538
|
-
* Optional. Whether the tabs are in the last focused window.
|
|
11539
|
-
* @since Chrome 19
|
|
11540
|
-
*/
|
|
11479
|
+
/** The tab loading status. */
|
|
11480
|
+
status?: `${TabStatus}` | undefined;
|
|
11481
|
+
/** Whether the tabs are in the last focused window. */
|
|
11541
11482
|
lastFocusedWindow?: boolean | undefined;
|
|
11542
|
-
/**
|
|
11483
|
+
/** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
|
|
11543
11484
|
windowId?: number | undefined;
|
|
11544
|
-
/**
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
*/
|
|
11548
|
-
windowType?: "normal" | "popup" | "panel" | "app" | "devtools" | undefined;
|
|
11549
|
-
/** Optional. Whether the tabs are active in their windows. */
|
|
11485
|
+
/** The type of window the tabs are in. */
|
|
11486
|
+
windowType?: `${WindowType}` | undefined;
|
|
11487
|
+
/** Whether the tabs are active in their windows. */
|
|
11550
11488
|
active?: boolean | undefined;
|
|
11551
|
-
/**
|
|
11552
|
-
* Optional. The position of the tabs within their windows.
|
|
11553
|
-
* @since Chrome 18
|
|
11554
|
-
*/
|
|
11489
|
+
/** The position of the tabs within their windows. */
|
|
11555
11490
|
index?: number | undefined;
|
|
11556
|
-
/** Match page titles against a pattern. This property is ignored if the extension does not have the `tabs` permission or host permissions for the page. */
|
|
11491
|
+
/** Match page titles against a pattern. This property is ignored if the extension does not have the `"tabs"` permission or host permissions for the page. */
|
|
11557
11492
|
title?: string | undefined;
|
|
11558
|
-
/** Match tabs against one or more URL patterns. Fragment identifiers are not matched. This property is ignored if the extension does not have the `tabs` permission or host permissions for the page. */
|
|
11493
|
+
/** Match tabs against one or more URL patterns. Fragment identifiers are not matched. This property is ignored if the extension does not have the `"tabs"` permission or host permissions for the page. */
|
|
11559
11494
|
url?: string | string[] | undefined;
|
|
11560
|
-
/**
|
|
11561
|
-
* Optional. Whether the tabs are in the current window.
|
|
11562
|
-
* @since Chrome 19
|
|
11563
|
-
*/
|
|
11495
|
+
/** Whether the tabs are in the current window. */
|
|
11564
11496
|
currentWindow?: boolean | undefined;
|
|
11565
|
-
/**
|
|
11497
|
+
/** Whether the tabs are highlighted. */
|
|
11566
11498
|
highlighted?: boolean | undefined;
|
|
11567
11499
|
/**
|
|
11568
|
-
*
|
|
11569
|
-
* Whether the tabs are discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content gets reloaded the next time it's activated.
|
|
11500
|
+
* Whether the tabs are discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content is reloaded the next time it is activated.
|
|
11570
11501
|
* @since Chrome 54
|
|
11571
11502
|
*/
|
|
11572
11503
|
discarded?: boolean | undefined;
|
|
@@ -11574,866 +11505,560 @@ export namespace Browser {
|
|
|
11574
11505
|
* Whether the tabs are frozen. A frozen tab cannot execute tasks, including event handlers or timers. It is visible in the tab strip and its content is loaded in memory. It is unfrozen on activation.
|
|
11575
11506
|
* @since Chrome 132
|
|
11576
11507
|
*/
|
|
11577
|
-
frozen?: boolean;
|
|
11508
|
+
frozen?: boolean | undefined;
|
|
11578
11509
|
/**
|
|
11579
|
-
* Optional.
|
|
11580
11510
|
* Whether the tabs can be discarded automatically by the browser when resources are low.
|
|
11581
11511
|
* @since Chrome 54
|
|
11582
11512
|
*/
|
|
11583
11513
|
autoDiscardable?: boolean | undefined;
|
|
11584
|
-
/**
|
|
11514
|
+
/** Whether the tabs are pinned. */
|
|
11585
11515
|
pinned?: boolean | undefined;
|
|
11586
11516
|
/**
|
|
11587
|
-
*
|
|
11517
|
+
* Whether the tabs are audible.
|
|
11588
11518
|
* @since Chrome 45
|
|
11589
11519
|
*/
|
|
11590
11520
|
audible?: boolean | undefined;
|
|
11591
11521
|
/**
|
|
11592
|
-
*
|
|
11522
|
+
* Whether the tabs are muted.
|
|
11593
11523
|
* @since Chrome 45
|
|
11594
11524
|
*/
|
|
11595
11525
|
muted?: boolean | undefined;
|
|
11596
11526
|
/**
|
|
11597
|
-
*
|
|
11527
|
+
* The ID of the group that the tabs are in, or {@link Browser.tabGroups.TAB_GROUP_ID_NONE} for ungrouped tabs.
|
|
11598
11528
|
* @since Chrome 88
|
|
11599
11529
|
*/
|
|
11600
11530
|
groupId?: number | undefined;
|
|
11601
11531
|
}
|
|
11602
11532
|
|
|
11603
|
-
export interface
|
|
11604
|
-
|
|
11533
|
+
export interface OnHighlightedInfo {
|
|
11534
|
+
/** All highlighted tabs in the window. */
|
|
11605
11535
|
tabIds: number[];
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
export interface TabRemoveInfo {
|
|
11609
|
-
/**
|
|
11610
|
-
* The window whose tab is closed.
|
|
11611
|
-
* @since Chrome 25
|
|
11612
|
-
*/
|
|
11536
|
+
/** The window whose tabs changed. */
|
|
11613
11537
|
windowId: number;
|
|
11614
|
-
/** True when the tab is being closed because its window is being closed. */
|
|
11615
|
-
isWindowClosing: boolean;
|
|
11616
11538
|
}
|
|
11617
11539
|
|
|
11618
|
-
export interface
|
|
11619
|
-
|
|
11620
|
-
|
|
11540
|
+
export interface OnRemovedInfo {
|
|
11541
|
+
/** True when the tab was closed because its parent window was closed. */
|
|
11542
|
+
isWindowClosing: boolean;
|
|
11543
|
+
/** The window whose tab is closed */
|
|
11544
|
+
windowId: number;
|
|
11621
11545
|
}
|
|
11622
11546
|
|
|
11623
|
-
export interface
|
|
11624
|
-
/**
|
|
11625
|
-
|
|
11547
|
+
export interface OnUpdatedInfo {
|
|
11548
|
+
/** The tab's new audible state. */
|
|
11549
|
+
audible?: boolean;
|
|
11626
11550
|
/**
|
|
11627
|
-
* The tab's new
|
|
11628
|
-
* @since Chrome
|
|
11629
|
-
*/
|
|
11630
|
-
pinned?: boolean | undefined;
|
|
11631
|
-
/** Optional. The tab's URL if it has changed. */
|
|
11632
|
-
url?: string | undefined;
|
|
11633
|
-
/**
|
|
11634
|
-
* The tab's new audible state.
|
|
11635
|
-
* @since Chrome 45
|
|
11551
|
+
* The tab's new auto-discardable state.
|
|
11552
|
+
* @since Chrome 54
|
|
11636
11553
|
*/
|
|
11637
|
-
|
|
11554
|
+
autoDiscardable?: boolean;
|
|
11638
11555
|
/**
|
|
11639
11556
|
* The tab's new discarded state.
|
|
11640
11557
|
* @since Chrome 54
|
|
11641
11558
|
*/
|
|
11642
|
-
discarded?: boolean
|
|
11559
|
+
discarded?: boolean;
|
|
11560
|
+
/** The tab's new favicon URL. */
|
|
11561
|
+
favIconUrl?: string;
|
|
11643
11562
|
/**
|
|
11644
|
-
* The tab's new
|
|
11645
|
-
* @since Chrome
|
|
11563
|
+
* The tab's new frozen state.
|
|
11564
|
+
* @since Chrome 132
|
|
11646
11565
|
*/
|
|
11647
|
-
|
|
11566
|
+
frozen?: boolean;
|
|
11648
11567
|
/**
|
|
11649
11568
|
* The tab's new group.
|
|
11650
11569
|
* @since Chrome 88
|
|
11651
11570
|
*/
|
|
11652
|
-
groupId?: number
|
|
11571
|
+
groupId?: number;
|
|
11653
11572
|
/**
|
|
11654
11573
|
* The tab's new muted state and the reason for the change.
|
|
11655
11574
|
* @since Chrome 46
|
|
11656
11575
|
*/
|
|
11657
|
-
mutedInfo?: MutedInfo
|
|
11658
|
-
/**
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
favIconUrl?: string | undefined;
|
|
11663
|
-
/**
|
|
11664
|
-
* The tab's new frozen state.
|
|
11665
|
-
* @since Chrome 132
|
|
11666
|
-
*/
|
|
11667
|
-
frozen?: boolean;
|
|
11576
|
+
mutedInfo?: MutedInfo;
|
|
11577
|
+
/** The tab's new pinned state. */
|
|
11578
|
+
pinned?: boolean;
|
|
11579
|
+
/** The tab's loading status. */
|
|
11580
|
+
status?: `${TabStatus}`;
|
|
11668
11581
|
/**
|
|
11669
11582
|
* The tab's new title.
|
|
11670
11583
|
* @since Chrome 48
|
|
11671
11584
|
*/
|
|
11672
|
-
title?: string
|
|
11585
|
+
title?: string;
|
|
11586
|
+
/** The tab's URL if it has changed. */
|
|
11587
|
+
url?: string;
|
|
11588
|
+
}
|
|
11589
|
+
|
|
11590
|
+
export interface OnAttachedInfo {
|
|
11591
|
+
newPosition: number;
|
|
11592
|
+
newWindowId: number;
|
|
11673
11593
|
}
|
|
11674
11594
|
|
|
11675
|
-
export interface
|
|
11595
|
+
export interface OnMovedInfo {
|
|
11596
|
+
fromIndex: number;
|
|
11676
11597
|
toIndex: number;
|
|
11677
11598
|
windowId: number;
|
|
11678
|
-
fromIndex: number;
|
|
11679
11599
|
}
|
|
11680
11600
|
|
|
11681
|
-
export interface
|
|
11682
|
-
oldWindowId: number;
|
|
11601
|
+
export interface OnDetachedInfo {
|
|
11683
11602
|
oldPosition: number;
|
|
11603
|
+
oldWindowId: number;
|
|
11684
11604
|
}
|
|
11685
11605
|
|
|
11686
|
-
export interface
|
|
11606
|
+
export interface OnActivatedInfo {
|
|
11687
11607
|
/** The ID of the tab that has become active. */
|
|
11688
11608
|
tabId: number;
|
|
11689
11609
|
/** The ID of the window the active tab changed inside of. */
|
|
11690
11610
|
windowId: number;
|
|
11691
11611
|
}
|
|
11692
11612
|
|
|
11693
|
-
export interface
|
|
11694
|
-
/** The ID of the window
|
|
11613
|
+
export interface OnSelectionChangedInfo {
|
|
11614
|
+
/** The ID of the window the selected tab changed inside of. */
|
|
11695
11615
|
windowId: number;
|
|
11696
11616
|
}
|
|
11697
11617
|
|
|
11698
|
-
export interface
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
newZoomFactor: number;
|
|
11702
|
-
zoomSettings: ZoomSettings;
|
|
11618
|
+
export interface OnActiveChangedInfo {
|
|
11619
|
+
/** The ID of the window the selected tab changed inside of. */
|
|
11620
|
+
windowId: number;
|
|
11703
11621
|
}
|
|
11704
11622
|
|
|
11705
|
-
export interface
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
export interface TabUpdatedEvent
|
|
11712
|
-
extends Browser.events.Event<(tabId: number, changeInfo: TabChangeInfo, tab: Tab) => void>
|
|
11713
|
-
{}
|
|
11714
|
-
|
|
11715
|
-
export interface TabAttachedEvent
|
|
11716
|
-
extends Browser.events.Event<(tabId: number, attachInfo: TabAttachInfo) => void>
|
|
11717
|
-
{}
|
|
11718
|
-
|
|
11719
|
-
export interface TabMovedEvent extends Browser.events.Event<(tabId: number, moveInfo: TabMoveInfo) => void> {}
|
|
11720
|
-
|
|
11721
|
-
export interface TabDetachedEvent
|
|
11722
|
-
extends Browser.events.Event<(tabId: number, detachInfo: TabDetachInfo) => void>
|
|
11723
|
-
{}
|
|
11724
|
-
|
|
11725
|
-
export interface TabCreatedEvent extends Browser.events.Event<(tab: Tab) => void> {}
|
|
11726
|
-
|
|
11727
|
-
export interface TabActivatedEvent extends Browser.events.Event<(activeInfo: TabActiveInfo) => void> {}
|
|
11728
|
-
|
|
11729
|
-
export interface TabReplacedEvent
|
|
11730
|
-
extends Browser.events.Event<(addedTabId: number, removedTabId: number) => void>
|
|
11731
|
-
{}
|
|
11732
|
-
|
|
11733
|
-
export interface TabSelectedEvent
|
|
11734
|
-
extends Browser.events.Event<(tabId: number, selectInfo: TabWindowInfo) => void>
|
|
11735
|
-
{}
|
|
11623
|
+
export interface OnHighlightChangedInfo {
|
|
11624
|
+
/** All highlighted tabs in the window. */
|
|
11625
|
+
tabIds: number[];
|
|
11626
|
+
/** The window whose tabs changed. */
|
|
11627
|
+
windowId: number;
|
|
11628
|
+
}
|
|
11736
11629
|
|
|
11737
|
-
export interface
|
|
11630
|
+
export interface OnZoomChangeInfo {
|
|
11631
|
+
newZoomFactor: number;
|
|
11632
|
+
oldZoomFactor: number;
|
|
11633
|
+
tabId: number;
|
|
11634
|
+
zoomSettings: ZoomSettings;
|
|
11635
|
+
}
|
|
11738
11636
|
|
|
11739
11637
|
/**
|
|
11740
11638
|
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11741
|
-
*
|
|
11742
|
-
*
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
*
|
|
11747
|
-
* @
|
|
11748
|
-
* @param callback Optional. Called after all the JavaScript has been executed.
|
|
11749
|
-
* Parameter result: The result of the script in every injected frame.
|
|
11750
|
-
*/
|
|
11751
|
-
export function executeScript(details: extensionTypes.InjectDetails, callback?: (result: any[]) => void): void;
|
|
11752
|
-
/**
|
|
11753
|
-
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11754
|
-
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
|
|
11755
|
-
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
|
|
11756
|
-
* @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
|
|
11757
|
-
*/
|
|
11758
|
-
export function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise<any[]>;
|
|
11759
|
-
/**
|
|
11760
|
-
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11761
|
-
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
|
|
11762
|
-
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
|
|
11763
|
-
* @param callback Optional. Called after all the JavaScript has been executed.
|
|
11764
|
-
* Parameter result: The result of the script in every injected frame.
|
|
11639
|
+
*
|
|
11640
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11641
|
+
*
|
|
11642
|
+
* MV2 only
|
|
11643
|
+
* @param tabId The ID of the tab in which to run the script; defaults to the active tab of the current window.
|
|
11644
|
+
* @param details Details of the script to run. Either the code or the file property must be set, but both may not be set at the same time
|
|
11645
|
+
* @deprecated since Chrome 99. Replaced by {@link scripting.executeScript} in Manifest V3.
|
|
11765
11646
|
*/
|
|
11647
|
+
export function executeScript(details: extensionTypes.InjectDetails): Promise<any[] | undefined>;
|
|
11766
11648
|
export function executeScript(
|
|
11767
|
-
tabId: number,
|
|
11649
|
+
tabId: number | undefined,
|
|
11768
11650
|
details: extensionTypes.InjectDetails,
|
|
11769
|
-
|
|
11651
|
+
): Promise<any[] | undefined>;
|
|
11652
|
+
export function executeScript(details: extensionTypes.InjectDetails, callback: (result?: any[]) => void): void;
|
|
11653
|
+
export function executeScript(
|
|
11654
|
+
tabId: number | undefined,
|
|
11655
|
+
details: extensionTypes.InjectDetails,
|
|
11656
|
+
callback: (result?: any[]) => void,
|
|
11770
11657
|
): void;
|
|
11771
|
-
|
|
11772
|
-
export function get(tabId: number, callback: (tab: Tab) => void): void;
|
|
11658
|
+
|
|
11773
11659
|
/**
|
|
11774
|
-
* Retrieves details about the specified tab
|
|
11775
|
-
*
|
|
11660
|
+
* Retrieves details about the specified tab
|
|
11661
|
+
*
|
|
11662
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11776
11663
|
*/
|
|
11777
11664
|
export function get(tabId: number): Promise<Tab>;
|
|
11665
|
+
export function get(tabId: number, callback: (tab: Tab) => void): void;
|
|
11666
|
+
|
|
11778
11667
|
/**
|
|
11779
11668
|
* Gets details about all tabs in the specified window.
|
|
11780
|
-
*
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
*
|
|
11785
|
-
* @return The `getAllInWindow` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
11786
|
-
* @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}.
|
|
11787
|
-
*/
|
|
11788
|
-
export function getAllInWindow(): Promise<Tab>;
|
|
11789
|
-
/**
|
|
11790
|
-
* Gets details about all tabs in the specified window.
|
|
11791
|
-
* @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}.
|
|
11792
|
-
* @param windowId Optional. Defaults to the current window.
|
|
11793
|
-
*/
|
|
11794
|
-
export function getAllInWindow(windowId: number, callback: (tab: Tab) => void): void;
|
|
11795
|
-
/**
|
|
11796
|
-
* Gets details about all tabs in the specified window.
|
|
11797
|
-
* @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}.
|
|
11798
|
-
* @param windowId Optional. Defaults to the current window.
|
|
11799
|
-
* @return The `getAllInWindow` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
11669
|
+
*
|
|
11670
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11671
|
+
*
|
|
11672
|
+
* MV2 only
|
|
11673
|
+
* @deprecated Please use {@link tabs.query} `{windowId: windowId}`.
|
|
11800
11674
|
*/
|
|
11801
|
-
export function getAllInWindow(windowId
|
|
11802
|
-
|
|
11803
|
-
export function
|
|
11675
|
+
export function getAllInWindow(windowId?: number): Promise<Tab[]>;
|
|
11676
|
+
export function getAllInWindow(callback: (tabs: Tab[]) => void): void;
|
|
11677
|
+
export function getAllInWindow(windowId: number | undefined, callback: (tabs: Tab[]) => void): void;
|
|
11678
|
+
|
|
11804
11679
|
/**
|
|
11805
|
-
* Gets the tab that this script call is being made from.
|
|
11806
|
-
*
|
|
11680
|
+
* Gets the tab that this script call is being made from. Returns `undefined` if called from a non-tab context (for example, a background page or popup view).
|
|
11681
|
+
*
|
|
11682
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11807
11683
|
*/
|
|
11808
11684
|
export function getCurrent(): Promise<Tab | undefined>;
|
|
11685
|
+
export function getCurrent(callback: (tab?: Tab) => void): void;
|
|
11686
|
+
|
|
11809
11687
|
/**
|
|
11810
11688
|
* Gets the tab that is selected in the specified window.
|
|
11811
|
-
*
|
|
11689
|
+
*
|
|
11690
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11691
|
+
*
|
|
11692
|
+
* MV2 only
|
|
11693
|
+
* @param windowId Defaults to the current window.
|
|
11694
|
+
* @deprecated Please use {@link tabs.query} `{active: true}`.
|
|
11812
11695
|
*/
|
|
11696
|
+
export function getSelected(windowId?: number): Promise<Tab>;
|
|
11813
11697
|
export function getSelected(callback: (tab: Tab) => void): void;
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
* @return The `getSelected` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
11817
|
-
* @deprecated since Chrome 33. Please use tabs.query {active: true}.
|
|
11818
|
-
*/
|
|
11819
|
-
export function getSelected(): Promise<Tab>;
|
|
11820
|
-
/**
|
|
11821
|
-
* Gets the tab that is selected in the specified window.
|
|
11822
|
-
* @deprecated since Chrome 33. Please use tabs.query {active: true}.
|
|
11823
|
-
* @param windowId Optional. Defaults to the current window.
|
|
11824
|
-
*/
|
|
11825
|
-
export function getSelected(windowId: number, callback: (tab: Tab) => void): void;
|
|
11826
|
-
/**
|
|
11827
|
-
* Gets the tab that is selected in the specified window.
|
|
11828
|
-
* @deprecated since Chrome 33. Please use tabs.query {active: true}.
|
|
11829
|
-
* @param windowId Optional. Defaults to the current window.
|
|
11830
|
-
* @return The `getSelected` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
11831
|
-
*/
|
|
11832
|
-
export function getSelected(windowId: number): Promise<Tab>;
|
|
11698
|
+
export function getSelected(windowId: number | undefined, callback: (tab: Tab) => void): void;
|
|
11699
|
+
|
|
11833
11700
|
/**
|
|
11834
11701
|
* Creates a new tab.
|
|
11835
|
-
*
|
|
11702
|
+
*
|
|
11703
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11836
11704
|
*/
|
|
11837
11705
|
export function create(createProperties: CreateProperties): Promise<Tab>;
|
|
11838
|
-
/**
|
|
11839
|
-
* Creates a new tab.
|
|
11840
|
-
* @param callback Optional.
|
|
11841
|
-
* Parameter tab: Details about the created tab. Will contain the ID of the new tab.
|
|
11842
|
-
*/
|
|
11843
11706
|
export function create(createProperties: CreateProperties, callback: (tab: Tab) => void): void;
|
|
11707
|
+
|
|
11844
11708
|
/**
|
|
11845
11709
|
* Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
|
|
11846
|
-
* @param tabId The tab to move.
|
|
11847
|
-
* @
|
|
11710
|
+
* @param tabId The tab ID to move.
|
|
11711
|
+
* @param tabIds List of tab IDs to move.
|
|
11712
|
+
*
|
|
11713
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11848
11714
|
*/
|
|
11849
11715
|
export function move(tabId: number, moveProperties: MoveProperties): Promise<Tab>;
|
|
11850
|
-
/**
|
|
11851
|
-
* Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
|
|
11852
|
-
* @param tabId The tab to move.
|
|
11853
|
-
* @param callback Optional.
|
|
11854
|
-
* Parameter tab: Details about the moved tab.
|
|
11855
|
-
*/
|
|
11856
|
-
export function move(tabId: number, moveProperties: MoveProperties, callback: (tab: Tab) => void): void;
|
|
11857
|
-
/**
|
|
11858
|
-
* Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
|
|
11859
|
-
* @param tabIds The tabs to move.
|
|
11860
|
-
* @return The `move` method provides its result via callback or returned as a `Promise` (MV3 only). Details about the moved tabs.
|
|
11861
|
-
*/
|
|
11862
11716
|
export function move(tabIds: number[], moveProperties: MoveProperties): Promise<Tab[]>;
|
|
11863
|
-
|
|
11864
|
-
* Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
|
|
11865
|
-
* @param tabIds The tabs to move.
|
|
11866
|
-
* @param callback Optional.
|
|
11867
|
-
* Parameter tabs: Details about the moved tabs.
|
|
11868
|
-
*/
|
|
11717
|
+
export function move(tabId: number, moveProperties: MoveProperties, callback: (tab: Tab) => void): void;
|
|
11869
11718
|
export function move(tabIds: number[], moveProperties: MoveProperties, callback: (tabs: Tab[]) => void): void;
|
|
11719
|
+
|
|
11870
11720
|
/**
|
|
11871
|
-
* Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified.
|
|
11872
|
-
*
|
|
11721
|
+
* Modifies the properties of a tab. Properties that are not specified in `updateProperties` are not modified.
|
|
11722
|
+
*
|
|
11723
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11724
|
+
* @param tabId Defaults to the selected tab of the current window.
|
|
11873
11725
|
*/
|
|
11874
11726
|
export function update(updateProperties: UpdateProperties): Promise<Tab | undefined>;
|
|
11875
|
-
|
|
11876
|
-
* Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified.
|
|
11877
|
-
* @param callback Optional.
|
|
11878
|
-
* Optional parameter tab: Details about the updated tab. The `url`, `pendingUrl`, `title` and `favIconUrl` properties are only included on the {@link tabs.Tab} object if the extension has the `tabs` permission or has host permissions for the page..
|
|
11879
|
-
*/
|
|
11727
|
+
export function update(tabId: number | undefined, updateProperties: UpdateProperties): Promise<Tab | undefined>;
|
|
11880
11728
|
export function update(updateProperties: UpdateProperties, callback: (tab?: Tab) => void): void;
|
|
11729
|
+
export function update(
|
|
11730
|
+
tabId: number | undefined,
|
|
11731
|
+
updateProperties: UpdateProperties,
|
|
11732
|
+
callback: (tab?: Tab) => void,
|
|
11733
|
+
): void;
|
|
11734
|
+
|
|
11881
11735
|
/**
|
|
11882
|
-
*
|
|
11883
|
-
*
|
|
11884
|
-
*
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
/**
|
|
11888
|
-
* Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified.
|
|
11889
|
-
* @param tabId Defaults to the selected tab of the current window.
|
|
11890
|
-
* @param callback Optional.
|
|
11891
|
-
* Optional parameter tab: Details about the updated tab. The `url`, `pendingUrl`, `title` and `favIconUrl` properties are only included on the {@link tabs.Tab} object if the extension has the `tabs` permission or has host permissions for the page..
|
|
11892
|
-
*/
|
|
11893
|
-
export function update(tabId: number, updateProperties: UpdateProperties, callback: (tab?: Tab) => void): void;
|
|
11894
|
-
/**
|
|
11895
|
-
* Closes a tab.
|
|
11896
|
-
* @param tabId The tab to close.
|
|
11897
|
-
* @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11736
|
+
* Closes one or more tabs.
|
|
11737
|
+
*
|
|
11738
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11739
|
+
* @param tabId The tab ID to close.
|
|
11740
|
+
* @param tabIds List of tab IDs to close.
|
|
11898
11741
|
*/
|
|
11899
11742
|
export function remove(tabId: number): Promise<void>;
|
|
11900
|
-
/**
|
|
11901
|
-
* Closes a tab.
|
|
11902
|
-
* @param tabId The tab to close.
|
|
11903
|
-
*/
|
|
11904
|
-
export function remove(tabId: number, callback: () => void): void;
|
|
11905
|
-
/**
|
|
11906
|
-
* Closes several tabs.
|
|
11907
|
-
* @param tabIds The list of tabs to close.
|
|
11908
|
-
* @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11909
|
-
*/
|
|
11910
11743
|
export function remove(tabIds: number[]): Promise<void>;
|
|
11911
|
-
|
|
11912
|
-
* Closes several tabs.
|
|
11913
|
-
* @param tabIds The list of tabs to close.
|
|
11914
|
-
*/
|
|
11744
|
+
export function remove(tabId: number, callback: () => void): void;
|
|
11915
11745
|
export function remove(tabIds: number[], callback: () => void): void;
|
|
11746
|
+
|
|
11916
11747
|
/**
|
|
11917
|
-
* Captures the visible area of the currently active tab in the specified window.
|
|
11918
|
-
*
|
|
11919
|
-
*
|
|
11920
|
-
|
|
11921
|
-
export function captureVisibleTab(callback: (dataUrl: string) => void): void;
|
|
11922
|
-
/**
|
|
11923
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11924
|
-
* @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11748
|
+
* Captures the visible area of the currently active tab in the specified window. In order to call this method, the extension must have either the [<all\_urls>](https://developer.chrome.com/extensions/develop/concepts/declare-permissions) permission or the [activeTab](https://developer.chrome.com/docs/extensions/develop/concepts/activeTab) permission. In addition to sites that extensions can normally access, this method allows extensions to capture sensitive sites that are otherwise restricted, including chrome:-scheme pages, other extensions' pages, and data: URLs. These sensitive sites can only be captured with the activeTab permission. File URLs may be captured only if the extension has been granted file access.
|
|
11749
|
+
*
|
|
11750
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11751
|
+
* @param windowId The target window. Defaults to the current window.
|
|
11925
11752
|
*/
|
|
11926
11753
|
export function captureVisibleTab(): Promise<string>;
|
|
11927
|
-
/**
|
|
11928
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11929
|
-
* @param windowId Optional. The target window. Defaults to the current window.
|
|
11930
|
-
* @param callback
|
|
11931
|
-
* Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11932
|
-
*/
|
|
11933
|
-
export function captureVisibleTab(windowId: number, callback: (dataUrl: string) => void): void;
|
|
11934
|
-
/**
|
|
11935
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11936
|
-
* @param windowId Optional. The target window. Defaults to the current window.
|
|
11937
|
-
* @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11938
|
-
*/
|
|
11939
11754
|
export function captureVisibleTab(windowId: number): Promise<string>;
|
|
11940
|
-
/**
|
|
11941
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11942
|
-
* @param options Optional. Details about the format and quality of an image.
|
|
11943
|
-
* @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11944
|
-
*/
|
|
11945
11755
|
export function captureVisibleTab(options: extensionTypes.ImageDetails): Promise<string>;
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
* @param callback
|
|
11950
|
-
* Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11951
|
-
*/
|
|
11756
|
+
export function captureVisibleTab(windowId: number, options: extensionTypes.ImageDetails): Promise<string>;
|
|
11757
|
+
export function captureVisibleTab(callback: (dataUrl: string) => void): void;
|
|
11758
|
+
export function captureVisibleTab(windowId: number, callback: (dataUrl: string) => void): void;
|
|
11952
11759
|
export function captureVisibleTab(
|
|
11953
11760
|
options: extensionTypes.ImageDetails,
|
|
11954
11761
|
callback: (dataUrl: string) => void,
|
|
11955
11762
|
): void;
|
|
11956
|
-
/**
|
|
11957
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11958
|
-
* @param windowId Optional. The target window. Defaults to the current window.
|
|
11959
|
-
* @param options Optional. Details about the format and quality of an image.
|
|
11960
|
-
* @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11961
|
-
*/
|
|
11962
|
-
export function captureVisibleTab(
|
|
11963
|
-
windowId: number,
|
|
11964
|
-
options: extensionTypes.ImageDetails,
|
|
11965
|
-
): Promise<string>;
|
|
11966
|
-
/**
|
|
11967
|
-
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11968
|
-
* @param windowId Optional. The target window. Defaults to the current window.
|
|
11969
|
-
* @param options Optional. Details about the format and quality of an image.
|
|
11970
|
-
* @param callback
|
|
11971
|
-
* Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
|
|
11972
|
-
*/
|
|
11973
11763
|
export function captureVisibleTab(
|
|
11974
11764
|
windowId: number,
|
|
11975
11765
|
options: extensionTypes.ImageDetails,
|
|
11976
11766
|
callback: (dataUrl: string) => void,
|
|
11977
11767
|
): void;
|
|
11768
|
+
|
|
11978
11769
|
/**
|
|
11979
11770
|
* Reload a tab.
|
|
11980
|
-
*
|
|
11771
|
+
*
|
|
11772
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11981
11773
|
* @param tabId The ID of the tab to reload; defaults to the selected tab of the current window.
|
|
11982
|
-
* @return The `reload` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11983
11774
|
*/
|
|
11775
|
+
export function reload(): Promise<void>;
|
|
11984
11776
|
export function reload(tabId: number): Promise<void>;
|
|
11985
|
-
/**
|
|
11986
|
-
* Reload a tab.
|
|
11987
|
-
* @since Chrome 16
|
|
11988
|
-
* @param tabId The ID of the tab to reload; defaults to the selected tab of the current window.
|
|
11989
|
-
*/
|
|
11990
|
-
export function reload(tabId: number, callback?: () => void): void;
|
|
11991
|
-
/**
|
|
11992
|
-
* Reload the selected tab of the current window.
|
|
11993
|
-
* @since Chrome 16
|
|
11994
|
-
* @return The `reload` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11995
|
-
*/
|
|
11996
11777
|
export function reload(reloadProperties: ReloadProperties): Promise<void>;
|
|
11997
|
-
/**
|
|
11998
|
-
* Reload the selected tab of the current window.
|
|
11999
|
-
* @since Chrome 16
|
|
12000
|
-
*/
|
|
12001
|
-
export function reload(reloadProperties: ReloadProperties, callback: () => void): void;
|
|
12002
|
-
/**
|
|
12003
|
-
* Reload the selected tab of the current window.
|
|
12004
|
-
* @since Chrome 16
|
|
12005
|
-
* @return The `reload` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12006
|
-
*/
|
|
12007
11778
|
export function reload(tabId: number, reloadProperties: ReloadProperties): Promise<void>;
|
|
12008
|
-
/**
|
|
12009
|
-
* Reload the selected tab of the current window.
|
|
12010
|
-
* @since Chrome 16
|
|
12011
|
-
*/
|
|
12012
|
-
export function reload(tabId: number, reloadProperties: ReloadProperties, callback: () => void): void;
|
|
12013
|
-
/**
|
|
12014
|
-
* Reload the selected tab of the current window.
|
|
12015
|
-
* @since Chrome 16
|
|
12016
|
-
* @return The `reload` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12017
|
-
*/
|
|
12018
|
-
export function reload(): Promise<void>;
|
|
12019
|
-
/**
|
|
12020
|
-
* Reload the selected tab of the current window.
|
|
12021
|
-
* @since Chrome 16
|
|
12022
|
-
*/
|
|
12023
11779
|
export function reload(callback: () => void): void;
|
|
11780
|
+
export function reload(tabId: number | undefined, callback: () => void): void;
|
|
11781
|
+
export function reload(reloadProperties: ReloadProperties | undefined, callback: () => void): void;
|
|
11782
|
+
export function reload(
|
|
11783
|
+
tabId: number | undefined,
|
|
11784
|
+
reloadProperties: ReloadProperties | undefined,
|
|
11785
|
+
callback: () => void,
|
|
11786
|
+
): void;
|
|
11787
|
+
|
|
12024
11788
|
/**
|
|
12025
11789
|
* Duplicates a tab.
|
|
12026
|
-
*
|
|
12027
|
-
*
|
|
12028
|
-
* @
|
|
11790
|
+
*
|
|
11791
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11792
|
+
* @param tabId The ID of the tab to duplicate.
|
|
12029
11793
|
*/
|
|
12030
11794
|
export function duplicate(tabId: number): Promise<Tab | undefined>;
|
|
12031
|
-
/**
|
|
12032
|
-
* Duplicates a tab.
|
|
12033
|
-
* @since Chrome 23
|
|
12034
|
-
* @param tabId The ID of the tab which is to be duplicated.
|
|
12035
|
-
* @param callback Optional.
|
|
12036
|
-
* Optional parameter tab: Details about the duplicated tab. The `url`, `pendingUrl`, `title` and `favIconUrl` properties are only included on the {@link tabs.Tab} object if the extension has the `tabs` permission or has host permissions for the page.
|
|
12037
|
-
*/
|
|
12038
11795
|
export function duplicate(tabId: number, callback: (tab?: Tab) => void): void;
|
|
11796
|
+
|
|
12039
11797
|
/**
|
|
12040
|
-
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
|
12041
|
-
*
|
|
11798
|
+
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The {@link runtime.onMessage} event is fired in each content script running in the specified tab for the current extension.
|
|
11799
|
+
*
|
|
11800
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
|
12042
11801
|
*/
|
|
12043
11802
|
export function sendMessage<M = any, R = any>(
|
|
12044
11803
|
tabId: number,
|
|
12045
11804
|
message: M,
|
|
12046
|
-
|
|
12047
|
-
):
|
|
12048
|
-
/**
|
|
12049
|
-
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
|
12050
|
-
* @since Chrome 41
|
|
12051
|
-
* @param responseCallback Optional.
|
|
12052
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
|
12053
|
-
*/
|
|
11805
|
+
options?: MessageSendOptions,
|
|
11806
|
+
): Promise<R>;
|
|
12054
11807
|
export function sendMessage<M = any, R = any>(
|
|
12055
11808
|
tabId: number,
|
|
12056
11809
|
message: M,
|
|
12057
|
-
|
|
12058
|
-
|
|
11810
|
+
/** @since Chrome 99 */
|
|
11811
|
+
callback: (response: R) => void,
|
|
12059
11812
|
): void;
|
|
12060
|
-
/**
|
|
12061
|
-
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
|
12062
|
-
* @since Chrome 99
|
|
12063
|
-
*/
|
|
12064
|
-
export function sendMessage<M = any, R = any>(tabId: number, message: M): Promise<R>;
|
|
12065
|
-
/**
|
|
12066
|
-
* Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension.
|
|
12067
|
-
* @since Chrome 99
|
|
12068
|
-
*/
|
|
12069
11813
|
export function sendMessage<M = any, R = any>(
|
|
12070
11814
|
tabId: number,
|
|
12071
11815
|
message: M,
|
|
12072
|
-
options: MessageSendOptions,
|
|
12073
|
-
|
|
11816
|
+
options: MessageSendOptions | undefined,
|
|
11817
|
+
/** @since Chrome 99 */
|
|
11818
|
+
callback: (response: R) => void,
|
|
11819
|
+
): void;
|
|
11820
|
+
|
|
12074
11821
|
/**
|
|
12075
|
-
* Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension.
|
|
12076
|
-
*
|
|
12077
|
-
*
|
|
12078
|
-
*
|
|
11822
|
+
* Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The {@link extension.onRequest} event is fired in each content script running in the specified tab for the current extension.
|
|
11823
|
+
*
|
|
11824
|
+
* MV2 only
|
|
11825
|
+
* @deprecated Please use {@link runtime.sendMessage}.
|
|
12079
11826
|
*/
|
|
12080
11827
|
export function sendRequest<Request = any, Response = any>(
|
|
12081
11828
|
tabId: number,
|
|
12082
11829
|
request: Request,
|
|
12083
|
-
|
|
11830
|
+
): Promise<Response>;
|
|
11831
|
+
export function sendRequest<Request = any, Response = any>(
|
|
11832
|
+
tabId: number,
|
|
11833
|
+
request: Request,
|
|
11834
|
+
/** @since Chrome 99 */
|
|
11835
|
+
callback?: (response: Response) => void,
|
|
12084
11836
|
): void;
|
|
12085
|
-
|
|
12086
|
-
export function connect(tabId: number, connectInfo?: ConnectInfo): runtime.Port;
|
|
11837
|
+
|
|
12087
11838
|
/**
|
|
12088
|
-
*
|
|
12089
|
-
* @
|
|
12090
|
-
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11839
|
+
* Connects to the content script(s) in the specified tab. The {@link runtime.onConnect} event is fired in each content script running in the specified tab for the current extension.
|
|
11840
|
+
* @returns A port that can be used to communicate with the content scripts running in the specified tab. The port's {@link runtime.Port} event is fired if the tab closes or does not exist.
|
|
12091
11841
|
*/
|
|
12092
|
-
export function
|
|
11842
|
+
export function connect(tabId: number, connectInfo?: ConnectInfo): runtime.Port;
|
|
11843
|
+
|
|
12093
11844
|
/**
|
|
12094
|
-
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
12095
|
-
*
|
|
12096
|
-
*
|
|
11845
|
+
* Injects CSS into a page. Styles inserted with this method can be removed with {@link scripting.removeCSS}`. For details, see the programmatic injection section of the content scripts doc.
|
|
11846
|
+
*
|
|
11847
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11848
|
+
*
|
|
11849
|
+
* MV2 only
|
|
11850
|
+
* @param tabId The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
11851
|
+
* @param details Details of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time.
|
|
11852
|
+
* @deprecated since Chrome 99. Replaced by {@link scripting.insertCSS} in Manifest V3.
|
|
12097
11853
|
*/
|
|
11854
|
+
export function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
|
|
11855
|
+
export function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
|
|
12098
11856
|
export function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
|
|
12099
|
-
|
|
12100
|
-
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
12101
|
-
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
12102
|
-
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
|
|
12103
|
-
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12104
|
-
*/
|
|
12105
|
-
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise<void>;
|
|
12106
|
-
/**
|
|
12107
|
-
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
12108
|
-
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
12109
|
-
* @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
|
|
12110
|
-
* @param callback Optional. Called when all the CSS has been inserted.
|
|
12111
|
-
*/
|
|
11857
|
+
export function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
|
|
12112
11858
|
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
|
|
11859
|
+
|
|
12113
11860
|
/**
|
|
12114
|
-
* Highlights the given tabs.
|
|
12115
|
-
*
|
|
12116
|
-
*
|
|
12117
|
-
*/
|
|
12118
|
-
export function highlight(highlightInfo: HighlightInfo): Promise<Browser.windows.Window>;
|
|
12119
|
-
/**
|
|
12120
|
-
* Highlights the given tabs.
|
|
12121
|
-
* @since Chrome 16
|
|
12122
|
-
* @param callback Optional.
|
|
12123
|
-
* Parameter window: Contains details about the window whose tabs were highlighted.
|
|
12124
|
-
*/
|
|
12125
|
-
export function highlight(
|
|
12126
|
-
highlightInfo: HighlightInfo,
|
|
12127
|
-
callback: (window: Browser.windows.Window) => void,
|
|
12128
|
-
): void;
|
|
12129
|
-
/**
|
|
12130
|
-
* Gets all tabs that have the specified properties, or all tabs if no properties are specified.
|
|
12131
|
-
* @since Chrome 16
|
|
12132
|
-
*/
|
|
12133
|
-
export function query(queryInfo: QueryInfo, callback: (result: Tab[]) => void): void;
|
|
12134
|
-
/**
|
|
12135
|
-
* Gets all tabs that have the specified properties, or all tabs if no properties are specified.
|
|
12136
|
-
* @since Chrome 16
|
|
12137
|
-
* @return The `query` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
11861
|
+
* Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
|
|
11862
|
+
*
|
|
11863
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
12138
11864
|
*/
|
|
11865
|
+
export function highlight(highlightInfo: HighlightInfo): Promise<windows.Window>;
|
|
11866
|
+
export function highlight(highlightInfo: HighlightInfo, callback: (window: windows.Window) => void): void;
|
|
11867
|
+
|
|
11868
|
+
/** Gets all tabs that have the specified properties, or all tabs if no properties are specified. */
|
|
12139
11869
|
export function query(queryInfo: QueryInfo): Promise<Tab[]>;
|
|
11870
|
+
export function query(queryInfo: QueryInfo, callback: (result: Tab[]) => void): void;
|
|
11871
|
+
|
|
12140
11872
|
/**
|
|
12141
11873
|
* Detects the primary language of the content in a tab.
|
|
12142
|
-
*
|
|
12143
|
-
*
|
|
11874
|
+
*
|
|
11875
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11876
|
+
* @param tabId The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window.
|
|
12144
11877
|
*/
|
|
11878
|
+
export function detectLanguage(tabId?: number): Promise<string>;
|
|
12145
11879
|
export function detectLanguage(callback: (language: string) => void): void;
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
* @return The `detectLanguage` method provides its result via callback or returned as a `Promise` (MV3 only). An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned.
|
|
12149
|
-
*/
|
|
12150
|
-
export function detectLanguage(): Promise<string>;
|
|
12151
|
-
/**
|
|
12152
|
-
* Detects the primary language of the content in a tab.
|
|
12153
|
-
* @param tabId Optional. Defaults to the active tab of the current window.
|
|
12154
|
-
* @param callback
|
|
12155
|
-
* Parameter language: An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned.
|
|
12156
|
-
*/
|
|
12157
|
-
export function detectLanguage(tabId: number, callback: (language: string) => void): void;
|
|
12158
|
-
/**
|
|
12159
|
-
* Detects the primary language of the content in a tab.
|
|
12160
|
-
* @param tabId Optional. Defaults to the active tab of the current window.
|
|
12161
|
-
* @return The `detectLanguage` method provides its result via callback or returned as a `Promise` (MV3 only). An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned.
|
|
12162
|
-
*/
|
|
12163
|
-
export function detectLanguage(tabId: number): Promise<string>;
|
|
11880
|
+
export function detectLanguage(tabId: number | undefined, callback: (language: string) => void): void;
|
|
11881
|
+
|
|
12164
11882
|
/**
|
|
12165
11883
|
* Zooms a specified tab.
|
|
12166
|
-
*
|
|
12167
|
-
*
|
|
12168
|
-
* @
|
|
11884
|
+
*
|
|
11885
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11886
|
+
* @param tabId The ID of the tab to zoom; defaults to the active tab of the current window.
|
|
11887
|
+
* @param zoomFactor The new zoom factor. A value of `0` sets the tab to its current default zoom factor. Values greater than 0 specify a (possibly non-default) zoom factor for the tab.
|
|
12169
11888
|
*/
|
|
12170
11889
|
export function setZoom(zoomFactor: number): Promise<void>;
|
|
12171
|
-
|
|
12172
|
-
* Zooms a specified tab.
|
|
12173
|
-
* @since Chrome 42
|
|
12174
|
-
* @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab.
|
|
12175
|
-
* @param callback Optional. Called after the zoom factor has been changed.
|
|
12176
|
-
*/
|
|
11890
|
+
export function setZoom(tabId: number | undefined, zoomFactor: number): Promise<void>;
|
|
12177
11891
|
export function setZoom(zoomFactor: number, callback: () => void): void;
|
|
11892
|
+
export function setZoom(tabId: number | undefined, zoomFactor: number, callback: () => void): void;
|
|
11893
|
+
|
|
12178
11894
|
/**
|
|
12179
|
-
*
|
|
12180
|
-
*
|
|
12181
|
-
*
|
|
12182
|
-
* @param
|
|
12183
|
-
* @return The `setZoom` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12184
|
-
*/
|
|
12185
|
-
export function setZoom(tabId: number, zoomFactor: number): Promise<void>;
|
|
12186
|
-
/**
|
|
12187
|
-
* Zooms a specified tab.
|
|
12188
|
-
* @since Chrome 42
|
|
12189
|
-
* @param tabId Optional. The ID of the tab to zoom; defaults to the active tab of the current window.
|
|
12190
|
-
* @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab.
|
|
12191
|
-
* @param callback Optional. Called after the zoom factor has been changed.
|
|
12192
|
-
*/
|
|
12193
|
-
export function setZoom(tabId: number, zoomFactor: number, callback: () => void): void;
|
|
12194
|
-
/**
|
|
12195
|
-
* Gets the current zoom factor of a specified tab.
|
|
12196
|
-
* @since Chrome 42
|
|
12197
|
-
* @param callback Called with the tab's current zoom factor after it has been fetched.
|
|
12198
|
-
* Parameter zoomFactor: The tab's current zoom factor.
|
|
12199
|
-
*/
|
|
12200
|
-
export function getZoom(callback: (zoomFactor: number) => void): void;
|
|
12201
|
-
/**
|
|
12202
|
-
* Gets the current zoom factor of a specified tab.
|
|
12203
|
-
* @since Chrome 42
|
|
12204
|
-
* @return The `getZoom` method provides its result via callback or returned as a `Promise` (MV3 only). The tab's current zoom factor.
|
|
12205
|
-
*/
|
|
12206
|
-
export function getZoom(): Promise<number>;
|
|
12207
|
-
/**
|
|
12208
|
-
* Gets the current zoom factor of a specified tab.
|
|
12209
|
-
* @since Chrome 42
|
|
12210
|
-
* @param tabId Optional. The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window.
|
|
12211
|
-
* @param callback Called with the tab's current zoom factor after it has been fetched.
|
|
12212
|
-
* Parameter zoomFactor: The tab's current zoom factor.
|
|
12213
|
-
*/
|
|
12214
|
-
export function getZoom(tabId: number, callback: (zoomFactor: number) => void): void;
|
|
12215
|
-
/**
|
|
12216
|
-
* Gets the current zoom factor of a specified tab.
|
|
12217
|
-
* @since Chrome 42
|
|
12218
|
-
* @param tabId Optional. The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window.
|
|
12219
|
-
* @return The `getZoom` method provides its result via callback or returned as a `Promise` (MV3 only). The tab's current zoom factor.
|
|
12220
|
-
*/
|
|
12221
|
-
export function getZoom(tabId: number): Promise<number>;
|
|
12222
|
-
/**
|
|
12223
|
-
* Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
|
|
12224
|
-
* @since Chrome 42
|
|
12225
|
-
* @param zoomSettings Defines how zoom changes are handled and at what scope.
|
|
12226
|
-
* @return The `setZoomSettings` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12227
|
-
*/
|
|
12228
|
-
export function setZoomSettings(zoomSettings: ZoomSettings): Promise<void>;
|
|
12229
|
-
/**
|
|
12230
|
-
* Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
|
|
12231
|
-
* @since Chrome 42
|
|
12232
|
-
* @param zoomSettings Defines how zoom changes are handled and at what scope.
|
|
12233
|
-
* @param callback Optional. Called after the zoom settings have been changed.
|
|
12234
|
-
*/
|
|
12235
|
-
export function setZoomSettings(zoomSettings: ZoomSettings, callback: () => void): void;
|
|
12236
|
-
/**
|
|
12237
|
-
* Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
|
|
12238
|
-
* @since Chrome 42
|
|
12239
|
-
* @param tabId Optional. The ID of the tab to change the zoom settings for; defaults to the active tab of the current window.
|
|
12240
|
-
* @param zoomSettings Defines how zoom changes are handled and at what scope.
|
|
12241
|
-
* @return The `setZoomSettings` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12242
|
-
*/
|
|
12243
|
-
export function setZoomSettings(tabId: number, zoomSettings: ZoomSettings): Promise<void>;
|
|
12244
|
-
/**
|
|
12245
|
-
* Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
|
|
12246
|
-
* @since Chrome 42
|
|
12247
|
-
* @param tabId Optional. The ID of the tab to change the zoom settings for; defaults to the active tab of the current window.
|
|
12248
|
-
* @param zoomSettings Defines how zoom changes are handled and at what scope.
|
|
12249
|
-
* @param callback Optional. Called after the zoom settings have been changed.
|
|
12250
|
-
*/
|
|
12251
|
-
export function setZoomSettings(tabId: number, zoomSettings: ZoomSettings, callback: () => void): void;
|
|
12252
|
-
/**
|
|
12253
|
-
* Gets the current zoom settings of a specified tab.
|
|
12254
|
-
* @since Chrome 42
|
|
12255
|
-
* @param callback Called with the tab's current zoom settings.
|
|
12256
|
-
* Parameter zoomSettings: The tab's current zoom settings.
|
|
12257
|
-
*/
|
|
12258
|
-
export function getZoomSettings(callback: (zoomSettings: ZoomSettings) => void): void;
|
|
12259
|
-
/**
|
|
12260
|
-
* Gets the current zoom settings of a specified tab.
|
|
12261
|
-
* @since Chrome 42
|
|
12262
|
-
* @return The `getZoomSettings` method provides its result via callback or returned as a `Promise` (MV3 only). The tab's current zoom settings.
|
|
12263
|
-
*/
|
|
12264
|
-
export function getZoomSettings(): Promise<ZoomSettings>;
|
|
12265
|
-
/**
|
|
12266
|
-
* Gets the current zoom settings of a specified tab.
|
|
12267
|
-
* @since Chrome 42
|
|
12268
|
-
* @param tabId Optional. The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window.
|
|
12269
|
-
* @param callback Called with the tab's current zoom settings.
|
|
12270
|
-
* Parameter zoomSettings: The tab's current zoom settings.
|
|
11895
|
+
* Gets the current zoom factor of a specified tab.
|
|
11896
|
+
*
|
|
11897
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11898
|
+
* @param tabId The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window.
|
|
12271
11899
|
*/
|
|
12272
|
-
export function
|
|
11900
|
+
export function getZoom(tabId?: number): Promise<number>;
|
|
11901
|
+
export function getZoom(callback: (zoomFactor: number) => void): void;
|
|
11902
|
+
export function getZoom(tabId: number | undefined, callback: (zoomFactor: number) => void): void;
|
|
11903
|
+
|
|
12273
11904
|
/**
|
|
12274
|
-
*
|
|
12275
|
-
*
|
|
12276
|
-
*
|
|
12277
|
-
* @
|
|
11905
|
+
* Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
|
|
11906
|
+
*
|
|
11907
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11908
|
+
* @param tabId The ID of the tab to change the zoom settings for; defaults to the active tab of the current window.
|
|
11909
|
+
* @param zoomSettings Defines how zoom changes are handled and at what scope.
|
|
12278
11910
|
*/
|
|
12279
|
-
export function
|
|
11911
|
+
export function setZoomSettings(zoomSettings: ZoomSettings): Promise<void>;
|
|
11912
|
+
export function setZoomSettings(tabId: number | undefined, zoomSettings: ZoomSettings): Promise<void>;
|
|
11913
|
+
export function setZoomSettings(zoomSettings: ZoomSettings, callback: () => void): void;
|
|
11914
|
+
export function setZoomSettings(
|
|
11915
|
+
tabId: number | undefined,
|
|
11916
|
+
zoomSettings: ZoomSettings,
|
|
11917
|
+
callback: () => void,
|
|
11918
|
+
): void;
|
|
11919
|
+
|
|
12280
11920
|
/**
|
|
12281
|
-
*
|
|
12282
|
-
*
|
|
12283
|
-
*
|
|
12284
|
-
* @
|
|
11921
|
+
* Gets the current zoom settings of a specified tab.
|
|
11922
|
+
*
|
|
11923
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11924
|
+
* @param tabId The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window.
|
|
12285
11925
|
*/
|
|
12286
|
-
export function
|
|
11926
|
+
export function getZoomSettings(tabId?: number): Promise<ZoomSettings>;
|
|
11927
|
+
export function getZoomSettings(callback: (zoomSettings: ZoomSettings) => void): void;
|
|
11928
|
+
export function getZoomSettings(
|
|
11929
|
+
tabId: number | undefined,
|
|
11930
|
+
callback: (zoomSettings: ZoomSettings) => void,
|
|
11931
|
+
): void;
|
|
11932
|
+
|
|
12287
11933
|
/**
|
|
12288
11934
|
* Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated.
|
|
11935
|
+
*
|
|
11936
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11937
|
+
* @param tabId The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist..
|
|
12289
11938
|
* @since Chrome 54
|
|
12290
|
-
* @param tabId Optional. The ID of the tab to be discarded. If specified, the tab will be discarded unless it's active or already discarded. If omitted, the browser will discard the least important tab. This can fail if no discardable tabs exist.
|
|
12291
|
-
* @param callback Called after the operation is completed.
|
|
12292
|
-
*/
|
|
12293
|
-
export function discard(callback: (tab: Tab) => void): void;
|
|
12294
|
-
export function discard(tabId: number, callback: (tab: Tab) => void): void;
|
|
12295
|
-
/**
|
|
12296
|
-
* Go forward to the next page, if one is available.
|
|
12297
|
-
* @since Chrome 72
|
|
12298
|
-
* @return The `goForward` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12299
11939
|
*/
|
|
12300
|
-
export function
|
|
11940
|
+
export function discard(tabId?: number): Promise<Tab | undefined>;
|
|
11941
|
+
export function discard(callback: (tab?: Tab) => void): void;
|
|
11942
|
+
export function discard(tabId: number | undefined, callback: (tab?: Tab) => void): void;
|
|
11943
|
+
|
|
12301
11944
|
/**
|
|
12302
11945
|
* Go forward to the next page, if one is available.
|
|
11946
|
+
*
|
|
11947
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11948
|
+
* @param tabId The ID of the tab to navigate forward; defaults to the selected tab of the current window.
|
|
12303
11949
|
* @since Chrome 72
|
|
12304
|
-
* @param callback Optional. Called after the operation is completed.
|
|
12305
11950
|
*/
|
|
11951
|
+
export function goForward(tabId?: number): Promise<void>;
|
|
12306
11952
|
export function goForward(callback: () => void): void;
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
* @since Chrome 72
|
|
12310
|
-
* @param tabId Optional. The ID of the tab to navigate forward; defaults to the selected tab of the current window.
|
|
12311
|
-
* @return The `goForward` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12312
|
-
*/
|
|
12313
|
-
export function goForward(tabId: number): Promise<void>;
|
|
12314
|
-
/**
|
|
12315
|
-
* Go forward to the next page, if one is available.
|
|
12316
|
-
* @since Chrome 72
|
|
12317
|
-
* @param tabId Optional. The ID of the tab to navigate forward; defaults to the selected tab of the current window.
|
|
12318
|
-
* @param callback Optional. Called after the operation is completed.
|
|
12319
|
-
*/
|
|
12320
|
-
export function goForward(tabId: number, callback: () => void): void;
|
|
12321
|
-
/**
|
|
12322
|
-
* Go back to the previous page, if one is available.
|
|
12323
|
-
* @since Chrome 72
|
|
12324
|
-
* @return The `goBack` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12325
|
-
*/
|
|
12326
|
-
export function goBack(): Promise<void>;
|
|
11953
|
+
export function goForward(tabId: number | undefined, callback: () => void): void;
|
|
11954
|
+
|
|
12327
11955
|
/**
|
|
12328
11956
|
* Go back to the previous page, if one is available.
|
|
11957
|
+
*
|
|
11958
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11959
|
+
* @param tabId The ID of the tab to navigate back; defaults to the selected tab of the current window.
|
|
12329
11960
|
* @since Chrome 72
|
|
12330
|
-
* @param callback Optional. Called after the operation is completed.
|
|
12331
11961
|
*/
|
|
11962
|
+
export function goBack(tabId?: number): Promise<void>;
|
|
12332
11963
|
export function goBack(callback: () => void): void;
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
* @since Chrome 72
|
|
12336
|
-
* @param tabId Optional. The ID of the tab to navigate back; defaults to the selected tab of the current window.
|
|
12337
|
-
* @return The `goBack` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12338
|
-
*/
|
|
12339
|
-
export function goBack(tabId: number): Promise<void>;
|
|
12340
|
-
/**
|
|
12341
|
-
* Go back to the previous page, if one is available.
|
|
12342
|
-
* @since Chrome 72
|
|
12343
|
-
* @param tabId Optional. The ID of the tab to navigate back; defaults to the selected tab of the current window.
|
|
12344
|
-
* @param callback Optional. Called after the operation is completed.
|
|
12345
|
-
*/
|
|
12346
|
-
export function goBack(tabId: number, callback: () => void): void;
|
|
12347
|
-
/**
|
|
12348
|
-
* Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group.
|
|
12349
|
-
* @since Chrome 88
|
|
12350
|
-
* @param options Configurations object
|
|
12351
|
-
* @return The `group` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
12352
|
-
*/
|
|
12353
|
-
export function group(options: GroupOptions): Promise<number>;
|
|
11964
|
+
export function goBack(tabId: number | undefined, callback: () => void): void;
|
|
11965
|
+
|
|
12354
11966
|
/**
|
|
12355
11967
|
* Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group.
|
|
11968
|
+
*
|
|
11969
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
12356
11970
|
* @since Chrome 88
|
|
12357
|
-
* @param options Configurations object
|
|
12358
|
-
* @return The `group` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
12359
11971
|
*/
|
|
12360
11972
|
export function group(options: GroupOptions): Promise<number>;
|
|
12361
|
-
/**
|
|
12362
|
-
* Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group.
|
|
12363
|
-
* @since Chrome 88
|
|
12364
|
-
* @param options Configurations object
|
|
12365
|
-
* @param callback Optional.
|
|
12366
|
-
*/
|
|
12367
11973
|
export function group(options: GroupOptions, callback: (groupId: number) => void): void;
|
|
11974
|
+
|
|
12368
11975
|
/**
|
|
12369
11976
|
* Removes one or more tabs from their respective groups. If any groups become empty, they are deleted
|
|
11977
|
+
*
|
|
11978
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11979
|
+
* @param tabIds The tab ID or list of tab IDs to remove from their respective groups.
|
|
12370
11980
|
* @since Chrome 88
|
|
12371
|
-
* @param tabIds The tabs to ungroup.
|
|
12372
|
-
* @return The `ungroup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
12373
|
-
*/
|
|
12374
|
-
export function ungroup(tabIds: number | number[]): Promise<void>;
|
|
12375
|
-
/**
|
|
12376
|
-
* Removes one or more tabs from their respective groups. If any groups become empty, they are deleted
|
|
12377
|
-
* @since Chrome 88
|
|
12378
|
-
* @param tabIds The tabs to ungroup.
|
|
12379
|
-
* @param callback Optional. Called after the operation is completed.
|
|
12380
|
-
*/
|
|
12381
|
-
export function ungroup(tabIds: number | number[], callback: () => void): void;
|
|
12382
|
-
/**
|
|
12383
|
-
* Fired when the highlighted or selected tabs in a window changes.
|
|
12384
|
-
* @since Chrome 18
|
|
12385
11981
|
*/
|
|
12386
|
-
export
|
|
11982
|
+
export function ungroup(tabIds: number | [number, ...number[]]): Promise<void>;
|
|
11983
|
+
export function ungroup(tabIds: number | [number, ...number[]], callback: () => void): void;
|
|
11984
|
+
|
|
11985
|
+
/** Fired when the highlighted or selected tabs in a window changes */
|
|
11986
|
+
export const onHighlighted: events.Event<
|
|
11987
|
+
(highlightInfo: OnHighlightedInfo) => void
|
|
11988
|
+
>;
|
|
11989
|
+
|
|
12387
11990
|
/** Fired when a tab is closed. */
|
|
12388
|
-
export
|
|
11991
|
+
export const onRemoved: events.Event<
|
|
11992
|
+
(tabId: number, removeInfo: OnRemovedInfo) => void
|
|
11993
|
+
>;
|
|
11994
|
+
|
|
12389
11995
|
/** Fired when a tab is updated. */
|
|
12390
|
-
export
|
|
11996
|
+
export const onUpdated: events.Event<
|
|
11997
|
+
(tabId: number, changeInfo: OnUpdatedInfo, tab: Tab) => void
|
|
11998
|
+
>;
|
|
11999
|
+
|
|
12391
12000
|
/** Fired when a tab is attached to a window, for example because it was moved between windows. */
|
|
12392
|
-
export
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
/**
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
/**
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
export
|
|
12001
|
+
export const onAttached: events.Event<
|
|
12002
|
+
(tabId: number, attachInfo: OnAttachedInfo) => void
|
|
12003
|
+
>;
|
|
12004
|
+
|
|
12005
|
+
/** Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response to the manually-moved tab. This event is not fired when a tab is moved between windows; for details, see {@link tabs.onDetached}. */
|
|
12006
|
+
export const onMoved: events.Event<
|
|
12007
|
+
(tabId: number, moveInfo: OnMovedInfo) => void
|
|
12008
|
+
>;
|
|
12009
|
+
|
|
12010
|
+
/** Fired when a tab is detached from a window; for example, because it was moved between windows. */
|
|
12011
|
+
export const onDetached: events.Event<
|
|
12012
|
+
(tabId: number, detachInfo: OnDetachedInfo) => void
|
|
12013
|
+
>;
|
|
12014
|
+
|
|
12015
|
+
/** Fired when a tab is created. Note that the tab's URL and tab group membership may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set or the tab is added to a tab group. */
|
|
12016
|
+
export const onCreated: events.Event<(tab: Tab) => void>;
|
|
12017
|
+
|
|
12018
|
+
/** Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events so as to be notified when a URL is set */
|
|
12019
|
+
export const onActivated: events.Event<
|
|
12020
|
+
(activeInfo: OnActivatedInfo) => void
|
|
12021
|
+
>;
|
|
12022
|
+
|
|
12023
|
+
/** Fired when a tab is replaced with another tab due to prerendering or instant */
|
|
12024
|
+
export const onReplaced: events.Event<
|
|
12025
|
+
(addedTabId: number, removedTabId: number) => void
|
|
12026
|
+
>;
|
|
12027
|
+
|
|
12411
12028
|
/**
|
|
12412
|
-
* @deprecated since Chrome 33. Please use tabs.onActivated.
|
|
12413
12029
|
* Fires when the selected tab in a window changes.
|
|
12030
|
+
*
|
|
12031
|
+
* MV2 only
|
|
12032
|
+
* @deprecated Please use {@link tabs.onActivated}.
|
|
12414
12033
|
*/
|
|
12415
|
-
export
|
|
12034
|
+
export const onSelectionChanged: events.Event<
|
|
12035
|
+
(tabId: number, selectInfo: OnSelectionChangedInfo) => void
|
|
12036
|
+
>;
|
|
12037
|
+
|
|
12416
12038
|
/**
|
|
12417
|
-
*
|
|
12418
|
-
*
|
|
12039
|
+
* Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to {@link tabs.onUpdated} events so as to be notified when a URL is set.
|
|
12040
|
+
*
|
|
12041
|
+
* MV2 only
|
|
12042
|
+
* @deprecated Please use {@link tabs.onActivated}.
|
|
12419
12043
|
*/
|
|
12420
|
-
export
|
|
12044
|
+
export const onActiveChanged: events.Event<
|
|
12045
|
+
(tabId: number, selectInfo: OnActiveChangedInfo) => void
|
|
12046
|
+
>;
|
|
12047
|
+
|
|
12421
12048
|
/**
|
|
12422
|
-
* @deprecated since Chrome 33. Please use tabs.onHighlighted.
|
|
12423
12049
|
* Fired when the highlighted or selected tabs in a window changes.
|
|
12050
|
+
*
|
|
12051
|
+
* MV2 only
|
|
12052
|
+
* @deprecated Please use {@link tabs.onHighlighted}.
|
|
12424
12053
|
*/
|
|
12425
|
-
export
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
* @since Chrome 38
|
|
12429
|
-
*/
|
|
12430
|
-
export var onZoomChange: TabZoomChangeEvent;
|
|
12054
|
+
export const onHighlightChanged: events.Event<
|
|
12055
|
+
(selectInfo: OnHighlightChangedInfo) => void
|
|
12056
|
+
>;
|
|
12431
12057
|
|
|
12432
|
-
/**
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
export var TAB_ID_NONE: -1;
|
|
12058
|
+
/** Fired when a tab is zoomed */
|
|
12059
|
+
export const onZoomChange: events.Event<
|
|
12060
|
+
(ZoomChangeInfo: OnZoomChangeInfo) => void
|
|
12061
|
+
>;
|
|
12437
12062
|
}
|
|
12438
12063
|
|
|
12439
12064
|
////////////////////
|
|
@@ -12469,6 +12094,11 @@ export namespace Browser {
|
|
|
12469
12094
|
color: `${Color}`;
|
|
12470
12095
|
/** The ID of the group. Group IDs are unique within a browser session. */
|
|
12471
12096
|
id: number;
|
|
12097
|
+
/**
|
|
12098
|
+
* Whether the group is shared.
|
|
12099
|
+
* @since Chrome 137
|
|
12100
|
+
*/
|
|
12101
|
+
shared: boolean;
|
|
12472
12102
|
/** The title of the group. */
|
|
12473
12103
|
title?: string;
|
|
12474
12104
|
/** The ID of the window that contains the group. */
|
|
@@ -12484,13 +12114,18 @@ export namespace Browser {
|
|
|
12484
12114
|
|
|
12485
12115
|
export interface QueryInfo {
|
|
12486
12116
|
/** Whether the groups are collapsed. */
|
|
12487
|
-
collapsed?: boolean;
|
|
12117
|
+
collapsed?: boolean | undefined;
|
|
12488
12118
|
/** The color of the groups. */
|
|
12489
|
-
color?: `${Color}
|
|
12119
|
+
color?: `${Color}` | undefined;
|
|
12120
|
+
/**
|
|
12121
|
+
* Whether the group is shared.
|
|
12122
|
+
* @since Chrome 137
|
|
12123
|
+
*/
|
|
12124
|
+
shared?: boolean | undefined;
|
|
12490
12125
|
/** Match group titles against a pattern. */
|
|
12491
|
-
title?: string;
|
|
12126
|
+
title?: string | undefined;
|
|
12492
12127
|
/** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
|
|
12493
|
-
windowId?: number;
|
|
12128
|
+
windowId?: number | undefined;
|
|
12494
12129
|
}
|
|
12495
12130
|
|
|
12496
12131
|
export interface UpdateProperties {
|
|
@@ -13906,334 +13541,231 @@ export namespace Browser {
|
|
|
13906
13541
|
* Permissions: The Browser.windows API can be used without declaring any permission. However, the "tabs" permission is required in order to populate the url, title, and favIconUrl properties of Tab objects.
|
|
13907
13542
|
*/
|
|
13908
13543
|
export namespace windows {
|
|
13544
|
+
interface WindowsEvent<T extends (...args: any) => void> extends Omit<Browser.events.Event<T>, "addListener"> {
|
|
13545
|
+
addListener(callback: T, filter?: {
|
|
13546
|
+
windowTypes: `${WindowType}`[];
|
|
13547
|
+
}): void;
|
|
13548
|
+
}
|
|
13549
|
+
|
|
13909
13550
|
export interface Window {
|
|
13910
|
-
/**
|
|
13551
|
+
/** Array of {@link tabs.Tab} objects representing the current tabs in the window. */
|
|
13911
13552
|
tabs?: Browser.tabs.Tab[] | undefined;
|
|
13912
|
-
/**
|
|
13553
|
+
/** The offset of the window from the top edge of the screen in pixels. In some circumstances a window may not be assigned a `top` property; for example, when querying closed windows from the {@link sessions} API. */
|
|
13913
13554
|
top?: number | undefined;
|
|
13914
|
-
/**
|
|
13555
|
+
/** The height of the window, including the frame, in pixels. In some circumstances a window may not be assigned a `height` property, for example when querying closed windows from the {@link sessions} API. */
|
|
13915
13556
|
height?: number | undefined;
|
|
13916
|
-
/**
|
|
13557
|
+
/** The width of the window, including the frame, in pixels. In some circumstances a window may not be assigned a `width` property; for example, when querying closed windows from the {@link sessions} API. */
|
|
13917
13558
|
width?: number | undefined;
|
|
13918
|
-
/**
|
|
13919
|
-
|
|
13920
|
-
* @since Chrome 17
|
|
13921
|
-
*/
|
|
13922
|
-
state?: windowStateEnum | undefined;
|
|
13559
|
+
/** The state of this browser window. */
|
|
13560
|
+
state?: `${WindowState}` | undefined;
|
|
13923
13561
|
/** Whether the window is currently the focused window. */
|
|
13924
13562
|
focused: boolean;
|
|
13925
|
-
/**
|
|
13926
|
-
* Whether the window is set to be always on top.
|
|
13927
|
-
* @since Chrome 19
|
|
13928
|
-
*/
|
|
13563
|
+
/** Whether the window is set to be always on top. */
|
|
13929
13564
|
alwaysOnTop: boolean;
|
|
13930
13565
|
/** Whether the window is incognito. */
|
|
13931
13566
|
incognito: boolean;
|
|
13932
|
-
/**
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
type?: windowTypeEnum | undefined;
|
|
13936
|
-
/** Optional. The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be assigned an ID, for example when querying windows using the sessions API, in which case a session ID may be present. */
|
|
13567
|
+
/** The type of browser window this is. */
|
|
13568
|
+
type?: `${WindowType}` | undefined;
|
|
13569
|
+
/** The ID of the window. Window IDs are unique within a browser session. In some circumstances a window may not be assigned an `ID` property; for example, when querying windows using the {@link sessions} API, in which case a session ID may be present. */
|
|
13937
13570
|
id?: number | undefined;
|
|
13938
|
-
/**
|
|
13571
|
+
/** The offset of the window from the left edge of the screen in pixels. In some circumstances a window may not be assigned a `left` property; for example, when querying closed windows from the {@link sessions} API. */
|
|
13939
13572
|
left?: number | undefined;
|
|
13940
|
-
/**
|
|
13941
|
-
* Optional. The session ID used to uniquely identify a Window obtained from the sessions API.
|
|
13942
|
-
* @since Chrome 31
|
|
13943
|
-
*/
|
|
13573
|
+
/** The session ID used to uniquely identify a window, obtained from the {@link sessions} API. */
|
|
13944
13574
|
sessionId?: string | undefined;
|
|
13945
13575
|
}
|
|
13946
13576
|
|
|
13577
|
+
/** @since Chrome 88 */
|
|
13947
13578
|
export interface QueryOptions {
|
|
13948
|
-
/**
|
|
13949
|
-
* Optional.
|
|
13950
|
-
* If true, the windows.Window object will have a tabs property that contains a list of the tabs.Tab objects.
|
|
13951
|
-
* The Tab objects only contain the url, pendingUrl, title and favIconUrl properties if the extension's manifest file includes the "tabs" permission.
|
|
13952
|
-
*/
|
|
13579
|
+
/** If true, the {@link windows.Window} object has a `tabs` property that contains a list of the {@link tabs.Tab} objects. The `Tab` objects only contain the `url`, `pendingUrl`, `title`, and `favIconUrl` properties if the extension's manifest file includes the `"tabs"` permission. */
|
|
13953
13580
|
populate?: boolean | undefined;
|
|
13954
|
-
/**
|
|
13955
|
-
|
|
13956
|
-
*/
|
|
13957
|
-
windowTypes?: windowTypeEnum[] | undefined;
|
|
13581
|
+
/** If set, the {@link windows.Window} returned is filtered based on its type. If unset, the default filter is set to `['normal', 'popup']`. */
|
|
13582
|
+
windowTypes?: `${WindowType}`[] | undefined;
|
|
13958
13583
|
}
|
|
13959
13584
|
|
|
13960
13585
|
export interface CreateData {
|
|
13961
|
-
/**
|
|
13962
|
-
* Optional. The id of the tab for which you want to adopt to the new window.
|
|
13963
|
-
* @since Chrome 10
|
|
13964
|
-
*/
|
|
13586
|
+
/** The ID of the tab to add to the new window. */
|
|
13965
13587
|
tabId?: number | undefined;
|
|
13966
|
-
/**
|
|
13967
|
-
* Optional.
|
|
13968
|
-
* A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.
|
|
13969
|
-
*/
|
|
13588
|
+
/** A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme, e.g., 'http://www.google.com', not 'www.google.com'. Non-fully-qualified URLs are considered relative within the extension. Defaults to the New Tab Page. */
|
|
13970
13589
|
url?: string | string[] | undefined;
|
|
13971
|
-
/**
|
|
13972
|
-
* Optional.
|
|
13973
|
-
* The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels.
|
|
13974
|
-
*/
|
|
13590
|
+
/** The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels. */
|
|
13975
13591
|
top?: number | undefined;
|
|
13976
|
-
/**
|
|
13977
|
-
* Optional.
|
|
13978
|
-
* The height in pixels of the new window, including the frame. If not specified defaults to a natural height.
|
|
13979
|
-
*/
|
|
13592
|
+
/** The height in pixels of the new window, including the frame. If not specified, defaults to a natural height. */
|
|
13980
13593
|
height?: number | undefined;
|
|
13981
|
-
/**
|
|
13982
|
-
* Optional.
|
|
13983
|
-
* The width in pixels of the new window, including the frame. If not specified defaults to a natural width.
|
|
13984
|
-
*/
|
|
13594
|
+
/** The width in pixels of the new window, including the frame. If not specified, defaults to a natural width. */
|
|
13985
13595
|
width?: number | undefined;
|
|
13986
|
-
/**
|
|
13987
|
-
* Optional. If true, opens an active window. If false, opens an inactive window.
|
|
13988
|
-
* @since Chrome 12
|
|
13989
|
-
*/
|
|
13596
|
+
/** If `true`, opens an active window. If `false`, opens an inactive window. */
|
|
13990
13597
|
focused?: boolean | undefined;
|
|
13991
|
-
/**
|
|
13598
|
+
/** Whether the new window should be an incognito window. */
|
|
13992
13599
|
incognito?: boolean | undefined;
|
|
13993
|
-
/**
|
|
13994
|
-
type?:
|
|
13995
|
-
/**
|
|
13996
|
-
* Optional.
|
|
13997
|
-
* The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels.
|
|
13998
|
-
*/
|
|
13600
|
+
/** Specifies what type of browser window to create. */
|
|
13601
|
+
type?: `${CreateType}` | undefined;
|
|
13602
|
+
/** The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels. */
|
|
13999
13603
|
left?: number | undefined;
|
|
14000
13604
|
/**
|
|
14001
|
-
*
|
|
13605
|
+
* The initial state of the window. The `minimized`, `maximized`, and `fullscreen` states cannot be combined with `left`, `top`, `width`, or `height`.
|
|
14002
13606
|
* @since Chrome 44
|
|
14003
13607
|
*/
|
|
14004
|
-
state?:
|
|
13608
|
+
state?: `${WindowState}` | undefined;
|
|
14005
13609
|
/**
|
|
14006
|
-
* If true
|
|
13610
|
+
* If `true`, the newly-created window's 'window.opener' is set to the caller and is in the same [unit of related browsing contexts](https://www.w3.org/TR/html51/browsers.html#unit-of-related-browsing-contexts) as the caller.
|
|
14007
13611
|
* @since Chrome 64
|
|
14008
13612
|
*/
|
|
14009
13613
|
setSelfAsOpener?: boolean | undefined;
|
|
14010
13614
|
}
|
|
14011
13615
|
|
|
14012
13616
|
export interface UpdateInfo {
|
|
14013
|
-
/**
|
|
13617
|
+
/** The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
|
14014
13618
|
top?: number | undefined;
|
|
14015
|
-
/**
|
|
14016
|
-
* Optional. If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request.
|
|
14017
|
-
* @since Chrome 14
|
|
14018
|
-
*/
|
|
13619
|
+
/** If `true`, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to `false` to cancel a previous `drawAttention` request. */
|
|
14019
13620
|
drawAttention?: boolean | undefined;
|
|
14020
|
-
/**
|
|
13621
|
+
/** The height to resize the window to in pixels. This value is ignored for panels. */
|
|
14021
13622
|
height?: number | undefined;
|
|
14022
|
-
/**
|
|
13623
|
+
/** The width to resize the window to in pixels. This value is ignored for panels. */
|
|
14023
13624
|
width?: number | undefined;
|
|
14024
|
-
/**
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
*/
|
|
14028
|
-
state?: windowStateEnum | undefined;
|
|
14029
|
-
/**
|
|
14030
|
-
* Optional. If true, brings the window to the front. If false, brings the next window in the z-order to the front.
|
|
14031
|
-
* @since Chrome 8
|
|
14032
|
-
*/
|
|
13625
|
+
/** The new state of the window. The 'minimized', 'maximized', and 'fullscreen' states cannot be combined with 'left', 'top', 'width', or 'height'. */
|
|
13626
|
+
state?: `${WindowState}` | undefined;
|
|
13627
|
+
/** If `true`, brings the window to the front; cannot be combined with the state 'minimized'. If `false`, brings the next window in the z-order to the front; cannot be combined with the state 'fullscreen' or 'maximized'. */
|
|
14033
13628
|
focused?: boolean | undefined;
|
|
14034
|
-
/**
|
|
13629
|
+
/** The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
|
14035
13630
|
left?: number | undefined;
|
|
14036
13631
|
}
|
|
14037
13632
|
|
|
14038
|
-
export interface WindowEventFilter {
|
|
14039
|
-
/**
|
|
14040
|
-
* Conditions that the window's type being created must satisfy. By default it will satisfy ['app', 'normal', 'panel', 'popup'], with 'app' and 'panel' window types limited to the extension's own windows.
|
|
14041
|
-
*/
|
|
14042
|
-
windowTypes: windowTypeEnum[];
|
|
14043
|
-
}
|
|
14044
|
-
|
|
14045
|
-
export interface WindowIdEvent extends Browser.events.Event<(windowId: number) => void> {
|
|
14046
|
-
addListener(
|
|
14047
|
-
callback: (windowId: number) => void,
|
|
14048
|
-
filters?: WindowEventFilter,
|
|
14049
|
-
): void;
|
|
14050
|
-
}
|
|
14051
|
-
|
|
14052
|
-
export interface WindowReferenceEvent extends Browser.events.Event<(window: Window) => void> {
|
|
14053
|
-
addListener(
|
|
14054
|
-
callback: (window: Window) => void,
|
|
14055
|
-
filters?: WindowEventFilter,
|
|
14056
|
-
): void;
|
|
14057
|
-
}
|
|
14058
|
-
|
|
14059
13633
|
/**
|
|
14060
13634
|
* Specifies what type of browser window to create.
|
|
14061
13635
|
* 'panel' is deprecated and is available only to existing whitelisted extensions on Chrome OS.
|
|
14062
13636
|
* @since Chrome 44
|
|
14063
13637
|
*/
|
|
14064
|
-
export
|
|
13638
|
+
export enum CreateType {
|
|
13639
|
+
/** Specifies the window as a standard window. */
|
|
13640
|
+
NORMAL = "normal",
|
|
13641
|
+
/** Specifies the window as a popup window. */
|
|
13642
|
+
POPUP = "popup",
|
|
13643
|
+
/** @deprecated Specifies the window as a panel. */
|
|
13644
|
+
PANEL = "panel",
|
|
13645
|
+
}
|
|
14065
13646
|
|
|
14066
13647
|
/**
|
|
14067
|
-
* The state of this browser window.
|
|
14068
|
-
* In some circumstances a window may not be assigned a state property; for example, when querying closed windows from the sessions API.
|
|
13648
|
+
* The state of this browser window. In some circumstances a window may not be assigned a `state` property; for example, when querying closed windows from the {@link sessions} API.
|
|
14069
13649
|
* @since Chrome 44
|
|
14070
13650
|
*/
|
|
14071
|
-
export
|
|
13651
|
+
export enum WindowState {
|
|
13652
|
+
/** Normal window state (not minimized, maximized, or fullscreen). */
|
|
13653
|
+
NORMAL = "normal",
|
|
13654
|
+
/** Minimized window state. */
|
|
13655
|
+
MINIMIZED = "minimized",
|
|
13656
|
+
/** Maximized window state. */
|
|
13657
|
+
MAXIMIZED = "maximized",
|
|
13658
|
+
/** Fullscreen window state. */
|
|
13659
|
+
FULLSCREEN = "fullscreen",
|
|
13660
|
+
/** Locked fullscreen window state. This fullscreen state cannot be exited by user action and is available only to allowlisted extensions on Chrome OS. */
|
|
13661
|
+
LOCKED_FULLSCREEN = "locked-fullscreen",
|
|
13662
|
+
}
|
|
14072
13663
|
|
|
14073
13664
|
/**
|
|
14074
|
-
* The type of browser window this is.
|
|
14075
|
-
* In some circumstances a window may not be assigned a type property; for example, when querying closed windows from the sessions API.
|
|
13665
|
+
* The type of browser window this is. In some circumstances a window may not be assigned a `type` property; for example, when querying closed windows from the {@link sessions} API.
|
|
14076
13666
|
* @since Chrome 44
|
|
14077
13667
|
*/
|
|
14078
|
-
export
|
|
13668
|
+
export enum WindowType {
|
|
13669
|
+
/** A normal browser window. */
|
|
13670
|
+
NORMAL = "normal",
|
|
13671
|
+
/** A browser popup. */
|
|
13672
|
+
POPUP = "popup",
|
|
13673
|
+
/** @deprecated A Chrome App panel-style window. Extensions can only see their own panel windows. */
|
|
13674
|
+
PANEL = "panel",
|
|
13675
|
+
/** @deprecated A Chrome App window. Extensions can only see their app own windows. */
|
|
13676
|
+
APP = "app",
|
|
13677
|
+
/** A Developer Tools window. */
|
|
13678
|
+
DEVTOOLS = "devtools",
|
|
13679
|
+
}
|
|
14079
13680
|
|
|
14080
|
-
/**
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
export
|
|
14085
|
-
/**
|
|
14086
|
-
* The windowId value that represents the absence of a chrome browser window.
|
|
14087
|
-
* @since Chrome 6
|
|
14088
|
-
*/
|
|
14089
|
-
export var WINDOW_ID_NONE: -1;
|
|
13681
|
+
/** The windowId value that represents the current window. */
|
|
13682
|
+
export const WINDOW_ID_CURRENT: -2;
|
|
13683
|
+
|
|
13684
|
+
/** The windowId value that represents the absence of a Chrome browser window */
|
|
13685
|
+
export const WINDOW_ID_NONE: -1;
|
|
14090
13686
|
|
|
14091
|
-
/** Gets details about a window. */
|
|
14092
|
-
export function get(windowId: number, callback: (window: Browser.windows.Window) => void): void;
|
|
14093
|
-
/**
|
|
14094
|
-
* Gets details about a window.
|
|
14095
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14096
|
-
*/
|
|
14097
|
-
export function get(windowId: number): Promise<Browser.windows.Window>;
|
|
14098
13687
|
/**
|
|
14099
13688
|
* Gets details about a window.
|
|
14100
|
-
*
|
|
13689
|
+
*
|
|
13690
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14101
13691
|
*/
|
|
13692
|
+
export function get(windowId: number, queryOptions?: QueryOptions): Promise<Window>;
|
|
13693
|
+
export function get(windowId: number, callback: (window: Window) => void): void;
|
|
14102
13694
|
export function get(
|
|
14103
13695
|
windowId: number,
|
|
14104
|
-
queryOptions: QueryOptions,
|
|
14105
|
-
callback: (window:
|
|
13696
|
+
queryOptions: QueryOptions | undefined,
|
|
13697
|
+
callback: (window: Window) => void,
|
|
14106
13698
|
): void;
|
|
14107
|
-
|
|
14108
|
-
* Gets details about a window.
|
|
14109
|
-
* @since Chrome 18
|
|
14110
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14111
|
-
*/
|
|
14112
|
-
export function get(windowId: number, queryOptions: QueryOptions): Promise<Browser.windows.Window>;
|
|
14113
|
-
/** Gets the current window. */
|
|
14114
|
-
export function getCurrent(callback: (window: Browser.windows.Window) => void): void;
|
|
14115
|
-
/**
|
|
14116
|
-
* Gets the current window.
|
|
14117
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14118
|
-
*/
|
|
14119
|
-
export function getCurrent(): Promise<Browser.windows.Window>;
|
|
14120
|
-
/**
|
|
14121
|
-
* Gets the current window.
|
|
14122
|
-
* @param QueryOptions
|
|
14123
|
-
* @since Chrome 18
|
|
14124
|
-
*/
|
|
14125
|
-
export function getCurrent(queryOptions: QueryOptions, callback: (window: Browser.windows.Window) => void): void;
|
|
13699
|
+
|
|
14126
13700
|
/**
|
|
14127
13701
|
* Gets the current window.
|
|
14128
|
-
*
|
|
14129
|
-
*
|
|
14130
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14131
|
-
*/
|
|
14132
|
-
export function getCurrent(queryOptions: QueryOptions): Promise<Browser.windows.Window>;
|
|
14133
|
-
/**
|
|
14134
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
|
14135
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only). Contains details about the created window.
|
|
14136
|
-
*/
|
|
14137
|
-
export function create(): Promise<Browser.windows.Window>;
|
|
14138
|
-
/**
|
|
14139
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
|
14140
|
-
* @param callback
|
|
14141
|
-
* Optional parameter window: Contains details about the created window.
|
|
14142
|
-
*/
|
|
14143
|
-
export function create(callback: (window?: Browser.windows.Window) => void): void;
|
|
14144
|
-
/**
|
|
14145
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
|
14146
|
-
* @param CreateData
|
|
14147
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only). Contains details about the created window.
|
|
14148
|
-
*/
|
|
14149
|
-
export function create(createData: CreateData): Promise<Browser.windows.Window>;
|
|
14150
|
-
/**
|
|
14151
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
|
14152
|
-
* @param CreateData
|
|
14153
|
-
* @param callback
|
|
14154
|
-
* Optional parameter window: Contains details about the created window.
|
|
14155
|
-
*/
|
|
14156
|
-
export function create(createData: CreateData, callback: (window?: Browser.windows.Window) => void): void;
|
|
14157
|
-
/**
|
|
14158
|
-
* Gets all windows.
|
|
14159
|
-
*/
|
|
14160
|
-
export function getAll(callback: (windows: Browser.windows.Window[]) => void): void;
|
|
14161
|
-
/**
|
|
14162
|
-
* Gets all windows.
|
|
14163
|
-
* @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
13702
|
+
*
|
|
13703
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14164
13704
|
*/
|
|
14165
|
-
export function
|
|
13705
|
+
export function getCurrent(queryOptions?: QueryOptions): Promise<Window>;
|
|
13706
|
+
export function getCurrent(callback: (window: Window) => void): void;
|
|
13707
|
+
export function getCurrent(queryOptions: QueryOptions | undefined, callback: (window: Window) => void): void;
|
|
13708
|
+
|
|
14166
13709
|
/**
|
|
14167
|
-
*
|
|
14168
|
-
*
|
|
13710
|
+
* Creates (opens) a new browser window with any optional sizing, position, or default URL provided.
|
|
13711
|
+
*
|
|
13712
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14169
13713
|
*/
|
|
14170
|
-
export function
|
|
13714
|
+
export function create(createData?: CreateData): Promise<Window | undefined>;
|
|
13715
|
+
export function create(callback: (window?: Window) => void): void;
|
|
13716
|
+
export function create(createData: CreateData | undefined, callback: (window?: Window) => void): void;
|
|
13717
|
+
|
|
14171
13718
|
/**
|
|
14172
13719
|
* Gets all windows.
|
|
14173
|
-
*
|
|
14174
|
-
*
|
|
13720
|
+
*
|
|
13721
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14175
13722
|
*/
|
|
14176
|
-
export function getAll(queryOptions
|
|
13723
|
+
export function getAll(queryOptions?: QueryOptions): Promise<Window[]>;
|
|
13724
|
+
export function getAll(callback: (windows: Window[]) => void): void;
|
|
13725
|
+
export function getAll(queryOptions: QueryOptions | undefined, callback: (windows: Window[]) => void): void;
|
|
13726
|
+
|
|
14177
13727
|
/**
|
|
14178
|
-
* Updates the properties of a window. Specify only the properties that
|
|
14179
|
-
*
|
|
13728
|
+
* Updates the properties of a window. Specify only the properties that to be changed; unspecified properties are unchanged.
|
|
13729
|
+
*
|
|
13730
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14180
13731
|
*/
|
|
14181
|
-
export function update(
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
): Promise<Browser.windows.Window>;
|
|
14185
|
-
/** Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged. */
|
|
14186
|
-
export function update(
|
|
14187
|
-
windowId: number,
|
|
14188
|
-
updateInfo: UpdateInfo,
|
|
14189
|
-
callback: (window: Browser.windows.Window) => void,
|
|
14190
|
-
): void;
|
|
13732
|
+
export function update(windowId: number, updateInfo: UpdateInfo): Promise<Window>;
|
|
13733
|
+
export function update(windowId: number, updateInfo: UpdateInfo, callback: (window: Window) => void): void;
|
|
13734
|
+
|
|
14191
13735
|
/**
|
|
14192
|
-
* Removes (closes) a window
|
|
14193
|
-
*
|
|
13736
|
+
* Removes (closes) a window and all the tabs inside it.
|
|
13737
|
+
*
|
|
13738
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14194
13739
|
*/
|
|
14195
13740
|
export function remove(windowId: number): Promise<void>;
|
|
14196
|
-
/** Removes (closes) a window, and all the tabs inside it. */
|
|
14197
13741
|
export function remove(windowId: number, callback: () => void): void;
|
|
13742
|
+
|
|
14198
13743
|
/**
|
|
14199
13744
|
* Gets the window that was most recently focused — typically the window 'on top'.
|
|
13745
|
+
*
|
|
13746
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
14200
13747
|
*/
|
|
14201
|
-
export function getLastFocused(
|
|
14202
|
-
|
|
14203
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
|
14204
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14205
|
-
*/
|
|
14206
|
-
export function getLastFocused(): Promise<Browser.windows.Window>;
|
|
14207
|
-
/**
|
|
14208
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
|
14209
|
-
* @since Chrome 18
|
|
14210
|
-
*/
|
|
13748
|
+
export function getLastFocused(queryOptions?: QueryOptions): Promise<Window>;
|
|
13749
|
+
export function getLastFocused(callback: (window: Window) => void): void;
|
|
14211
13750
|
export function getLastFocused(
|
|
14212
|
-
queryOptions: QueryOptions,
|
|
14213
|
-
callback: (window:
|
|
13751
|
+
queryOptions: QueryOptions | undefined,
|
|
13752
|
+
callback: (window: Window) => void,
|
|
14214
13753
|
): void;
|
|
14215
|
-
/**
|
|
14216
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
|
14217
|
-
* @since Chrome 18
|
|
14218
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
14219
|
-
*/
|
|
14220
|
-
export function getLastFocused(queryOptions: QueryOptions): Promise<Browser.windows.Window>;
|
|
14221
13754
|
|
|
14222
13755
|
/** Fired when a window is removed (closed). */
|
|
14223
|
-
export
|
|
13756
|
+
export const onRemoved: WindowsEvent<(windowId: number) => void>;
|
|
13757
|
+
|
|
14224
13758
|
/** Fired when a window is created. */
|
|
14225
|
-
export
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
*/
|
|
14230
|
-
export var onFocusChanged: WindowIdEvent;
|
|
13759
|
+
export const onCreated: WindowsEvent<(window: Window) => void>;
|
|
13760
|
+
|
|
13761
|
+
/** Fired when the currently focused window changes. Returns `Browser.windows.WINDOW_ID_NONE` if all Chrome windows have lost focus. **Note:** On some Linux window managers, `WINDOW_ID_NONE` is always sent immediately preceding a switch from one Chrome window to another. */
|
|
13762
|
+
export const onFocusChanged: WindowsEvent<(windowId: number) => void>;
|
|
14231
13763
|
|
|
14232
13764
|
/**
|
|
14233
13765
|
* Fired when a window has been resized; this event is only dispatched when the new bounds are committed, and not for in-progress changes.
|
|
14234
13766
|
* @since Chrome 86
|
|
14235
13767
|
*/
|
|
14236
|
-
export
|
|
13768
|
+
export const onBoundsChanged: events.Event<(window: Window) => void>;
|
|
14237
13769
|
}
|
|
14238
13770
|
|
|
14239
13771
|
////////////////////
|