this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

nevermind on glide for now

maybe in the future! not quite there yet

-14021
-13949
glide/glide.d.ts
··· 1 - /* ====================================================== 2 - Glide version: 0.1.51a 3 - ====================================================== */ 4 - 5 - declare const GLIDE_EXCOMMANDS: [ 6 - { 7 - readonly name: "back"; 8 - readonly description: "Go back one page in history"; 9 - readonly content: false; 10 - readonly repeatable: true; 11 - }, 12 - { 13 - readonly name: "forward"; 14 - readonly description: "Go forward one page in history"; 15 - readonly content: false; 16 - readonly repeatable: true; 17 - }, 18 - { 19 - readonly name: "reload"; 20 - readonly description: "Reload the current page"; 21 - readonly content: false; 22 - readonly repeatable: true; 23 - }, 24 - { 25 - readonly name: "reload_hard"; 26 - readonly description: "Reload the current page, bypassing the cache"; 27 - readonly content: false; 28 - readonly repeatable: true; 29 - }, 30 - { 31 - readonly name: "quit"; 32 - readonly description: "Close all windows"; 33 - readonly content: false; 34 - readonly repeatable: false; 35 - }, 36 - { 37 - readonly name: "clear"; 38 - readonly description: "Clear all notifications"; 39 - readonly content: false; 40 - readonly repeatable: false; 41 - }, 42 - { 43 - readonly name: "set"; 44 - readonly description: "Set an option"; 45 - readonly args_schema: { 46 - readonly name: { 47 - readonly type: "string"; 48 - readonly position: 0; 49 - readonly required: true; 50 - }; 51 - readonly value: { 52 - readonly type: "string"; 53 - readonly position: 1; 54 - readonly required: true; 55 - }; 56 - }; 57 - readonly content: false; 58 - readonly repeatable: false; 59 - }, 60 - { 61 - readonly name: "profile_dir"; 62 - readonly description: "Show the current profile directory"; 63 - readonly content: false; 64 - readonly repeatable: false; 65 - }, 66 - { 67 - readonly name: "config_edit"; 68 - readonly description: "Open the config file in the default editor"; 69 - readonly content: false; 70 - readonly repeatable: false; 71 - }, 72 - { 73 - readonly name: "config_path"; 74 - readonly description: "Show the config file path"; 75 - readonly content: false; 76 - readonly repeatable: false; 77 - }, 78 - { 79 - readonly name: "config_reload"; 80 - readonly description: "Reload the config file"; 81 - readonly content: false; 82 - readonly repeatable: false; 83 - }, 84 - { 85 - readonly name: "config_init"; 86 - readonly description: "Initialise a config dir with all the necessary setup"; 87 - readonly args_schema: { 88 - readonly location: { 89 - readonly type: { 90 - readonly enum: readonly [ 91 - "home", 92 - "profile", 93 - "cwd" 94 - ]; 95 - }; 96 - readonly required: false; 97 - readonly position: 0; 98 - }; 99 - }; 100 - readonly content: false; 101 - readonly repeatable: false; 102 - }, 103 - { 104 - readonly name: "css_edit"; 105 - readonly description: "Open the userChrome.css file in the default editor"; 106 - readonly content: false; 107 - readonly repeatable: false; 108 - }, 109 - { 110 - readonly name: "repeat"; 111 - readonly description: "Repeat the last invoked command. In general only applies to \"mutative\" commands"; 112 - readonly content: false; 113 - readonly repeatable: false; 114 - }, 115 - { 116 - readonly name: "map"; 117 - readonly description: "Show all mappings"; 118 - readonly content: false; 119 - readonly repeatable: false; 120 - }, 121 - { 122 - readonly name: "unmap"; 123 - readonly description: "Remove a mapping from normal mode"; 124 - readonly args_schema: { 125 - readonly lhs: { 126 - readonly type: "string"; 127 - readonly required: true; 128 - readonly position: 0; 129 - }; 130 - }; 131 - readonly content: false; 132 - readonly repeatable: false; 133 - }, 134 - { 135 - readonly name: "nunmap"; 136 - readonly description: "Remove a mapping from normal mode"; 137 - readonly args_schema: { 138 - readonly lhs: { 139 - readonly type: "string"; 140 - readonly required: true; 141 - readonly position: 0; 142 - }; 143 - }; 144 - readonly content: false; 145 - readonly repeatable: false; 146 - }, 147 - { 148 - readonly name: "iunmap"; 149 - readonly description: "Remove a mapping from insert mode"; 150 - readonly args_schema: { 151 - readonly lhs: { 152 - readonly type: "string"; 153 - readonly required: true; 154 - readonly position: 0; 155 - }; 156 - }; 157 - readonly content: false; 158 - readonly repeatable: false; 159 - }, 160 - { 161 - readonly name: "tab"; 162 - readonly description: "Switch to the given tab index"; 163 - readonly args_schema: { 164 - readonly tab_index: { 165 - readonly type: "integer"; 166 - readonly required: true; 167 - readonly position: 0; 168 - }; 169 - }; 170 - readonly content: false; 171 - readonly repeatable: false; 172 - }, 173 - { 174 - readonly name: "tab_new"; 175 - readonly description: "Create a new tab with the given URL or the default new tab page if not provided"; 176 - readonly args_schema: { 177 - readonly url: { 178 - readonly type: "string"; 179 - readonly required: false; 180 - readonly position: 0; 181 - }; 182 - }; 183 - readonly content: false; 184 - readonly repeatable: false; 185 - }, 186 - { 187 - readonly name: "tab_close"; 188 - readonly description: "Close the current tab"; 189 - readonly content: false; 190 - readonly repeatable: true; 191 - }, 192 - { 193 - readonly name: "tab_next"; 194 - readonly description: "Switch to the next tab, wrapping around if applicable"; 195 - readonly content: false; 196 - readonly repeatable: true; 197 - }, 198 - { 199 - readonly name: "tab_prev"; 200 - readonly description: "Switch to the previous tab, wrapping around if applicable"; 201 - readonly content: false; 202 - readonly repeatable: true; 203 - }, 204 - { 205 - readonly name: "commandline_show"; 206 - readonly description: "Show the commandline UI"; 207 - readonly content: false; 208 - readonly args_schema: {}; 209 - readonly repeatable: false; 210 - }, 211 - { 212 - readonly name: "commandline_toggle"; 213 - readonly description: "Toggle the commandline UI"; 214 - readonly content: false; 215 - readonly args_schema: {}; 216 - readonly repeatable: false; 217 - }, 218 - { 219 - readonly name: "commandline_focus_next"; 220 - readonly description: "Focus the next completion in the commandline"; 221 - readonly content: false; 222 - readonly args_schema: {}; 223 - readonly repeatable: false; 224 - }, 225 - { 226 - readonly name: "commandline_focus_back"; 227 - readonly description: "Focus the previous completion in the commandline"; 228 - readonly content: false; 229 - readonly args_schema: {}; 230 - readonly repeatable: false; 231 - }, 232 - { 233 - readonly name: "commandline_delete"; 234 - readonly description: "Delete the focused commandline completion"; 235 - readonly content: false; 236 - readonly args_schema: {}; 237 - readonly repeatable: false; 238 - }, 239 - { 240 - readonly name: "commandline_accept"; 241 - readonly description: "Accept the focused commandline completion"; 242 - readonly content: false; 243 - readonly args_schema: {}; 244 - readonly repeatable: false; 245 - }, 246 - { 247 - readonly name: "url_yank"; 248 - readonly description: "Yank the URL of the current tab to the clipboard"; 249 - readonly content: false; 250 - readonly repeatable: false; 251 - }, 252 - { 253 - readonly name: "echo"; 254 - readonly description: "Log the given arguments to the console"; 255 - readonly content: false; 256 - readonly args_schema: {}; 257 - readonly repeatable: false; 258 - }, 259 - { 260 - readonly name: "mode_change"; 261 - readonly description: "Change the current mode"; 262 - readonly content: false; 263 - readonly repeatable: false; 264 - readonly args_schema: { 265 - readonly mode: { 266 - readonly type: { 267 - readonly enum: GlideMode[]; 268 - }; 269 - readonly required: true; 270 - readonly position: 0; 271 - }; 272 - readonly "--automove": { 273 - readonly type: { 274 - readonly enum: readonly [ 275 - "left", 276 - "endline" 277 - ]; 278 - }; 279 - readonly required: false; 280 - }; 281 - readonly "--operator": { 282 - readonly type: { 283 - readonly enum: readonly [ 284 - "d", 285 - "c", 286 - "r" 287 - ]; 288 - }; 289 - readonly required: false; 290 - readonly description: "Only applicable for operator-pending mode"; 291 - }; 292 - }; 293 - }, 294 - { 295 - readonly name: "caret_move"; 296 - readonly description: "Move the text caret"; 297 - readonly content: false; 298 - readonly repeatable: false; 299 - readonly args_schema: { 300 - readonly direction: { 301 - readonly type: { 302 - readonly enum: readonly [ 303 - "left", 304 - "right", 305 - "up", 306 - "down" 307 - ]; 308 - }; 309 - readonly required: true; 310 - readonly position: 0; 311 - }; 312 - }; 313 - }, 314 - { 315 - readonly name: "visual_selection_copy"; 316 - readonly description: "Copy the currently selected text to the clipboard & change to normal mode"; 317 - readonly content: false; 318 - readonly repeatable: false; 319 - }, 320 - { 321 - readonly name: "help"; 322 - readonly description: "Open the docs"; 323 - readonly content: false; 324 - readonly repeatable: false; 325 - }, 326 - { 327 - readonly name: "tutor"; 328 - readonly description: "Open the Glide tutorial"; 329 - readonly content: false; 330 - readonly repeatable: false; 331 - }, 332 - { 333 - readonly name: "repl"; 334 - readonly description: "Start the config REPL"; 335 - readonly content: false; 336 - readonly repeatable: false; 337 - }, 338 - { 339 - readonly name: "keys"; 340 - readonly description: "Synthesize the given key sequence as if they were actually pressed"; 341 - readonly args_schema: { 342 - readonly keyseq: { 343 - readonly type: "string"; 344 - readonly required: true; 345 - readonly position: 0; 346 - }; 347 - }; 348 - readonly content: false; 349 - readonly repeatable: false; 350 - }, 351 - { 352 - readonly name: "r"; 353 - readonly description: "Replace the current character"; 354 - readonly content: false; 355 - readonly repeatable: false; 356 - readonly args_schema: { 357 - readonly character: { 358 - readonly type: "string"; 359 - readonly required: false; 360 - readonly position: 0; 361 - }; 362 - }; 363 - }, 364 - { 365 - readonly name: "scroll_top"; 366 - readonly description: "Scroll to the top of the window"; 367 - readonly content: true; 368 - readonly repeatable: false; 369 - }, 370 - { 371 - readonly name: "scroll_page_down"; 372 - readonly description: "Scroll down by 1 page (the size of the viewport)"; 373 - readonly content: true; 374 - readonly repeatable: false; 375 - }, 376 - { 377 - readonly name: "scroll_page_up"; 378 - readonly description: "Scroll up by 1 page (the size of the viewport)"; 379 - readonly content: true; 380 - readonly repeatable: false; 381 - }, 382 - { 383 - readonly name: "scroll_bottom"; 384 - readonly description: "Scroll to the bottom of the window"; 385 - readonly content: true; 386 - readonly repeatable: false; 387 - }, 388 - { 389 - readonly name: "blur"; 390 - readonly description: "Blur the active element"; 391 - readonly content: true; 392 - readonly repeatable: false; 393 - }, 394 - { 395 - readonly name: "focusinput"; 396 - readonly description: "Focus an input element based on the given filter"; 397 - readonly content: true; 398 - readonly repeatable: false; 399 - readonly args_schema: { 400 - readonly filter: { 401 - readonly type: { 402 - readonly enum: readonly [ 403 - "last" 404 - ]; 405 - }; 406 - readonly required: true; 407 - readonly position: 0; 408 - }; 409 - }; 410 - }, 411 - { 412 - readonly name: "hint"; 413 - readonly description: "Show hint labels for jumping to clickable elements"; 414 - readonly content: false; 415 - readonly repeatable: false; 416 - readonly args_schema: { 417 - readonly "-s": { 418 - readonly type: "string"; 419 - readonly required: false; 420 - readonly description: "*Only* show hints for all elements matching this CSS selector"; 421 - }; 422 - readonly "--include": { 423 - readonly type: "string"; 424 - readonly required: false; 425 - readonly description: "*Also* show hints for all elements matching this CSS selector"; 426 - }; 427 - readonly "-e": { 428 - readonly type: "boolean"; 429 - readonly required: false; 430 - readonly description: "*Only* show hints for all elements that are editable"; 431 - }; 432 - readonly "--auto": { 433 - readonly type: "boolean"; 434 - readonly required: false; 435 - readonly description: "If only one hint is generated, automatically activate it."; 436 - }; 437 - readonly "--action": { 438 - readonly type: { 439 - readonly enum: readonly [ 440 - "click", 441 - "newtab-click" 442 - ]; 443 - }; 444 - readonly required: false; 445 - }; 446 - readonly "--location": { 447 - readonly type: { 448 - readonly enum: readonly [ 449 - "content", 450 - "browser-ui" 451 - ]; 452 - }; 453 - readonly required: false; 454 - }; 455 - }; 456 - }, 457 - { 458 - readonly name: "hints_remove"; 459 - readonly description: "Remove all hint labels and exit hint mode"; 460 - readonly content: false; 461 - readonly repeatable: false; 462 - }, 463 - { 464 - readonly name: "execute_motion"; 465 - readonly description: "Used from op-pending mode to execute a motion."; 466 - readonly content: true; 467 - readonly repeatable: false; 468 - }, 469 - { 470 - readonly name: "motion"; 471 - readonly description: "Execute a given motion (internal)"; 472 - readonly content: true; 473 - readonly repeatable: false; 474 - readonly args_schema: { 475 - readonly keyseq: { 476 - readonly type: { 477 - readonly enum: readonly [ 478 - "w", 479 - "W", 480 - "e", 481 - "b", 482 - "B", 483 - "0", 484 - "$", 485 - "{", 486 - "}", 487 - "s", 488 - "v", 489 - "vh", 490 - "vl", 491 - "vd", 492 - "vc", 493 - "x", 494 - "X", 495 - "o" 496 - ]; 497 - }; 498 - readonly required: true; 499 - readonly position: 0; 500 - }; 501 - }; 502 - }, 503 - { 504 - readonly name: "undo"; 505 - readonly description: "Undo the most recent edit"; 506 - readonly content: false; 507 - readonly repeatable: false; 508 - }, 509 - { 510 - readonly name: "redo"; 511 - readonly description: "Redo the most recent undo"; 512 - readonly content: false; 513 - readonly repeatable: false; 514 - } 515 - ]; 516 - export type GlideExcmdName = (typeof GLIDE_EXCOMMANDS)[number]["name"]; 517 - export type GlideCommandString = GlideExcmdName | `${GlideExcmdName} ${string}`; 518 - // This Source Code Form is subject to the terms of the Mozilla Public 519 - // License, v. 2.0. If a copy of the MPL was not distributed with this 520 - // file, You can obtain one at http://mozilla.org/MPL/2.0/. 521 - declare global { 522 - var glide: { 523 - ctx: { 524 - /** 525 - * The currently active mode. 526 - */ 527 - mode: GlideMode; 528 - /** 529 - * The URL of the currently focused tab. 530 - */ 531 - url: URL; 532 - /** 533 - * The operating system Glide is running on. 534 - */ 535 - os: "linux" | "win" | "macosx" | "ios" | "android" | "other"; 536 - /** 537 - * Whether or not the currently focused element is editable. 538 - * 539 - * This includes but is not limited to `html:<textarea>`, `html:<input>`, `contenteditable=true`. 540 - */ 541 - is_editing(): Promise<boolean>; 542 - }; 543 - /** 544 - * Set browser-wide options. 545 - */ 546 - /// @docs-expand-type-reference 547 - o: glide.Options; 548 - /** 549 - * Set buffer specific options. 550 - * 551 - * This has the exact same API as {@link glide.o}. 552 - */ 553 - bo: Partial<glide.Options>; 554 - options: { 555 - /** 556 - * Returns either a buffer-specific option, or the global version. In that order 557 - */ 558 - get<Name extends keyof glide.Options>(name: Name): glide.Options[Name]; 559 - }; 560 - env: { 561 - /** 562 - * Get the value of an environment variable. 563 - * 564 - * If it does not exist `null` is returned. 565 - */ 566 - get(name: string): string | null; 567 - /** 568 - * Set the value of an environment variable. 569 - */ 570 - set(name: string, value: string): void; 571 - /** 572 - * Remove an environment variable. 573 - * 574 - * Does *not* error if the environment variable did not already exist. 575 - * 576 - * Returns the value of the deleted environment variable, if it did not exist `null` is returned. 577 - */ 578 - delete(name: string): string | null; 579 - }; 580 - process: { 581 - /** 582 - * Spawn a new process. The given `command` can either be the name of a binary in the `PATH` 583 - * or an absolute path to a binary file. 584 - * 585 - * If the process exits with a non-zero code, an error will be thrown, you can disable this check with `{ check_exit_code: false }`. 586 - * 587 - * ```ts 588 - * const proc = await glide.process.spawn('kitty', ['nvim', 'glide.ts'], { cwd: '~/.dotfiles/glide' }); 589 - * console.log('opened kitty with pid', proc.pid); 590 - * ``` 591 - */ 592 - spawn(command: string, args?: string[] | null | undefined, opts?: glide.SpawnOptions): Promise<glide.Process>; 593 - /** 594 - * Spawn a new process and wait for it to exit. 595 - * 596 - * See {@link glide.process.spawn} for more information. 597 - */ 598 - execute(command: string, args?: string[] | null | undefined, opts?: glide.SpawnOptions): Promise<glide.CompletedProcess>; 599 - }; 600 - autocmds: { 601 - /** 602 - * Create an autocmd that will be invoked whenever the focused URL changes. 603 - * 604 - * This includes: 605 - * 1. URL changes within the same tab 606 - * 2. Switching tabs 607 - * 3. Navigating back and forth in history within the same tab 608 - */ 609 - create<const Event extends "UrlEnter">(event: Event, pattern: glide.AutocmdPatterns[Event], callback: (args: glide.AutocmdArgs[Event]) => void): void; 610 - /** 611 - * Create an autocmd that will be invoked whenever the mode changes. 612 - * 613 - * The pattern is matched against `old_mode:new_mode`. You can also use `*` as a placeholder 614 - * to match *any* mode. 615 - * 616 - * for example, to define an autocmd that will be fired every time visual mode is entered: 617 - * 618 - * `*:visual` 619 - * 620 - * or when visual mode is left: 621 - * 622 - * `visual:*` 623 - * 624 - * or transitioning from visual to insert: 625 - * 626 - * `visual:insert` 627 - * 628 - * or for just any mode: 629 - * 630 - * `*` 631 - */ 632 - create<const Event extends "ModeChanged">(event: Event, pattern: glide.AutocmdPatterns[Event], callback: (args: glide.AutocmdArgs[Event]) => void): void; 633 - /** 634 - * Create an autocmd that will be invoked whenever the key sequence changes. 635 - * 636 - * This will be fired under four circumstances: 637 - * 638 - * 1. A key is pressed that matches a key mapping. 639 - * 2. A key is pressed that is part of a key mapping. 640 - * 3. A key is pressed that cancels a previous partial key mapping sequence. 641 - * 4. A partial key mapping is cancelled (see {@link glide.o.mapping_timeout}) 642 - * 643 - * For example, with 644 - * ```typescript 645 - * glide.keymaps.set('normal', 'gt', '...'); 646 - * ``` 647 - * 648 - * Pressing `g` will fire with `{ sequence: ["g"], partial: true }`, then either: 649 - * - Pressing `t` would fire `{ sequence: ["g", "t"], partial: false }` 650 - * - Pressing any other key would fire `{ sequence: [], partial: false }` 651 - * 652 - * Note that this is not fired for consecutive key presses for keys that don't correspond to mappings, 653 - * as the key state has not changed. 654 - */ 655 - create<const Event extends "KeyStateChanged">(event: Event, callback: (args: glide.AutocmdArgs[Event]) => void): void; 656 - /** 657 - * Create an autocmd that will be invoked whenever the config is loaded. 658 - * 659 - * Called once on initial load and again every time the config is reloaded. 660 - */ 661 - create<const Event extends "ConfigLoaded">(event: Event, callback: (args: glide.AutocmdArgs[Event]) => void): void; 662 - /** 663 - * Create an autocmd that will be invoked when the window is initially loaded. 664 - * 665 - * **note**: this is not invoked when the config is reloaded. 666 - */ 667 - create<const Event extends "WindowLoaded">(event: Event, callback: (args: glide.AutocmdArgs[Event]) => void): void; 668 - create<const Event extends glide.AutocmdEvent>(event: Event, pattern: glide.AutocmdPatterns[Event] extends never ? (args: glide.AutocmdArgs[Event]) => void : glide.AutocmdPatterns[Event], callback?: (args: glide.AutocmdArgs[Event]) => void): void; 669 - }; 670 - prefs: { 671 - /** 672 - * Set a preference. This is an alternative to `prefs.js` / [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox) so 673 - * that all customisation can be represented in a single `glide.ts` file. 674 - * 675 - * **warning**: this function is expected to be called at the top-level of your config, there is no guarantee that calling {@link glide.prefs.set} in callbacks 676 - * will result in the pref being properly applied everywhere. 677 - * 678 - * **warning**: there is also no guarantee that these settings will be applied when first loaded, sometimes a restart is required. 679 - */ 680 - set(name: string, value: string | number | boolean): void; 681 - /** 682 - * Get the value of a pref. 683 - * 684 - * If the pref is not defined, then `undefined` is returned. 685 - */ 686 - get(name: string): string | number | boolean | undefined; 687 - /** 688 - * Reset the pref value back to its default. 689 - */ 690 - clear(name: string): void; 691 - }; 692 - /** 693 - * Equivalent to `vim.g`. 694 - * 695 - * You can also store arbitrary data here in a typesafe fashion with: 696 - * ```ts 697 - * declare global { 698 - * interface GlideGlobals { 699 - * my_prop?: boolean; 700 - * } 701 - * } 702 - * glide.g.my_prop = true; 703 - * ``` 704 - */ 705 - /// @docs-expand-type-reference 706 - g: GlideGlobals; 707 - tabs: { 708 - /** 709 - * Returns the active tab for the currently focused window. 710 - * 711 - * This is equivalent to: 712 - * ```ts 713 - * const tab = await browser.tabs.query({ active: true, currentWindow: true })[0]; 714 - * ``` 715 - * But with additional error handling for invalid states. 716 - */ 717 - active(): Promise<glide.TabWithID>; 718 - /** 719 - * Find the first tab matching the given query filter. 720 - * 721 - * This is the same API as [browser.tabs.get](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/get), 722 - * but returns the first tab instead of an Array. 723 - */ 724 - get_first(query: Browser.Tabs.QueryQueryInfoType): Promise<Browser.Tabs.Tab | undefined>; 725 - }; 726 - excmds: { 727 - /** 728 - * Execute an excmd, this is the same as typing `:cmd --args`. 729 - */ 730 - execute(cmd: glide.ExcmdString): Promise<void>; 731 - /** 732 - * Create a new excmd. 733 - * 734 - * e.g. 735 - * ```typescript 736 - * const cmd = glide.excmds.create( 737 - * { name: "my_excmd", description: "..." }, 738 - * () => { 739 - * // ... 740 - * } 741 - * ); 742 - * declare global { 743 - * interface ExcmdRegistry { 744 - * my_excmd: typeof cmd; 745 - * } 746 - * } 747 - * ``` 748 - */ 749 - create<const Excmd extends glide.ExcmdCreateProps>(info: Excmd, fn: (props: glide.ExcmdCallbackProps) => void | Promise<void>): Excmd; 750 - }; 751 - content: { 752 - /** 753 - * Execute a function in the content process for the given tab. 754 - * 755 - * The given function will be stringified before being sent across processes, which 756 - * means it **cannot** capture any outside variables. 757 - * 758 - * If you need to pass some context into the function, use `args`, e.g. 759 - * 760 - * ```ts 761 - * function set_body_border_style(css: string) { 762 - * document.body.style.setProperty('border', css) 763 - * } 764 - * await glide.content.execute(set_body_border_style, { tab_id, args: ["20px dotted pink"] }) 765 - * ``` 766 - * 767 - * Note: all `args` must be JSON serialisable. 768 - */ 769 - execute<F extends (...args: any[]) => any>(func: F, opts: { 770 - /** 771 - * The ID of the tab into which to inject. 772 - * 773 - * Or the tab object as returned by {@link glide.tabs.active}. 774 - */ 775 - tab_id: number | glide.TabWithID; 776 - } & (Parameters<F> extends [ 777 - ] ? { 778 - /** 779 - * Note: the given function doesn't take any arguments but if 780 - * it did, you could pass them here. 781 - */ 782 - args?: undefined; 783 - } : { 784 - /** 785 - * Arguments to pass to the given function. 786 - * 787 - * **Must** be JSON serialisable 788 - */ 789 - args: Parameters<F>; 790 - })): Promise<ReturnType<F>>; 791 - }; 792 - keymaps: { 793 - set<const LHS>(modes: GlideMode | GlideMode[], lhs: $keymapcompletions.T<LHS>, rhs: glide.ExcmdString | glide.KeymapCallback, opts?: glide.KeymapOpts | undefined): void; 794 - /** 795 - * Remove the mapping of {lhs} for the {modes} where the map command applies. 796 - * 797 - * The mapping may remain defined for other modes where it applies. 798 - */ 799 - del<const LHS>(modes: GlideMode | GlideMode[], lhs: $keymapcompletions.T<LHS>, opts?: glide.KeymapDeleteOpts): void; 800 - /** 801 - * List all global key mappings. 802 - * 803 - * If a key mapping is defined for multiple modes, multiple entries 804 - * will be returned for each mode. 805 - */ 806 - list(modes?: GlideMode | GlideMode[]): glide.Keymap[]; 807 - }; 808 - hints: { 809 - /** 810 - * Find and show hints for "clickable" elements in the content frame. 811 - * 812 - * An optional `action()` function can be passed that will be invoked when 813 - * a hint is selected. 814 - */ 815 - show(opts?: { 816 - /** 817 - * *Only* show hints for all elements matching this [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors). 818 - * 819 - * @example "li, textarea" 820 - * @example "[id="my-element"]" 821 - */ 822 - selector?: string; 823 - /** 824 - * *Also* show hints for all elements matching this [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors) 825 - * as well as the default set of [hintable elements](https://glide-browser.app/hints#hintable-elements). 826 - * 827 - * @example "li, textarea" 828 - * @example "[id="my-element"]" 829 - */ 830 - include?: string; 831 - /** 832 - * *Only* show hints for elements that are editable. 833 - */ 834 - editable?: boolean; 835 - /** 836 - * If only one hint is generated, automatically activate it. 837 - * 838 - * @default false 839 - */ 840 - auto_activate?: boolean; 841 - /** 842 - * Callback invoked when the selected hint is chosen. 843 - * 844 - * This is executed in the content process. 845 - */ 846 - action?: "click" | "newtab-click" | ((target: HTMLElement) => Promise<void>); 847 - /** 848 - * Which area to generate hints for. 849 - * 850 - * - `content` - Show hints for clickable elements within the web page (links, buttons, etc.) 851 - * - `chrome` - Show hints for browser interface elements (toolbar buttons, tabs, menus, etc.) 852 - * 853 - * @default "content" 854 - */ 855 - location?: glide.HintLocation; 856 - /** 857 - * Define a callback to filter the resolved hints. It is called once with the resolved hints, 858 - * and must return an array of the hints you want to include. 859 - * 860 - * An empty array may be returned but will result in an error notification indicating that no 861 - * hints were found. 862 - * 863 - * @content this function is evaluated in the content process. 864 - */ 865 - pick?: (hints: glide.ContentHint[]) => glide.ContentHint[]; 866 - }): void; 867 - }; 868 - buf: { 869 - prefs: { 870 - /** 871 - * Set a preference for the current buffer. When navigating to a new buffer, the pref will be reset 872 - * to the previous value. 873 - * 874 - * See {@link glide.prefs.set} for more information. 875 - */ 876 - set(name: string, value: string | number | boolean): void; 877 - }; 878 - keymaps: { 879 - set<const LHS>(modes: GlideMode | GlideMode[], lhs: $keymapcompletions.T<LHS>, rhs: glide.ExcmdString | glide.KeymapCallback, opts?: Omit<glide.KeymapOpts, "buffer"> | undefined): void; 880 - /** 881 - * Remove the mapping of {lhs} for the {modes} where the map command applies. 882 - * 883 - * The mapping may remain defined for other modes where it applies. 884 - */ 885 - del(modes: GlideMode | GlideMode[], lhs: string, opts?: Omit<glide.KeymapDeleteOpts, "buffer"> | undefined): void; 886 - }; 887 - }; 888 - keys: { 889 - /** 890 - * Send a key sequence to the browser, simulating physical key presses. 891 - * 892 - * The key sequence can include multiple regular keys, special keys, and modifiers. 893 - * 894 - * For example: 895 - * 896 - * ```ts 897 - * // Send a simple key sequence, each char is sent separately 898 - * await glide.keys.send("hello"); 899 - * 900 - * // Send with modifiers, results in two events 901 - * // - { ctrlKey: true, key: 'a' } 902 - * // - { ctrlKey: true, key: 'c' } 903 - * await glide.keys.send("<C-a><C-c>"); 904 - * ``` 905 - */ 906 - send<const Keys>(keyseq: $keymapcompletions.T<Keys> | { 907 - glide_key: string; 908 - }, opts?: glide.KeySendOptions): Promise<void>; 909 - /** 910 - * Returns a `Promise` that resolves to a {@link glide.KeyEvent} when the next key is pressed. 911 - * 912 - * This also prevents the key input from being processed further and does *not* invoke any associated mappings. 913 - * 914 - * If you *want* to inspect keys without preventing any default behaviour, you can use {@link glide.keys.next_passthrough}. 915 - * 916 - * Note: there can only be one `Promise` registered at any given time. 917 - * 918 - * Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve 919 - * until another key is pressed, e.g. `<C-a>`. 920 - */ 921 - next(): Promise<glide.KeyEvent>; 922 - /** 923 - * Returns a `Promise` that resolves to a {@link glide.KeyEvent} when the next key is pressed. 924 - * 925 - * Unlike {@link glide.keys.next}, this does not prevent key events from passing through into their original behaviour. 926 - * 927 - * Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve 928 - * until another key is pressed, e.g. `<C-a>`. 929 - */ 930 - next_passthrough(): Promise<glide.KeyEvent>; 931 - /** 932 - * Returns a `Promise` that resolves to a string representation of the key, when the next key is pressed. 933 - * 934 - * This also prevents the key input from being processed further and does *not* invoke any associated mappings. 935 - * 936 - * If you *want* to inspect keys without preventing any default behaviour, you can use {@link glide.keys.next_passthrough}. 937 - * 938 - * Note: there can only be one `Promise` registered at any given time. 939 - * 940 - * Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve 941 - * until another key is pressed, e.g. `<C-a>`. 942 - * 943 - * @example 'd' 944 - * @example '<C-l>' 945 - */ 946 - next_str(): Promise<string>; 947 - /** 948 - * Parse a single key notation into a structured object. 949 - * 950 - * This normalises special keys to be consistent but otherwise the 951 - * parsed object only containers modifiers that were in the input string. 952 - * 953 - * Shifted keys are *not* special cased, the returned key is whatever was given 954 - * in in the input. 955 - * 956 - * @example "<Space>" -> { key: "<Space>" } 957 - * @example "H" -> { key: "H" } 958 - * @example "<S-h>" -> { key: "h", shift: true } 959 - * @example "<S-H>" -> { key: "H", shift: true } 960 - * @example "<C-S-a>" -> { key: "A", shift: true, ctrl: true } 961 - * @example "<M-a>" -> { key: "a", meta: true } 962 - */ 963 - parse(key_notation: string): glide.KeyNotation; 964 - }; 965 - unstable: { 966 - /** 967 - * Include another file as part of your config. The given file is evluated as if it 968 - * was just another Glide config file. 969 - * 970 - * **note**: this only supports files that are directly relative to your config file, 971 - * for example, `ts:"shared.glide.ts"` or `ts:"shared/glide.ts"` would work but 972 - * `ts:"../shared/glide.ts"` will not. 973 - * 974 - * **note**: this function cannot be called from inside a file that has been included 975 - * itself, i.e. nested {@link glide.unstable.include} calls are not supported. 976 - * 977 - * @example glide.unstable.include("shared.glide.ts") 978 - */ 979 - include(path: string): Promise<void>; 980 - }; 981 - path: { 982 - readonly cwd: string; 983 - readonly home_dir: string; 984 - readonly temp_dir: string; 985 - readonly profile_dir: string; 986 - /** 987 - * Join all arguments together and normalize the resulting path. 988 - * 989 - * Throws an error on non-relative paths. 990 - */ 991 - join(...parts: string[]): string; 992 - }; 993 - fs: { 994 - /** 995 - * Read the file at the given path. 996 - * 997 - * Relative paths are resolved relative to the config directory, if no config directory is defined then relative 998 - * paths are not allowed. 999 - * 1000 - * The `encoding` must currently be set to `"utf8"` as that is the only supported encoding. 1001 - * 1002 - * @example await glide.fs.read("github.css", "utf8"); 1003 - */ 1004 - read(path: string, encoding: "utf8"): Promise<string>; 1005 - /** 1006 - * Write to the file at the given path. 1007 - * 1008 - * Relative paths are resolved relative to the config directory, if no config directory is defined then relative 1009 - * paths are not allowed. 1010 - * 1011 - * If the path has parent directories that do not exist, they will be created. 1012 - * 1013 - * The `contents` are written in utf8. 1014 - * 1015 - * @example await glide.fs.write("github.css", ".copilot { display: none !important }"); 1016 - */ 1017 - write(path: string, contents: string): Promise<void>; 1018 - /** 1019 - * Determine if the given path exists. 1020 - * 1021 - * Relative paths are resolved relative to the config directory, if no config directory is defined then relative 1022 - * paths are not allowed. 1023 - * 1024 - * @example await glide.fs.exists(`${glide.path.home_dir}/.config/foo`); 1025 - */ 1026 - exists(path: string): Promise<boolean>; 1027 - /** 1028 - * Obtain information about a file, such as size, modification dates, etc. 1029 - * 1030 - * Relative paths are resolved relative to the config directory, if no config directory is defined then relative 1031 - * paths are not allowed. 1032 - * 1033 - * ```ts 1034 - * const stat = await glide.fs.stat('userChrome.css'); 1035 - * stat.last_modified // 1758835015092 1036 - * stat.type // "file" 1037 - * ``` 1038 - */ 1039 - stat(path: string): Promise<glide.FileInfo>; 1040 - }; 1041 - messengers: { 1042 - /** 1043 - * Create a {@link glide.ParentMessenger} that can be used to communicate with the content process. 1044 - * 1045 - * Communication is currently uni-directional, the content process can communicate with the main 1046 - * process, but not the other way around. 1047 - * 1048 - * Sending and receiving messages is type safe & determined from the type variable passed to this function. 1049 - * e.g. in the example below, the only message that can be sent is `my_message`. 1050 - * 1051 - * ```typescript 1052 - * // create a messenger and pass in the callback that will be invoked 1053 - * // when `messenger.send()` is called below 1054 - * const messenger = glide.messengers.create<{ my_message: null }>((message) => { 1055 - * switch (message.name) { 1056 - * case "my_message": { 1057 - * // ... 1058 - * break; 1059 - * } 1060 - * } 1061 - * }); 1062 - * 1063 - * glide.keymaps.set("normal", "gt", ({ tab_id }) => { 1064 - * // note the `messenger.content.execute()` function intead of 1065 - * // the typical `glide.content.execute()` function. 1066 - * messenger.content.execute((messenger) => { 1067 - * document.addEventListener('focusin', (event) => { 1068 - * if (event.target.id === 'my-element') { 1069 - * messenger.send('my_message'); 1070 - * } 1071 - * }) 1072 - * }, { tab_id }); 1073 - * }); 1074 - * ``` 1075 - */ 1076 - create<Messages extends Record<string, any>>(receiver: (message: glide.Message<Messages>) => void): glide.ParentMessenger<Messages>; 1077 - }; 1078 - modes: { 1079 - /** 1080 - * Register a custom `mode`. 1081 - * 1082 - * **note**: you must *also* register it as a type like so: 1083 - * 1084 - * ```typescript 1085 - * declare global { 1086 - * interface GlideModes { 1087 - * leap: "leap"; 1088 - * } 1089 - * } 1090 - * glide.modes.register('leap', { caret: 'block' }) 1091 - * ``` 1092 - */ 1093 - register<Mode extends keyof GlideModes>(mode: Mode, opts: { 1094 - caret: "block" | "line" | "underline"; 1095 - }): void; 1096 - }; 1097 - }; 1098 - /** 1099 - * Defines all the supported modes. 1100 - * 1101 - * **note**: the key is what defines the list of supported modes, currently the value is 1102 - * not used for anything. 1103 - * 1104 - * **note**: you must *also* register it at runtime like so: 1105 - * 1106 - * ```typescript 1107 - * declare global { 1108 - * interface GlideModes { 1109 - * leap: "leap"; 1110 - * } 1111 - * } 1112 - * glide.modes.register('leap', { caret: 'block' }) 1113 - * ``` 1114 - */ 1115 - interface GlideModes { 1116 - normal: "normal"; 1117 - insert: "insert"; 1118 - visual: "visual"; 1119 - ignore: "ignore"; 1120 - command: "command"; 1121 - "op-pending": "op-pending"; 1122 - } 1123 - /** 1124 - * All of the supported modes. 1125 - * 1126 - * See {@link GlideModes} for more information. 1127 - */ 1128 - type GlideMode = keyof GlideModes; 1129 - interface GlideGlobals { 1130 - /** 1131 - * The key notation that any `<leader>` mapping matches against. 1132 - * 1133 - * For example, a mapping defined with `<leader>r` would be matched when Space + r is pressed. 1134 - * 1135 - * @default "<Space>" 1136 - */ 1137 - mapleader: string; 1138 - } 1139 - /** 1140 - * Throws an error if the given value is not truthy. 1141 - * 1142 - * Returns the value if it is truthy. 1143 - */ 1144 - function ensure<T>(value: T, message?: string): T extends false | "" | 0 | 0n | null | undefined ? never : T; 1145 - /** 1146 - * Assert an invariant. An \`AssertionError\` will be thrown if `value` is falsy. 1147 - */ 1148 - function assert(value: unknown, message?: string): asserts value; 1149 - /** 1150 - * The inverse of `{@link assert}`, useful for blowing up when the condition becomes `truthy`. 1151 - */ 1152 - function todo_assert(value: unknown, message?: string): void; 1153 - /** 1154 - * Helper function for asserting exhaustiveness checks. 1155 - * 1156 - * You can optionally pass a second argument which will be used as the error message, 1157 - * if not given then the first argument will be stringified in the error message. 1158 - * 1159 - * ```typescript 1160 - * switch (union.type) { 1161 - * case 'type1': ... 1162 - * case 'type2': ... 1163 - * default: 1164 - * throw assert_never(union.type); 1165 - * } 1166 - */ 1167 - function assert_never(x: never, detail?: string | Error): never; 1168 - class FileNotFoundError extends Error { 1169 - path: string; 1170 - constructor(message: string, props: { 1171 - path: string; 1172 - }); 1173 - } 1174 - class GlideProcessError extends Error { 1175 - process: glide.CompletedProcess; 1176 - exit_code: number; 1177 - constructor(message: string, process: glide.CompletedProcess); 1178 - } 1179 - /** 1180 - * Interface used to define types for excmds, intended for declaration merging. 1181 - * 1182 - * e.g. 1183 - * ```typescript 1184 - * const cmd = glide.excmds.create( 1185 - * { name: "my_excmd", description: "..." }, 1186 - * () => { 1187 - * // ... 1188 - * } 1189 - * ); 1190 - * declare global { 1191 - * interface ExcmdRegistry { 1192 - * my_excmd: typeof cmd; 1193 - * } 1194 - * } 1195 - * ``` 1196 - */ 1197 - export interface ExcmdRegistry { 1198 - } 1199 - namespace glide { 1200 - /** 1201 - * Corresponds to {@link glide.o} or {@link glide.bo}. 1202 - */ 1203 - // note: this is skipped in docs generation because we expand `glide.o`, so rendering 1204 - // the `Options` type as well would be redundant. 1205 - /// @docs-skip 1206 - export type Options = { 1207 - /** 1208 - * How long to wait until cancelling a partial keymapping execution. 1209 - * 1210 - * For example, `glide.keymaps.set('insert', 'jj', 'mode_change normal')`, after 1211 - * pressing `j` once, this option determines how long the delay should be until 1212 - * the `j` key is considered fully pressed and the mapping sequence is reset. 1213 - * 1214 - * note: this only applies in insert mode. 1215 - * 1216 - * @default 200 1217 - */ 1218 - mapping_timeout: number; 1219 - /** 1220 - * Color used to briefly highlight text when it's yanked. 1221 - * 1222 - * @example "#ff6b35" // Orange highlight 1223 - * @default "#edc73b" 1224 - */ 1225 - yank_highlight: glide.RGBString; 1226 - /** 1227 - * How long, in milliseconds, to highlight the selection for when it's yanked. 1228 - * 1229 - * @default 150 1230 - */ 1231 - yank_highlight_time: number; 1232 - /** 1233 - * The delay, in milliseconds, before showing the which key UI. 1234 - * 1235 - * @default 300 1236 - */ 1237 - which_key_delay: number; 1238 - /** 1239 - * The maximum number of entries to include in the jumplist, i.e. 1240 - * how far back in history will the jumplist store. 1241 - * 1242 - * @default 100 1243 - */ 1244 - jumplist_max_entries: number; 1245 - /** 1246 - * The font size of the hint label, directly corresponds to the 1247 - * [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size) property. 1248 - * 1249 - * @default "11px" 1250 - */ 1251 - hint_size: string; 1252 - }; 1253 - export type SpawnOptions = { 1254 - cwd?: string; 1255 - env?: Record<string, string | null>; 1256 - extend_env?: boolean; 1257 - success_codes?: number[]; 1258 - /** 1259 - * If `false`, do not throw an error for non-zero exit codes. 1260 - * 1261 - * @default true 1262 - */ 1263 - check_exit_code?: boolean; 1264 - /** 1265 - * Control where the stderr output is sent. 1266 - * 1267 - * If `"pipe"` then sterr is accessible through `process.stderr`. 1268 - * If `"stdout"` then sterr is mixed with stdout and accessible through `process.stdout`. 1269 - * 1270 - * @default "pipe" 1271 - */ 1272 - stderr?: "pipe" | "stdout"; 1273 - }; 1274 - export type Process = { 1275 - pid: number; 1276 - /** 1277 - * The process exit code. 1278 - * 1279 - * `null` if it has not exited yet. 1280 - */ 1281 - exit_code: number | null; 1282 - /** 1283 - * A `ReadableStream` of `string`s from the stdout pipe. 1284 - */ 1285 - stdout: ReadableStream<string>; 1286 - /** 1287 - * A `ReadableStream` of `string`s from the stderr pipe. 1288 - * 1289 - * This is `null` if the `stderr: 'stdout'` option was set as the pipe will be forwarded 1290 - * to `stdout` instead. 1291 - */ 1292 - stderr: ReadableStream<string> | null; 1293 - /** 1294 - * Wait for the process to exit. 1295 - */ 1296 - wait(): Promise<glide.CompletedProcess>; 1297 - /** 1298 - * Kill the process. 1299 - * 1300 - * On platforms which support it, the process will be sent a `SIGTERM` signal immediately, 1301 - * so that it has a chance to terminate gracefully, and a `SIGKILL` signal if it hasn't exited 1302 - * within `timeout` milliseconds. 1303 - * 1304 - * @param {integer} [timeout=300] 1305 - * A timeout, in milliseconds, after which the process will be forcibly killed. 1306 - */ 1307 - kill(timeout?: number): Promise<glide.CompletedProcess>; 1308 - }; 1309 - /** 1310 - * Represents a process that has exited. 1311 - */ 1312 - export type CompletedProcess = glide.Process & { 1313 - exit_code: number; 1314 - }; 1315 - export type RGBString = `#${string}`; 1316 - /** A web extension tab that is guaranteed to have the `ts:id` property present. */ 1317 - export type TabWithID = Omit<Browser.Tabs.Tab, "id"> & { 1318 - id: number; 1319 - }; 1320 - export type KeyEvent = KeyboardEvent & { 1321 - /** 1322 - * The vim notation of the KeyEvent, e.g. 1323 - * 1324 - * `{ ctrlKey: true, key: 's' }` -> `'<C-s>'` 1325 - */ 1326 - glide_key: string; 1327 - }; 1328 - export type KeySendOptions = { 1329 - /** 1330 - * Send the key event(s) directly through to the builtin Firefox 1331 - * input handler and skip all of the mappings defined in Glide. 1332 - */ 1333 - skip_mappings?: boolean; 1334 - }; 1335 - export type KeymapCallback = (props: glide.KeymapCallbackProps) => void; 1336 - export type KeymapCallbackProps = { 1337 - /** 1338 - * The tab that the callback is being executed in. 1339 - */ 1340 - tab_id: number; 1341 - }; 1342 - /// @docs-skip 1343 - export type ExcmdCreateProps = { 1344 - name: string; 1345 - description?: string | undefined; 1346 - }; 1347 - /// @docs-skip 1348 - export type ExcmdValue = glide.ExcmdString | glide.ExcmdCallback | glide.KeymapCallback; 1349 - /// @docs-skip 1350 - export type ExcmdCallback = (props: glide.ExcmdCallbackProps) => void; 1351 - /// @docs-skip 1352 - export type ExcmdCallbackProps = { 1353 - /** 1354 - * The tab that the callback is being executed in. 1355 - */ 1356 - tab_id: number; 1357 - /** 1358 - * The args passed to the excmd. 1359 - * 1360 - * @example "foo -r" -> ["-r"] 1361 - * @example "foo -r 'string with spaces'" -> ["-r", "string with spaces"] 1362 - */ 1363 - args_arr: string[]; 1364 - }; 1365 - /// @docs-skip 1366 - export type ExcmdString = 1367 - // builtin 1368 - GlideCommandString 1369 - // custom 1370 - | keyof ExcmdRegistry | `${keyof ExcmdRegistry} ${string}`; 1371 - /// @docs-skip 1372 - export type ContentHint = { 1373 - id: number; 1374 - x: number; 1375 - y: number; 1376 - width: number; 1377 - height: number; 1378 - element: HTMLElement; 1379 - }; 1380 - export type HintLocation = "content" | "browser-ui"; 1381 - export type KeyNotation = { 1382 - /** 1383 - * @example <leader> 1384 - * @example h 1385 - * @example j 1386 - * @example K 1387 - * @example L 1388 - * @example <Tab> 1389 - */ 1390 - key: string; 1391 - // modifiers 1392 - alt: boolean; 1393 - ctrl: boolean; 1394 - meta: boolean; 1395 - shift: boolean; 1396 - }; 1397 - export type Keymap = { 1398 - sequence: string[]; 1399 - lhs: string; 1400 - rhs: glide.ExcmdValue; 1401 - description: string | undefined; 1402 - mode: GlideMode; 1403 - }; 1404 - export type KeymapOpts = { 1405 - description?: string | undefined; 1406 - /** 1407 - * If `true`, applies the mapping for the current buffer instead of globally. 1408 - * 1409 - * @default {false} 1410 - */ 1411 - buffer?: boolean; 1412 - /** 1413 - * If true, the key sequence will be displayed even after the mapping is executed. 1414 - * 1415 - * This is useful for mappings that are conceptually chained but are not *actually*, e.g. `diw`. 1416 - * 1417 - * @default false 1418 - */ 1419 - retain_key_display?: boolean; 1420 - }; 1421 - export type KeymapDeleteOpts = Pick<glide.KeymapOpts, "buffer">; 1422 - type AutocmdEvent = "UrlEnter" | "ModeChanged" | "ConfigLoaded" | "WindowLoaded" | "KeyStateChanged"; 1423 - type AutocmdPatterns = { 1424 - UrlEnter: RegExp | { 1425 - hostname?: string; 1426 - }; 1427 - ModeChanged: "*" | `${GlideMode | "*"}:${GlideMode | "*"}`; 1428 - ConfigLoaded: null; 1429 - WindowLoaded: null; 1430 - KeyStateChanged: null; 1431 - }; 1432 - type AutocmdArgs = { 1433 - UrlEnter: { 1434 - readonly url: string; 1435 - readonly tab_id: number; 1436 - }; 1437 - ModeChanged: { 1438 - /** 1439 - * This may be `null` when first loading Glide or when reloading the config. 1440 - */ 1441 - readonly old_mode: GlideMode | null; 1442 - readonly new_mode: GlideMode; 1443 - }; 1444 - ConfigLoaded: {}; 1445 - WindowLoaded: {}; 1446 - KeyStateChanged: { 1447 - readonly mode: GlideMode; 1448 - readonly sequence: string[]; 1449 - readonly partial: boolean; 1450 - }; 1451 - }; 1452 - /// doesn't render properly right now 1453 - /// @docs-skip 1454 - type Message<Messages extends Record<string, any>> = { 1455 - [K in keyof Messages]: { 1456 - name: K; 1457 - data: Messages[K]; 1458 - }; 1459 - }[keyof Messages]; 1460 - interface ParentMessenger<Messages extends Record<string, any>> { 1461 - content: { 1462 - /** 1463 - * The given callback is executed in the content process and is given a 1464 - * {@link glide.ContentMessenger} as the first argument. 1465 - * 1466 - * **note**: unlike {@link glide.content.execute} the callback cannot be passed custom arguments 1467 - */ 1468 - execute: (callback: (messenger: glide.ContentMessenger<Messages>) => void, opts: { 1469 - /** 1470 - * The ID of the tab into which to inject. 1471 - * 1472 - * Or the tab object as returned by {@link glide.tabs.active}. 1473 - */ 1474 - tab_id: number | glide.TabWithID; 1475 - }) => void; 1476 - }; 1477 - } 1478 - interface ContentMessenger<Messages extends Record<string, any>> { 1479 - /** 1480 - * Send a message to the receiver in the parent process. 1481 - */ 1482 - send<MessageName extends keyof Messages>(name: MessageName): void; 1483 - } 1484 - export type FileInfo = { 1485 - type: "file" | "directory" | null; 1486 - permissions: number | undefined; 1487 - last_accessed: number | undefined; 1488 - last_modified: number | undefined; 1489 - creation_time: number | undefined; 1490 - path: string | undefined; 1491 - size: number | undefined; 1492 - }; 1493 - } 1494 - /** 1495 - * Dedent template function. 1496 - * 1497 - * Inspired by the https://www.npmjs.com/package/dedent package. 1498 - */ 1499 - function dedent(arg: string): string; 1500 - function dedent(strings: TemplateStringsArray, ...values: unknown[]): string; 1501 - /** 1502 - * Dedent template function for syntax highlighting. 1503 - * 1504 - * Inspired by the https://www.npmjs.com/package/dedent package. 1505 - * 1506 - * note: we don't support passing in arguments to these functions as we would have to 1507 - * support escaping them, to not make it easy to accidentally cause XSS 1508 - */ 1509 - function html(arg: TemplateStringsArray): string; 1510 - /** 1511 - * Dedent template function for syntax highlighting. 1512 - * 1513 - * Inspired by the https://www.npmjs.com/package/dedent package. 1514 - * 1515 - * note: we don't support passing in arguments to these functions as we would have to 1516 - * support escaping them, to not make it easy to accidentally cause XSS 1517 - */ 1518 - function css(arg: TemplateStringsArray): string; 1519 - /** 1520 - * Helper functions for interacting with the DOM. 1521 - * 1522 - * **note**: this is currently only available in the main process, for 1523 - * updating the browser UI itself. it is not available in 1524 - * content processes. 1525 - */ 1526 - var DOM: { 1527 - /** 1528 - * Wrapper over `document.createElement()` providing a more ergonomic API. 1529 - * 1530 - * Element properties that can be assigned directly can be provided as props: 1531 - * 1532 - * ```ts 1533 - * DOM.create_element('img', { src: '...' }); 1534 - * ``` 1535 - * 1536 - * You can also pass a `children` property, which will use `.replaceChildren()`: 1537 - * 1538 - * ```ts 1539 - * DOM.create_element("div", { 1540 - * children: ["text content", DOM.create_element("img", { alt: "hint" })], 1541 - * }); 1542 - * ``` 1543 - */ 1544 - create_element<TagName extends keyof HTMLElementTagNameMap | (string & {})>(tag_name: TagName, props?: DOM.CreateElementProps<TagName extends keyof HTMLElementTagNameMap ? TagName : "div">): TagName extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TagName] : HTMLElement; 1545 - }; 1546 - namespace DOM { 1547 - type Utils = typeof DOM; 1548 - type CreateElementProps<K extends keyof HTMLElementTagNameMap> = Omit<Partial<NonReadonly<HTMLElementTagNameMap[K]>>, "children"> & { 1549 - /** 1550 - * Can be an individual child or an array of children. 1551 - */ 1552 - children?: (Node | string) | Array<Node | string>; 1553 - /** 1554 - * Set arbitrary attributes on the element. 1555 - */ 1556 - attributes?: Record<string, string>; 1557 - /** 1558 - * Set specific CSS style properties. 1559 - * 1560 - * This uses the JS style naming convention for properties, e.g. `zIndex`. 1561 - */ 1562 - style?: Partial<CSSStyleDeclaration>; 1563 - }; 1564 - } 1565 - namespace $keymapcompletions { 1566 - /** 1567 - * This type takes in a string literal type, e.g. `<C-`, `a`, `<leader>` 1568 - * and resolves a new string literal type union type that represents as many 1569 - * valid additional entries as possible. 1570 - * 1571 - * `<C-` -> `<C-a>` | `<C-D-` ... 1572 - * `<leader>` -> `<leader>f` | `<leader><CR>` ... 1573 - * `g` -> `gg` | `gj` ... 1574 - */ 1575 - type T<LHS> = LHS extends "" ? SingleKey : LHS extends "<" ? SpecialKey | `<${ModifierKey}-` : LHS extends `${infer S}<${infer M}-` ? `${S}<${M}-${Exclude<StripAngles<SingleKey>, ModifierKey>}>` | `${S}<${M}-${ModifierKey}-` | (S & {}) : LHS extends `${infer S}<` ? `${S}${SpecialKey}` | S : LHS extends `${infer S}` ? `${S}${SingleKey}` | S : LHS; 1576 - /** 1577 - * e.g. a, b, <leader> 1578 - */ 1579 - type SingleKey = StringToUnion<"abcdefghijklmnoprstuvwxyz"> | StringToUnion<"ABCDEFGHIJKLMNOPRSTUVWXYZ"> | StringToUnion<"0123456789"> | SpecialKey; 1580 - type SpecialKey = "<space>" | "<tab>" | "<esc>" | "<escape>" | "<space>" | "<enter>" | "<backspace>" | "<BS>" | "<CR>" | "<leader>" | "<up>" | "<down>" | "<left>" | "<right>" | "<del>" | "<home>" | "<end>" | "<pageup>" | "<pagedown>" | "<F1>" | "<F2>" | "<F3>" | "<F4>" | "<F5>" | "<F6>" | "<F7>" | "<F8>" | "<F9>" | "<F10>" | "<F11>" | "<F12>" | "<lt>" | "<bar>" | "<bslash>"; 1581 - type ModifierKey = "C" | "D" | "A" | "S"; 1582 - type StringToUnion<S extends string> = S extends `${infer First}${infer Rest}` ? First | StringToUnion<Rest> : never; 1583 - /** 1584 - * `<foo>` -> `foo` 1585 - */ 1586 - type StripAngles<K extends SingleKey> = K extends `<${infer Inner}>` ? Inner : K; 1587 - } 1588 - } 1589 - /// ----------------- util types ----------------- 1590 - /** 1591 - * Filter out `readonly` properties from the given object type. 1592 - */ 1593 - export type NonReadonly<T> = Pick<T, { 1594 - [K in keyof T]: T[K] extends Readonly<any> ? never : K; 1595 - }[keyof T]>; 1596 - // This Source Code Form is subject to the terms of the Mozilla Public 1597 - // License, v. 2.0. If a copy of the MPL was not distributed with this 1598 - // file, You can obtain one at http://mozilla.org/MPL/2.0/. 1599 - ////////////////////////////////////////////////////// 1600 - // BEWARE: DO NOT EDIT MANUALLY! Changes will be lost! 1601 - ////////////////////////////////////////////////////// 1602 - declare global { 1603 - const browser: Browser.Browser; 1604 - namespace Browser { 1605 - /** 1606 - * Namespace: browser.activityLog 1607 - */ 1608 - namespace ActivityLog { 1609 - interface OnExtensionActivityDetailsType { 1610 - /** 1611 - * The date string when this call is triggered. 1612 - */ 1613 - timeStamp: ExtensionTypes.DateType; 1614 - /** 1615 - * The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the 1616 - * extension. content_script is logged when a content script is injected. 1617 - */ 1618 - type: OnExtensionActivityDetailsTypeTypeEnum; 1619 - /** 1620 - * The type of view where the activity occurred. Content scripts will not have a viewType. 1621 - * Optional. 1622 - */ 1623 - viewType?: OnExtensionActivityDetailsTypeViewTypeEnum; 1624 - /** 1625 - * The name of the api call or event, or the script url if this is a content or user script event. 1626 - */ 1627 - name: string; 1628 - data: OnExtensionActivityDetailsTypeDataType; 1629 - } 1630 - /** 1631 - * The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the 1632 - * extension. content_script is logged when a content script is injected. 1633 - */ 1634 - type OnExtensionActivityDetailsTypeTypeEnum = "api_call" | "api_event" | "content_script" | "user_script"; 1635 - /** 1636 - * The type of view where the activity occurred. Content scripts will not have a viewType. 1637 - */ 1638 - type OnExtensionActivityDetailsTypeViewTypeEnum = "background" | "popup" | "sidebar" | "tab" | "devtools_page" | "devtools_panel"; 1639 - /** 1640 - * The result of the call. 1641 - */ 1642 - interface OnExtensionActivityDetailsTypeDataResultType { 1643 - [s: string]: unknown; 1644 - } 1645 - interface OnExtensionActivityDetailsTypeDataType { 1646 - /** 1647 - * A list of arguments passed to the call. 1648 - * Optional. 1649 - */ 1650 - args?: unknown[]; 1651 - /** 1652 - * The result of the call. 1653 - * Optional. 1654 - */ 1655 - result?: OnExtensionActivityDetailsTypeDataResultType; 1656 - /** 1657 - * The tab associated with this event if it is a tab or content script. 1658 - * Optional. 1659 - */ 1660 - tabId?: number; 1661 - /** 1662 - * If the type is content_script, this is the url of the script that was injected. 1663 - * Optional. 1664 - */ 1665 - url?: string; 1666 - } 1667 - /** 1668 - * Receives an activityItem for each logging event. 1669 - */ 1670 - interface OnExtensionActivityEvent extends Events.Event<(details: OnExtensionActivityDetailsType) => void> { 1671 - /** 1672 - * Registers an event listener <em>callback</em> to an event. 1673 - * 1674 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 1675 - */ 1676 - addListener(callback: (details: OnExtensionActivityDetailsType) => void, id: string): void; 1677 - } 1678 - interface Static { 1679 - /** 1680 - * Receives an activityItem for each logging event. 1681 - */ 1682 - onExtensionActivity: OnExtensionActivityEvent; 1683 - } 1684 - } 1685 - /** 1686 - * Namespace: browser.alarms 1687 - */ 1688 - namespace Alarms { 1689 - interface Alarm { 1690 - /** 1691 - * Name of this alarm. 1692 - */ 1693 - name: string; 1694 - /** 1695 - * Time when the alarm is scheduled to fire, in milliseconds past the epoch. 1696 - */ 1697 - scheduledTime: number; 1698 - /** 1699 - * When present, signals that the alarm triggers periodically after so many minutes. 1700 - * Optional. 1701 - */ 1702 - periodInMinutes?: number; 1703 - } 1704 - /** 1705 - * Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), 1706 - * after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), 1707 - * or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). 1708 - * Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, 1709 - * then the alarm recurs repeatedly after that many minutes. 1710 - */ 1711 - interface CreateAlarmInfoType { 1712 - /** 1713 - * Time when the alarm is scheduled to first fire, in milliseconds past the epoch. 1714 - * Optional. 1715 - */ 1716 - when?: number; 1717 - /** 1718 - * Number of minutes from the current time after which the alarm should first fire. 1719 - * Optional. 1720 - */ 1721 - delayInMinutes?: number; 1722 - /** 1723 - * Number of minutes after which the alarm should recur repeatedly. 1724 - * Optional. 1725 - */ 1726 - periodInMinutes?: number; 1727 - } 1728 - interface Static { 1729 - /** 1730 - * Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name 1731 - * (or no name if none is specified), it will be cancelled and replaced by this alarm. 1732 - * 1733 - * @param name Optional. Optional name to identify this alarm. Defaults to the empty string. 1734 - * @param alarmInfo Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' 1735 - * is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), 1736 - * or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). 1737 - * Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, 1738 - * then the alarm recurs repeatedly after that many minutes. 1739 - */ 1740 - create(name: string | undefined, alarmInfo: CreateAlarmInfoType): Promise<void>; 1741 - /** 1742 - * Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name 1743 - * (or no name if none is specified), it will be cancelled and replaced by this alarm. 1744 - * 1745 - * @param alarmInfo Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' 1746 - * is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), 1747 - * or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). 1748 - * Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, 1749 - * then the alarm recurs repeatedly after that many minutes. 1750 - */ 1751 - create(alarmInfo: CreateAlarmInfoType): Promise<void>; 1752 - /** 1753 - * Retrieves details about the specified alarm. 1754 - * 1755 - * @param name Optional. The name of the alarm to get. Defaults to the empty string. 1756 - */ 1757 - get(name?: string): Promise<Alarm | undefined>; 1758 - /** 1759 - * Gets an array of all the alarms. 1760 - */ 1761 - getAll(): Promise<Alarm[]>; 1762 - /** 1763 - * Clears the alarm with the given name. 1764 - * 1765 - * @param name Optional. The name of the alarm to clear. Defaults to the empty string. 1766 - */ 1767 - clear(name?: string): Promise<boolean>; 1768 - /** 1769 - * Clears all alarms. 1770 - */ 1771 - clearAll(): Promise<boolean>; 1772 - /** 1773 - * Fired when an alarm has expired. Useful for transient background pages. 1774 - * 1775 - * @param name The alarm that has expired. 1776 - */ 1777 - onAlarm: Events.Event<(name: Alarm) => void>; 1778 - } 1779 - } 1780 - /** 1781 - * Namespace: browser.bookmarks 1782 - */ 1783 - namespace Bookmarks { 1784 - /** 1785 - * Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured 1786 - * by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user 1787 - * and the extension (default). 1788 - */ 1789 - type BookmarkTreeNodeUnmodifiable = "managed"; 1790 - /** 1791 - * Indicates the type of a BookmarkTreeNode, which can be one of bookmark, folder or separator. 1792 - */ 1793 - type BookmarkTreeNodeType = "bookmark" | "folder" | "separator"; 1794 - /** 1795 - * A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. 1796 - */ 1797 - interface BookmarkTreeNode { 1798 - /** 1799 - * The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the 1800 - * browser is restarted. 1801 - */ 1802 - id: string; 1803 - /** 1804 - * The <code>id</code> of the parent folder. Omitted for the root node. 1805 - * Optional. 1806 - */ 1807 - parentId?: string; 1808 - /** 1809 - * The 0-based position of this node within its parent folder. 1810 - * Optional. 1811 - */ 1812 - index?: number; 1813 - /** 1814 - * The URL navigated to when a user clicks the bookmark. Omitted for folders. 1815 - * Optional. 1816 - */ 1817 - url?: string; 1818 - /** 1819 - * The text displayed for the node. 1820 - */ 1821 - title: string; 1822 - /** 1823 - * When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>). 1824 - * Optional. 1825 - */ 1826 - dateAdded?: number; 1827 - /** 1828 - * When the contents of this folder last changed, in milliseconds since the epoch. 1829 - * Optional. 1830 - */ 1831 - dateGroupModified?: number; 1832 - /** 1833 - * Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured 1834 - * by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user 1835 - * and the extension (default). 1836 - * Optional. 1837 - */ 1838 - unmodifiable?: BookmarkTreeNodeUnmodifiable; 1839 - /** 1840 - * Indicates the type of the BookmarkTreeNode, which can be one of bookmark, folder or separator. 1841 - * Optional. 1842 - */ 1843 - type?: BookmarkTreeNodeType; 1844 - /** 1845 - * An ordered list of children of this node. 1846 - * Optional. 1847 - */ 1848 - children?: BookmarkTreeNode[]; 1849 - } 1850 - /** 1851 - * Object passed to the create() function. 1852 - */ 1853 - interface CreateDetails { 1854 - /** 1855 - * Defaults to the Other Bookmarks folder. 1856 - * Optional. 1857 - */ 1858 - parentId?: string; 1859 - /** 1860 - * Optional. 1861 - */ 1862 - index?: number; 1863 - /** 1864 - * Optional. 1865 - */ 1866 - title?: string; 1867 - /** 1868 - * Optional. 1869 - */ 1870 - url?: string; 1871 - /** 1872 - * Indicates the type of BookmarkTreeNode to create, which can be one of bookmark, folder or separator. 1873 - * Optional. 1874 - */ 1875 - type?: BookmarkTreeNodeType; 1876 - } 1877 - /** 1878 - * An object specifying properties and values to match when searching. Produces bookmarks matching all properties. 1879 - */ 1880 - interface SearchQueryC2Type { 1881 - /** 1882 - * A string of words that are matched against bookmark URLs and titles. 1883 - * Optional. 1884 - */ 1885 - query?: string; 1886 - /** 1887 - * The URL of the bookmark; matches verbatim. Note that folders have no URL. 1888 - * Optional. 1889 - */ 1890 - url?: string; 1891 - /** 1892 - * The title of the bookmark; matches verbatim. 1893 - * Optional. 1894 - */ 1895 - title?: string; 1896 - } 1897 - interface MoveDestinationType { 1898 - /** 1899 - * Optional. 1900 - */ 1901 - parentId?: string; 1902 - /** 1903 - * Optional. 1904 - */ 1905 - index?: number; 1906 - } 1907 - interface UpdateChangesType { 1908 - /** 1909 - * Optional. 1910 - */ 1911 - title?: string; 1912 - /** 1913 - * Optional. 1914 - */ 1915 - url?: string; 1916 - } 1917 - interface OnRemovedRemoveInfoType { 1918 - parentId: string; 1919 - index: number; 1920 - node: BookmarkTreeNode; 1921 - } 1922 - interface OnChangedChangeInfoType { 1923 - title: string; 1924 - /** 1925 - * Optional. 1926 - */ 1927 - url?: string; 1928 - } 1929 - interface OnMovedMoveInfoType { 1930 - parentId: string; 1931 - index: number; 1932 - oldParentId: string; 1933 - oldIndex: number; 1934 - } 1935 - interface Static { 1936 - /** 1937 - * Retrieves the specified BookmarkTreeNode(s). 1938 - * 1939 - * @param idOrIdList A single string-valued id, or an array of string-valued ids 1940 - */ 1941 - get(idOrIdList: string | string[]): Promise<BookmarkTreeNode[]>; 1942 - /** 1943 - * Retrieves the children of the specified BookmarkTreeNode id. 1944 - */ 1945 - getChildren(id: string): Promise<BookmarkTreeNode[]>; 1946 - /** 1947 - * Retrieves the recently added bookmarks. 1948 - * 1949 - * @param numberOfItems The maximum number of items to return. 1950 - */ 1951 - getRecent(numberOfItems: number): Promise<BookmarkTreeNode[]>; 1952 - /** 1953 - * Retrieves the entire Bookmarks hierarchy. 1954 - */ 1955 - getTree(): Promise<BookmarkTreeNode[]>; 1956 - /** 1957 - * Retrieves part of the Bookmarks hierarchy, starting at the specified node. 1958 - * 1959 - * @param id The ID of the root of the subtree to retrieve. 1960 - */ 1961 - getSubTree(id: string): Promise<BookmarkTreeNode[]>; 1962 - /** 1963 - * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes 1964 - * matching all specified properties. 1965 - * 1966 - * @param query Either a string of words that are matched against bookmark URLs and titles, or an object. If an object, 1967 - * the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all 1968 - * specified properties will be produced. 1969 - */ 1970 - search(query: string | SearchQueryC2Type): Promise<BookmarkTreeNode[]>; 1971 - /** 1972 - * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. 1973 - */ 1974 - create(bookmark: CreateDetails): Promise<BookmarkTreeNode>; 1975 - /** 1976 - * Moves the specified BookmarkTreeNode to the provided location. 1977 - */ 1978 - move(id: string, destination: MoveDestinationType): Promise<BookmarkTreeNode>; 1979 - /** 1980 - * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified 1981 - * properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported. 1982 - */ 1983 - update(id: string, changes: UpdateChangesType): Promise<BookmarkTreeNode>; 1984 - /** 1985 - * Removes a bookmark or an empty bookmark folder. 1986 - */ 1987 - remove(id: string): Promise<void>; 1988 - /** 1989 - * Recursively removes a bookmark folder. 1990 - */ 1991 - removeTree(id: string): Promise<void>; 1992 - /** 1993 - * Fired when a bookmark or folder is created. 1994 - */ 1995 - onCreated: Events.Event<(id: string, bookmark: BookmarkTreeNode) => void>; 1996 - /** 1997 - * Fired when a bookmark or folder is removed. When a folder is removed recursively, 1998 - * a single notification is fired for the folder, and none for its contents. 1999 - */ 2000 - onRemoved: Events.Event<(id: string, removeInfo: OnRemovedRemoveInfoType) => void>; 2001 - /** 2002 - * Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this. 2003 - */ 2004 - onChanged: Events.Event<(id: string, changeInfo: OnChangedChangeInfoType) => void>; 2005 - /** 2006 - * Fired when a bookmark or folder is moved to a different parent folder. 2007 - */ 2008 - onMoved: Events.Event<(id: string, moveInfo: OnMovedMoveInfoType) => void>; 2009 - } 2010 - } 2011 - /** 2012 - * Namespace: browser.action 2013 - */ 2014 - namespace Action { 2015 - /** 2016 - * Specifies to which tab or window the value should be set, or from which one it should be retrieved. 2017 - * If no tab nor window is specified, the global value is set or retrieved. 2018 - */ 2019 - interface Details { 2020 - /** 2021 - * When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates. 2022 - * When getting, specifies the tab to get the value from; if there is no tab-specific value, 2023 - * the window one will be inherited. 2024 - * Optional. 2025 - */ 2026 - tabId?: number; 2027 - /** 2028 - * When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value 2029 - * from; if there is no window-specific value, the global one will be inherited. 2030 - * Optional. 2031 - */ 2032 - windowId?: number; 2033 - } 2034 - type ColorArray = [ 2035 - number, 2036 - number, 2037 - number, 2038 - number 2039 - ]; 2040 - /** 2041 - * Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element). 2042 - */ 2043 - interface ImageDataType extends ImageData { 2044 - [s: string]: unknown; 2045 - } 2046 - /** 2047 - * An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, 2048 - * opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code> 2049 - * #FF0000</code> or <code>#F00</code>. 2050 - */ 2051 - type ColorValue = string | ColorArray | null; 2052 - /** 2053 - * Information sent when a browser action is clicked. 2054 - */ 2055 - interface OnClickData { 2056 - /** 2057 - * An array of keyboard modifiers that were held while the menu item was clicked. 2058 - */ 2059 - modifiers: OnClickDataModifiersItemEnum[]; 2060 - /** 2061 - * An integer value of button by which menu item was clicked. 2062 - * Optional. 2063 - */ 2064 - button?: number; 2065 - } 2066 - interface SetTitleDetailsType extends Details { 2067 - /** 2068 - * The string the browser action should display when moused over. 2069 - */ 2070 - title: string | null; 2071 - } 2072 - /** 2073 - * The collection of user-specified settings relating to an extension's action. 2074 - */ 2075 - interface GetUserSettingsCallbackUserSettingsType { 2076 - /** 2077 - * Whether the extension's action icon is visible on browser windows' top-level toolbar (i.e., 2078 - * whether the extension has been 'pinned' by the user). 2079 - * Optional. 2080 - */ 2081 - isOnToolbar?: boolean; 2082 - } 2083 - interface SetIconDetailsType extends Details { 2084 - /** 2085 - * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. 2086 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 2087 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 2088 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 2089 - * At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details. 2090 - * imageData = {'19': foo}' 2091 - * Optional. 2092 - */ 2093 - imageData?: ImageDataType | Record<string, ImageDataType>; 2094 - /** 2095 - * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. 2096 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 2097 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 2098 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 2099 - * At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' 2100 - * Optional. 2101 - */ 2102 - path?: string | Record<string, string>; 2103 - } 2104 - interface SetPopupDetailsType extends Details { 2105 - /** 2106 - * The html file to show in a popup. If set to the empty string (''), no popup is shown. 2107 - */ 2108 - popup: string | null; 2109 - } 2110 - interface SetBadgeTextDetailsType extends Details { 2111 - /** 2112 - * Any number of characters can be passed, but only about four can fit in the space. 2113 - */ 2114 - text: string | null; 2115 - } 2116 - interface SetBadgeBackgroundColorDetailsType extends Details { 2117 - color: ColorValue; 2118 - } 2119 - interface SetBadgeTextColorDetailsType extends Details { 2120 - color: ColorValue; 2121 - } 2122 - /** 2123 - * An object with information about the popup to open. 2124 - */ 2125 - interface OpenPopupOptionsType { 2126 - /** 2127 - * Defaults to the $(topic:current-window)[current window]. 2128 - * Optional. 2129 - */ 2130 - windowId?: number; 2131 - } 2132 - type OnClickDataModifiersItemEnum = "Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl"; 2133 - interface Static { 2134 - /** 2135 - * Sets the title of the browser action. This shows up in the tooltip. 2136 - */ 2137 - setTitle(details: SetTitleDetailsType): Promise<void>; 2138 - /** 2139 - * Gets the title of the browser action. 2140 - */ 2141 - getTitle(details: Details): Promise<string>; 2142 - /** 2143 - * Returns the user-specified settings relating to an extension's action. 2144 - */ 2145 - getUserSettings(): Promise<GetUserSettingsCallbackUserSettingsType>; 2146 - /** 2147 - * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data 2148 - * from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> 2149 - * property must be specified. 2150 - */ 2151 - setIcon(details: SetIconDetailsType): Promise<void>; 2152 - /** 2153 - * Sets the html document to be opened as a popup when the user clicks on the browser action's icon. 2154 - */ 2155 - setPopup(details: SetPopupDetailsType): Promise<void>; 2156 - /** 2157 - * Gets the html document set as the popup for this browser action. 2158 - */ 2159 - getPopup(details: Details): Promise<string>; 2160 - /** 2161 - * Sets the badge text for the browser action. The badge is displayed on top of the icon. 2162 - */ 2163 - setBadgeText(details: SetBadgeTextDetailsType): Promise<void>; 2164 - /** 2165 - * Gets the badge text of the browser action. If no tab nor window is specified is specified, 2166 - * the global badge text is returned. 2167 - */ 2168 - getBadgeText(details: Details): Promise<string>; 2169 - /** 2170 - * Sets the background color for the badge. 2171 - */ 2172 - setBadgeBackgroundColor(details: SetBadgeBackgroundColorDetailsType): Promise<void>; 2173 - /** 2174 - * Gets the background color of the browser action badge. 2175 - */ 2176 - getBadgeBackgroundColor(details: Details): Promise<ColorArray>; 2177 - /** 2178 - * Sets the text color for the badge. 2179 - */ 2180 - setBadgeTextColor(details: SetBadgeTextColorDetailsType): Promise<void>; 2181 - /** 2182 - * Gets the text color of the browser action badge. 2183 - */ 2184 - getBadgeTextColor(details: Details): Promise<ColorArray>; 2185 - /** 2186 - * Enables the browser action for a tab. By default, browser actions are enabled. 2187 - * 2188 - * @param tabId Optional. The id of the tab for which you want to modify the browser action. 2189 - */ 2190 - enable(tabId?: number): Promise<void>; 2191 - /** 2192 - * Disables the browser action for a tab. 2193 - * 2194 - * @param tabId Optional. The id of the tab for which you want to modify the browser action. 2195 - */ 2196 - disable(tabId?: number): Promise<void>; 2197 - /** 2198 - * Checks whether the browser action is enabled. 2199 - */ 2200 - isEnabled(details: Details): Promise<boolean>; 2201 - /** 2202 - * Opens the extension popup window in the specified window. 2203 - * 2204 - * @param options Optional. An object with information about the popup to open. 2205 - */ 2206 - openPopup(options?: OpenPopupOptionsType): Promise<void>; 2207 - /** 2208 - * Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. 2209 - * 2210 - * @param info Optional. 2211 - */ 2212 - onClicked: Events.Event<(tab: Browser.Tabs.Tab, info: OnClickData | undefined) => void>; 2213 - } 2214 - } 2215 - /** 2216 - * Namespace: browser.browserAction 2217 - */ 2218 - namespace BrowserAction { 2219 - interface Static extends Action.Static { 2220 - [s: string]: unknown; 2221 - } 2222 - } 2223 - /** 2224 - * Namespace: browser.browserSettings 2225 - */ 2226 - namespace BrowserSettings { 2227 - /** 2228 - * How images should be animated in the browser. 2229 - */ 2230 - type ImageAnimationBehavior = "normal" | "none" | "once"; 2231 - /** 2232 - * After which mouse event context menus should popup. 2233 - */ 2234 - type ContextMenuMouseEvent = "mouseup" | "mousedown"; 2235 - /** 2236 - * Color management mode. 2237 - */ 2238 - type ColorManagementMode = "off" | "full" | "tagged_only"; 2239 - interface Static { 2240 - /** 2241 - * Allows or disallows pop-up windows from opening in response to user events. 2242 - */ 2243 - allowPopupsForUserEvents: Browser.Types.Setting; 2244 - /** 2245 - * Enables or disables the browser cache. 2246 - */ 2247 - cacheEnabled: Browser.Types.Setting; 2248 - /** 2249 - * This boolean setting controls whether the selected tab can be closed with a double click. 2250 - */ 2251 - closeTabsByDoubleClick: Browser.Types.Setting; 2252 - /** 2253 - * Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent, 2254 - * which has possible values of <code>mouseup</code> and <code>mousedown</code>. 2255 - */ 2256 - contextMenuShowEvent: Browser.Types.Setting; 2257 - /** 2258 - * Returns the value of the overridden home page. Read-only. 2259 - */ 2260 - homepageOverride: Browser.Types.Setting; 2261 - /** 2262 - * Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior, 2263 - * defaulting to <code>normal</code>. 2264 - */ 2265 - imageAnimationBehavior: Browser.Types.Setting; 2266 - /** 2267 - * Returns the value of the overridden new tab page. Read-only. 2268 - */ 2269 - newTabPageOverride: Browser.Types.Setting; 2270 - /** 2271 - * Controls where new tabs are opened. `afterCurrent` will open all new tabs next to the current tab, 2272 - * `relatedAfterCurrent` will open only related tabs next to the current tab, and `atEnd` will open all tabs at the end of 2273 - * the tab strip. The default is `relatedAfterCurrent`. 2274 - */ 2275 - newTabPosition: Browser.Types.Setting; 2276 - /** 2277 - * This boolean setting controls whether bookmarks are opened in the current tab or in a new tab. 2278 - */ 2279 - openBookmarksInNewTabs: Browser.Types.Setting; 2280 - /** 2281 - * This boolean setting controls whether search results are opened in the current tab or in a new tab. 2282 - */ 2283 - openSearchResultsInNewTabs: Browser.Types.Setting; 2284 - /** 2285 - * This boolean setting controls whether urlbar results are opened in the current tab or in a new tab. 2286 - */ 2287 - openUrlbarResultsInNewTabs: Browser.Types.Setting; 2288 - /** 2289 - * Disables webAPI notifications. 2290 - */ 2291 - webNotificationsDisabled: Browser.Types.Setting; 2292 - /** 2293 - * This setting controls whether the user-chosen colors override the page's colors. 2294 - */ 2295 - overrideDocumentColors: Browser.Types.Setting; 2296 - /** 2297 - * This setting controls whether a light or dark color scheme overrides the page's preferred color scheme. 2298 - */ 2299 - overrideContentColorScheme: Browser.Types.Setting; 2300 - /** 2301 - * This setting controls whether the document's fonts are used. 2302 - */ 2303 - useDocumentFonts: Browser.Types.Setting; 2304 - /** 2305 - * This boolean setting controls whether zoom is applied to the full page or to text only. 2306 - */ 2307 - zoomFullPage: Browser.Types.Setting; 2308 - /** 2309 - * This boolean setting controls whether zoom is applied on a per-site basis or to the current tab only. If privacy. 2310 - * resistFingerprinting is true, this setting has no effect and zoom is applied to the current tab only. 2311 - */ 2312 - zoomSiteSpecific: Browser.Types.Setting; 2313 - colorManagement: ColorManagement.Static; 2314 - } 2315 - } 2316 - /** 2317 - * Namespace: browser.browsingData 2318 - */ 2319 - namespace BrowsingData { 2320 - /** 2321 - * Options that determine exactly what data will be removed. 2322 - */ 2323 - interface RemovalOptions { 2324 - /** 2325 - * Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code> 2326 - * getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all 2327 - * browsing data). 2328 - * Optional. 2329 - */ 2330 - since?: ExtensionTypes.DateType; 2331 - /** 2332 - * Only remove data associated with these hostnames (only applies to cookies and localStorage). 2333 - * Optional. 2334 - */ 2335 - hostnames?: string[]; 2336 - /** 2337 - * Only remove data associated with this specific cookieStoreId. 2338 - * Optional. 2339 - */ 2340 - cookieStoreId?: string; 2341 - /** 2342 - * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, 2343 - * it defaults to clearing only "unprotected" origins. Please ensure that you <em>really</em> 2344 - * want to remove application data before adding 'protectedWeb' or 'extensions'. 2345 - * Optional. 2346 - */ 2347 - originTypes?: RemovalOptionsOriginTypesType; 2348 - } 2349 - /** 2350 - * A set of data types. Missing data types are interpreted as <code>false</code>. 2351 - */ 2352 - interface DataTypeSet { 2353 - /** 2354 - * The browser's cache. Note: when removing data, this clears the <em>entire</em> cache: it is not limited to the range you 2355 - * specify. 2356 - * Optional. 2357 - */ 2358 - cache?: boolean; 2359 - /** 2360 - * The browser's cookies. 2361 - * Optional. 2362 - */ 2363 - cookies?: boolean; 2364 - /** 2365 - * The browser's download list. 2366 - * Optional. 2367 - */ 2368 - downloads?: boolean; 2369 - /** 2370 - * The browser's stored form data. 2371 - * Optional. 2372 - */ 2373 - formData?: boolean; 2374 - /** 2375 - * The browser's history. 2376 - * Optional. 2377 - */ 2378 - history?: boolean; 2379 - /** 2380 - * Websites' IndexedDB data. 2381 - * Optional. 2382 - */ 2383 - indexedDB?: boolean; 2384 - /** 2385 - * Websites' local storage data. 2386 - * Optional. 2387 - */ 2388 - localStorage?: boolean; 2389 - /** 2390 - * Server-bound certificates. 2391 - * Optional. 2392 - */ 2393 - serverBoundCertificates?: boolean; 2394 - /** 2395 - * Stored passwords. 2396 - * Optional. 2397 - */ 2398 - passwords?: boolean; 2399 - /** 2400 - * Plugins' data. 2401 - * Optional. 2402 - */ 2403 - pluginData?: boolean; 2404 - /** 2405 - * Service Workers. 2406 - * Optional. 2407 - */ 2408 - serviceWorkers?: boolean; 2409 - } 2410 - interface SettingsCallbackResultType { 2411 - options: RemovalOptions; 2412 - /** 2413 - * All of the types will be present in the result, with values of <code>true</code> if they are both selected to be removed 2414 - * and permitted to be removed, otherwise <code>false</code>. 2415 - */ 2416 - dataToRemove: DataTypeSet; 2417 - /** 2418 - * All of the types will be present in the result, with values of <code>true</code> if they are permitted to be removed (e. 2419 - * g., by enterprise policy) and <code>false</code> if not. 2420 - */ 2421 - dataRemovalPermitted: DataTypeSet; 2422 - } 2423 - /** 2424 - * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, 2425 - * it defaults to clearing only "unprotected" origins. Please ensure that you <em>really</em> 2426 - * want to remove application data before adding 'protectedWeb' or 'extensions'. 2427 - */ 2428 - interface RemovalOptionsOriginTypesType { 2429 - /** 2430 - * Normal websites. 2431 - * Optional. 2432 - */ 2433 - unprotectedWeb?: boolean; 2434 - /** 2435 - * Websites that have been installed as hosted applications (be careful!). 2436 - * Optional. 2437 - */ 2438 - protectedWeb?: boolean; 2439 - /** 2440 - * Extensions and packaged applications a user has installed (be _really_ careful!). 2441 - * Optional. 2442 - */ 2443 - extension?: boolean; 2444 - } 2445 - interface Static { 2446 - /** 2447 - * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. 2448 - * Note: some of the data types included in this API are not available in the settings UI, 2449 - * and some UI settings control more than one data type listed here. 2450 - */ 2451 - settings(): Promise<SettingsCallbackResultType>; 2452 - /** 2453 - * Clears various types of browsing data stored in a user's profile. 2454 - * 2455 - * @param dataToRemove The set of data types to remove. 2456 - * @returns Called when deletion has completed. 2457 - */ 2458 - remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise<void>; 2459 - /** 2460 - * Clears the browser's cache. 2461 - * 2462 - * @returns Called when the browser's cache has been cleared. 2463 - */ 2464 - removeCache(options: RemovalOptions): Promise<void>; 2465 - /** 2466 - * Clears the browser's cookies and server-bound certificates modified within a particular timeframe. 2467 - * 2468 - * @returns Called when the browser's cookies and server-bound certificates have been cleared. 2469 - */ 2470 - removeCookies(options: RemovalOptions): Promise<void>; 2471 - /** 2472 - * Clears the browser's list of downloaded files (<em>not</em> the downloaded files themselves). 2473 - * 2474 - * @returns Called when the browser's list of downloaded files has been cleared. 2475 - */ 2476 - removeDownloads(options: RemovalOptions): Promise<void>; 2477 - /** 2478 - * Clears the browser's stored form data (autofill). 2479 - * 2480 - * @returns Called when the browser's form data has been cleared. 2481 - */ 2482 - removeFormData(options: RemovalOptions): Promise<void>; 2483 - /** 2484 - * Clears the browser's history. 2485 - * 2486 - * @returns Called when the browser's history has cleared. 2487 - */ 2488 - removeHistory(options: RemovalOptions): Promise<void>; 2489 - /** 2490 - * Clears websites' local storage data. 2491 - * 2492 - * @returns Called when websites' local storage has been cleared. 2493 - */ 2494 - removeLocalStorage(options: RemovalOptions): Promise<void>; 2495 - /** 2496 - * Clears plugins' data. 2497 - * 2498 - * @returns Called when plugins' data has been cleared. 2499 - */ 2500 - removePluginData(options: RemovalOptions): Promise<void>; 2501 - /** 2502 - * Clears the browser's stored passwords. 2503 - * 2504 - * @returns Called when the browser's passwords have been cleared. 2505 - */ 2506 - removePasswords(options: RemovalOptions): Promise<void>; 2507 - } 2508 - } 2509 - /** 2510 - * Namespace: browser.captivePortal 2511 - */ 2512 - namespace CaptivePortal { 2513 - interface OnStateChangedDetailsType { 2514 - /** 2515 - * The current captive portal state. 2516 - */ 2517 - state: OnStateChangedDetailsTypeStateEnum; 2518 - } 2519 - type OnConnectivityAvailableStatusEnum = "captive" | "clear"; 2520 - /** 2521 - * The current captive portal state. 2522 - */ 2523 - type OnStateChangedDetailsTypeStateEnum = "unknown" | "not_captive" | "unlocked_portal" | "locked_portal"; 2524 - interface Static { 2525 - /** 2526 - * Returns the current portal state, one of `unknown`, `not_captive`, `unlocked_portal`, `locked_portal`. 2527 - */ 2528 - getState(): Promise<"unknown" | "not_captive" | "unlocked_portal" | "locked_portal">; 2529 - /** 2530 - * Returns the time difference between NOW and the last time a request was completed in milliseconds. 2531 - */ 2532 - getLastChecked(): Promise<number>; 2533 - /** 2534 - * Fired when the captive portal state changes. 2535 - */ 2536 - onStateChanged: Events.Event<(details: OnStateChangedDetailsType) => void>; 2537 - /** 2538 - * This notification will be emitted when the captive portal service has determined that we can connect to the internet. 2539 - * The service will pass either `captive` if there is an unlocked captive portal present, 2540 - * or `clear` if no captive portal was detected. 2541 - */ 2542 - onConnectivityAvailable: Events.Event<(status: OnConnectivityAvailableStatusEnum) => void>; 2543 - /** 2544 - * Return the canonical captive-portal detection URL. Read-only. 2545 - */ 2546 - canonicalURL: Browser.Types.Setting; 2547 - } 2548 - } 2549 - /** 2550 - * Namespace: browser.clipboard 2551 - */ 2552 - namespace Clipboard { 2553 - /** 2554 - * The type of imageData. 2555 - */ 2556 - type SetImageDataImageTypeEnum = "jpeg" | "png"; 2557 - interface Static { 2558 - /** 2559 - * Copy an image to the clipboard. The image is re-encoded before it is written to the clipboard. If the image is invalid, 2560 - * the clipboard is not modified. 2561 - * 2562 - * @param imageData The image data to be copied. 2563 - * @param imageType The type of imageData. 2564 - */ 2565 - setImageData(imageData: ArrayBuffer, imageType: SetImageDataImageTypeEnum): Promise<void>; 2566 - } 2567 - } 2568 - /** 2569 - * Namespace: browser.commands 2570 - */ 2571 - namespace Commands { 2572 - interface Command { 2573 - /** 2574 - * The name of the Extension Command 2575 - * Optional. 2576 - */ 2577 - name?: string; 2578 - /** 2579 - * The Extension Command description 2580 - * Optional. 2581 - */ 2582 - description?: string; 2583 - /** 2584 - * The shortcut active for this command, or blank if not active. 2585 - * Optional. 2586 - */ 2587 - shortcut?: string; 2588 - } 2589 - /** 2590 - * The new description for the command. 2591 - */ 2592 - interface UpdateDetailType { 2593 - /** 2594 - * The name of the command. 2595 - */ 2596 - name: string; 2597 - /** 2598 - * The new description for the command. 2599 - * Optional. 2600 - */ 2601 - description?: string; 2602 - /** 2603 - * Optional. 2604 - */ 2605 - shortcut?: string; 2606 - } 2607 - interface OnChangedChangeInfoType { 2608 - /** 2609 - * The name of the shortcut. 2610 - */ 2611 - name: string; 2612 - /** 2613 - * The new shortcut active for this command, or blank if not active. 2614 - */ 2615 - newShortcut: string; 2616 - /** 2617 - * The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive. 2618 - */ 2619 - oldShortcut: string; 2620 - } 2621 - interface Static { 2622 - /** 2623 - * Update the details of an already defined command. 2624 - * 2625 - * @param detail The new description for the command. 2626 - */ 2627 - update(detail: UpdateDetailType): Promise<void>; 2628 - /** 2629 - * Reset a command's details to what is specified in the manifest. 2630 - * 2631 - * @param name The name of the command. 2632 - */ 2633 - reset(name: string): Promise<void>; 2634 - /** 2635 - * Returns all the registered extension commands for this extension and their shortcut (if active). 2636 - * 2637 - * @returns Called to return the registered commands. 2638 - */ 2639 - getAll(): Promise<Command[]>; 2640 - /** 2641 - * Open extension shortcuts configuration page. 2642 - */ 2643 - openShortcutSettings(): void; 2644 - /** 2645 - * Fired when a registered command is activated using a keyboard shortcut. 2646 - * 2647 - * @param tab Optional. Details of the $(ref:tabs.Tab) where the command was activated. 2648 - */ 2649 - onCommand: Events.Event<(command: string, tab: Browser.Tabs.Tab | undefined) => void>; 2650 - /** 2651 - * Fired when a registered command's shortcut is changed. 2652 - */ 2653 - onChanged: Events.Event<(changeInfo: OnChangedChangeInfoType) => void>; 2654 - } 2655 - } 2656 - /** 2657 - * Namespace: browser.contentScripts 2658 - */ 2659 - namespace ContentScripts { 2660 - /** 2661 - * Details of a content script registered programmatically 2662 - */ 2663 - interface RegisteredContentScriptOptions { 2664 - matches: Browser.Manifest.MatchPattern[]; 2665 - /** 2666 - * Optional. 2667 - */ 2668 - excludeMatches?: Browser.Manifest.MatchPattern[]; 2669 - /** 2670 - * Optional. 2671 - */ 2672 - includeGlobs?: string[]; 2673 - /** 2674 - * Optional. 2675 - */ 2676 - excludeGlobs?: string[]; 2677 - /** 2678 - * The list of CSS files to inject 2679 - * Optional. 2680 - */ 2681 - css?: Browser.ExtensionTypes.ExtensionFileOrCode[]; 2682 - /** 2683 - * The list of JS files to inject 2684 - * Optional. 2685 - */ 2686 - js?: Browser.ExtensionTypes.ExtensionFileOrCode[]; 2687 - /** 2688 - * If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. 2689 - * By default, it's <code>false</code> and is only injected into the top frame. 2690 - * Optional. 2691 - */ 2692 - allFrames?: boolean; 2693 - /** 2694 - * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has 2695 - * access to its parent document. Ignored if matchOriginAsFallback is specified. By default it is <code>false</code>. 2696 - * Optional. 2697 - */ 2698 - matchAboutBlank?: boolean; 2699 - /** 2700 - * If matchOriginAsFallback is true, then the code is also injected in about:, data:, 2701 - * blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use 2702 - * of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is <code> 2703 - * false</code>. 2704 - * Optional. 2705 - */ 2706 - matchOriginAsFallback?: boolean; 2707 - /** 2708 - * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". 2709 - * Optional. 2710 - */ 2711 - runAt?: Browser.ExtensionTypes.RunAt; 2712 - /** 2713 - * The JavaScript world for a script to execute within. Defaults to "ISOLATED". 2714 - * Optional. 2715 - */ 2716 - world?: Browser.ExtensionTypes.ExecutionWorld; 2717 - /** 2718 - * limit the set of matched tabs to those that belong to the given cookie store id 2719 - * Optional. 2720 - */ 2721 - cookieStoreId?: string[] | string; 2722 - } 2723 - /** 2724 - * An object that represents a content script registered programmatically 2725 - */ 2726 - interface RegisteredContentScript { 2727 - /** 2728 - * Unregister a content script registered programmatically 2729 - */ 2730 - unregister(): Promise<void>; 2731 - } 2732 - interface Static { 2733 - /** 2734 - * Register a content script programmatically 2735 - */ 2736 - register(contentScriptOptions: RegisteredContentScriptOptions): Promise<RegisteredContentScript>; 2737 - } 2738 - } 2739 - /** 2740 - * Namespace: browser.contextualIdentities 2741 - */ 2742 - namespace ContextualIdentities { 2743 - /** 2744 - * Represents information about a contextual identity. 2745 - */ 2746 - interface ContextualIdentity { 2747 - /** 2748 - * The name of the contextual identity. 2749 - */ 2750 - name: string; 2751 - /** 2752 - * The icon name of the contextual identity. 2753 - */ 2754 - icon: string; 2755 - /** 2756 - * The icon url of the contextual identity. 2757 - */ 2758 - iconUrl: string; 2759 - /** 2760 - * The color name of the contextual identity. 2761 - */ 2762 - color: string; 2763 - /** 2764 - * The color hash of the contextual identity. 2765 - */ 2766 - colorCode: string; 2767 - /** 2768 - * The cookie store ID of the contextual identity. 2769 - */ 2770 - cookieStoreId: string; 2771 - } 2772 - /** 2773 - * Information to filter the contextual identities being retrieved. 2774 - */ 2775 - interface QueryDetailsType { 2776 - /** 2777 - * Filters the contextual identity by name. 2778 - * Optional. 2779 - */ 2780 - name?: string; 2781 - } 2782 - /** 2783 - * Details about the contextual identity being created. 2784 - */ 2785 - interface CreateDetailsType { 2786 - /** 2787 - * The name of the contextual identity. 2788 - */ 2789 - name: string; 2790 - /** 2791 - * The color of the contextual identity. 2792 - */ 2793 - color: string; 2794 - /** 2795 - * The icon of the contextual identity. 2796 - */ 2797 - icon: string; 2798 - } 2799 - /** 2800 - * Details about the contextual identity being created. 2801 - */ 2802 - interface UpdateDetailsType { 2803 - /** 2804 - * The name of the contextual identity. 2805 - * Optional. 2806 - */ 2807 - name?: string; 2808 - /** 2809 - * The color of the contextual identity. 2810 - * Optional. 2811 - */ 2812 - color?: string; 2813 - /** 2814 - * The icon of the contextual identity. 2815 - * Optional. 2816 - */ 2817 - icon?: string; 2818 - } 2819 - interface OnUpdatedChangeInfoType { 2820 - /** 2821 - * Contextual identity that has been updated 2822 - */ 2823 - contextualIdentity: ContextualIdentity; 2824 - } 2825 - interface OnCreatedChangeInfoType { 2826 - /** 2827 - * Contextual identity that has been created 2828 - */ 2829 - contextualIdentity: ContextualIdentity; 2830 - } 2831 - interface OnRemovedChangeInfoType { 2832 - /** 2833 - * Contextual identity that has been removed 2834 - */ 2835 - contextualIdentity: ContextualIdentity; 2836 - } 2837 - interface Static { 2838 - /** 2839 - * Retrieves information about a single contextual identity. 2840 - * 2841 - * @param cookieStoreId The ID of the contextual identity cookie store. 2842 - */ 2843 - get(cookieStoreId: string): Promise<ContextualIdentity>; 2844 - /** 2845 - * Retrieves all contextual identities 2846 - * 2847 - * @param details Information to filter the contextual identities being retrieved. 2848 - */ 2849 - query(details: QueryDetailsType): Promise<ContextualIdentity[]>; 2850 - /** 2851 - * Creates a contextual identity with the given data. 2852 - * 2853 - * @param details Details about the contextual identity being created. 2854 - */ 2855 - create(details: CreateDetailsType): Promise<ContextualIdentity>; 2856 - /** 2857 - * Updates a contextual identity with the given data. 2858 - * 2859 - * @param cookieStoreId The ID of the contextual identity cookie store. 2860 - * @param details Details about the contextual identity being created. 2861 - */ 2862 - update(cookieStoreId: string, details: UpdateDetailsType): Promise<ContextualIdentity>; 2863 - /** 2864 - * Reorder one or more contextual identities by their cookieStoreIDs to a given position. 2865 - * 2866 - * @param cookieStoreIds The ID or list of IDs of the contextual identity cookie stores. 2867 - * @param position The position the contextual identity should move to. 2868 - */ 2869 - move(cookieStoreIds: string | string[], position: number): Promise<void>; 2870 - /** 2871 - * Deletes a contextual identity by its cookie Store ID. 2872 - * 2873 - * @param cookieStoreId The ID of the contextual identity cookie store. 2874 - */ 2875 - remove(cookieStoreId: string): Promise<ContextualIdentity>; 2876 - /** 2877 - * Fired when a container is updated. 2878 - */ 2879 - onUpdated: Events.Event<(changeInfo: OnUpdatedChangeInfoType) => void>; 2880 - /** 2881 - * Fired when a new container is created. 2882 - */ 2883 - onCreated: Events.Event<(changeInfo: OnCreatedChangeInfoType) => void>; 2884 - /** 2885 - * Fired when a container is removed. 2886 - */ 2887 - onRemoved: Events.Event<(changeInfo: OnRemovedChangeInfoType) => void>; 2888 - } 2889 - } 2890 - /** 2891 - * Namespace: browser.cookies 2892 - */ 2893 - namespace Cookies { 2894 - /** 2895 - * A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 2896 - * 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', 2897 - * and 'strict' to 'SameSite=Strict'. 2898 - */ 2899 - type SameSiteStatus = "unspecified" | "no_restriction" | "lax" | "strict"; 2900 - /** 2901 - * The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned. 2902 - */ 2903 - interface PartitionKey { 2904 - /** 2905 - * The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site. 2906 - * Optional. 2907 - */ 2908 - topLevelSite?: string; 2909 - /** 2910 - * Whether or not the cookie is in a third-party context, respecting ancestor chains. 2911 - * Optional. 2912 - */ 2913 - hasCrossSiteAncestor?: boolean; 2914 - } 2915 - /** 2916 - * Represents information about an HTTP cookie. 2917 - */ 2918 - interface Cookie { 2919 - /** 2920 - * The name of the cookie. 2921 - */ 2922 - name: string; 2923 - /** 2924 - * The value of the cookie. 2925 - */ 2926 - value: string; 2927 - /** 2928 - * The domain of the cookie (e.g. "www.google.com", "example.com"). 2929 - */ 2930 - domain: string; 2931 - /** 2932 - * True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). 2933 - */ 2934 - hostOnly: boolean; 2935 - /** 2936 - * The path of the cookie. 2937 - */ 2938 - path: string; 2939 - /** 2940 - * True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS). 2941 - */ 2942 - secure: boolean; 2943 - /** 2944 - * True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). 2945 - */ 2946 - httpOnly: boolean; 2947 - /** 2948 - * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests). 2949 - */ 2950 - sameSite: SameSiteStatus; 2951 - /** 2952 - * True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date. 2953 - */ 2954 - session: boolean; 2955 - /** 2956 - * The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. 2957 - * Optional. 2958 - */ 2959 - expirationDate?: number; 2960 - /** 2961 - * The ID of the cookie store containing this cookie, as provided in getAllCookieStores(). 2962 - */ 2963 - storeId: string; 2964 - /** 2965 - * The first-party domain of the cookie. 2966 - */ 2967 - firstPartyDomain: string; 2968 - /** 2969 - * The cookie's storage partition, if any. null if not partitioned. 2970 - * Optional. 2971 - */ 2972 - partitionKey?: PartitionKey; 2973 - } 2974 - /** 2975 - * Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a 2976 - * non-incognito window. 2977 - */ 2978 - interface CookieStore { 2979 - /** 2980 - * The unique identifier for the cookie store. 2981 - */ 2982 - id: string; 2983 - /** 2984 - * Identifiers of all the browser tabs that share this cookie store. 2985 - */ 2986 - tabIds: number[]; 2987 - /** 2988 - * Indicates if this is an incognito cookie store 2989 - */ 2990 - incognito: boolean; 2991 - } 2992 - /** 2993 - * The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to 2994 - * $(ref:cookies.remove), "cause" will be "explicit". If a cookie was automatically removed due to expiry, 2995 - * "cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date, 2996 - * "cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection, 2997 - * "cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it, 2998 - * "cause" will be "overwrite". Plan your response accordingly. 2999 - */ 3000 - type OnChangedCause = "evicted" | "expired" | "explicit" | "expired_overwrite" | "overwrite"; 3001 - /** 3002 - * Details to identify the cookie being retrieved. 3003 - */ 3004 - interface GetDetailsType { 3005 - /** 3006 - * The URL with which the cookie to retrieve is associated. This argument may be a full URL, 3007 - * in which case any data following the URL path (e.g. the query string) is simply ignored. 3008 - * If host permissions for this URL are not specified in the manifest file, the API call will fail. 3009 - */ 3010 - url: string; 3011 - /** 3012 - * The name of the cookie to retrieve. 3013 - */ 3014 - name: string; 3015 - /** 3016 - * The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store 3017 - * will be used. 3018 - * Optional. 3019 - */ 3020 - storeId?: string; 3021 - /** 3022 - * The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation 3023 - * is enabled. 3024 - * Optional. 3025 - */ 3026 - firstPartyDomain?: string; 3027 - /** 3028 - * The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are 3029 - * returned. 3030 - * Optional. 3031 - */ 3032 - partitionKey?: PartitionKey; 3033 - } 3034 - /** 3035 - * Information to filter the cookies being retrieved. 3036 - */ 3037 - interface GetAllDetailsType { 3038 - /** 3039 - * Restricts the retrieved cookies to those that would match the given URL. 3040 - * Optional. 3041 - */ 3042 - url?: string; 3043 - /** 3044 - * Filters the cookies by name. 3045 - * Optional. 3046 - */ 3047 - name?: string; 3048 - /** 3049 - * Restricts the retrieved cookies to those whose domains match or are subdomains of this one. 3050 - * Optional. 3051 - */ 3052 - domain?: string; 3053 - /** 3054 - * Restricts the retrieved cookies to those whose path exactly matches this string. 3055 - * Optional. 3056 - */ 3057 - path?: string; 3058 - /** 3059 - * Filters the cookies by their Secure property. 3060 - * Optional. 3061 - */ 3062 - secure?: boolean; 3063 - /** 3064 - * Filters out session vs. persistent cookies. 3065 - * Optional. 3066 - */ 3067 - session?: boolean; 3068 - /** 3069 - * The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. 3070 - * Optional. 3071 - */ 3072 - storeId?: string; 3073 - /** 3074 - * Restricts the retrieved cookies to those whose first-party domains match this one. 3075 - * This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, 3076 - * use `null` or `undefined`. 3077 - * Optional. 3078 - */ 3079 - firstPartyDomain?: string | null; 3080 - /** 3081 - * Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies 3082 - * are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in 3083 - * the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), 3084 - * a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes. 3085 - * Optional. 3086 - */ 3087 - partitionKey?: PartitionKey; 3088 - } 3089 - /** 3090 - * Details about the cookie being set. 3091 - */ 3092 - interface SetDetailsType { 3093 - /** 3094 - * The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of 3095 - * the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. 3096 - */ 3097 - url: string; 3098 - /** 3099 - * The name of the cookie. Empty by default if omitted. 3100 - * Optional. 3101 - */ 3102 - name?: string; 3103 - /** 3104 - * The value of the cookie. Empty by default if omitted. 3105 - * Optional. 3106 - */ 3107 - value?: string; 3108 - /** 3109 - * The domain of the cookie. If omitted, the cookie becomes a host-only cookie. 3110 - * Optional. 3111 - */ 3112 - domain?: string; 3113 - /** 3114 - * The path of the cookie. Defaults to the path portion of the url parameter. 3115 - * Optional. 3116 - */ 3117 - path?: string; 3118 - /** 3119 - * Whether the cookie should be marked as Secure. Defaults to false. 3120 - * Optional. 3121 - */ 3122 - secure?: boolean; 3123 - /** 3124 - * Whether the cookie should be marked as HttpOnly. Defaults to false. 3125 - * Optional. 3126 - */ 3127 - httpOnly?: boolean; 3128 - /** 3129 - * The cookie's same-site status. 3130 - * Optional. 3131 - */ 3132 - sameSite?: SameSiteStatus; 3133 - /** 3134 - * The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, 3135 - * the cookie becomes a session cookie. 3136 - * Optional. 3137 - */ 3138 - expirationDate?: number; 3139 - /** 3140 - * The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's 3141 - * cookie store. 3142 - * Optional. 3143 - */ 3144 - storeId?: string; 3145 - /** 3146 - * The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled. 3147 - * Optional. 3148 - */ 3149 - firstPartyDomain?: string; 3150 - /** 3151 - * The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used. 3152 - * Optional. 3153 - */ 3154 - partitionKey?: PartitionKey; 3155 - } 3156 - /** 3157 - * Information to identify the cookie to remove. 3158 - */ 3159 - interface RemoveDetailsType { 3160 - /** 3161 - * The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, 3162 - * the API call will fail. 3163 - */ 3164 - url: string; 3165 - /** 3166 - * The name of the cookie to remove. 3167 - */ 3168 - name: string; 3169 - /** 3170 - * The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current 3171 - * execution context's cookie store. 3172 - * Optional. 3173 - */ 3174 - storeId?: string; 3175 - /** 3176 - * The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled. 3177 - * Optional. 3178 - */ 3179 - firstPartyDomain?: string; 3180 - /** 3181 - * The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used. 3182 - * Optional. 3183 - */ 3184 - partitionKey?: PartitionKey; 3185 - } 3186 - /** 3187 - * Contains details about the cookie that's been removed. If removal failed for any reason, this will be "null", 3188 - * and $(ref:runtime.lastError) will be set. 3189 - */ 3190 - interface RemoveCallbackDetailsType { 3191 - /** 3192 - * The URL associated with the cookie that's been removed. 3193 - */ 3194 - url: string; 3195 - /** 3196 - * The name of the cookie that's been removed. 3197 - */ 3198 - name: string; 3199 - /** 3200 - * The ID of the cookie store from which the cookie was removed. 3201 - */ 3202 - storeId: string; 3203 - /** 3204 - * The first-party domain associated with the cookie that's been removed. 3205 - */ 3206 - firstPartyDomain: string; 3207 - /** 3208 - * The storage partition, if the cookie is part of partitioned storage. null if not partitioned. 3209 - * Optional. 3210 - */ 3211 - partitionKey?: PartitionKey; 3212 - } 3213 - interface OnChangedChangeInfoType { 3214 - /** 3215 - * True if a cookie was removed. 3216 - */ 3217 - removed: boolean; 3218 - /** 3219 - * Information about the cookie that was set or removed. 3220 - */ 3221 - cookie: Cookie; 3222 - /** 3223 - * The underlying reason behind the cookie's change. 3224 - */ 3225 - cause: OnChangedCause; 3226 - } 3227 - interface Static { 3228 - /** 3229 - * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, 3230 - * the one with the longest path will be returned. For cookies with the same path length, 3231 - * the cookie with the earliest creation time will be returned. 3232 - * 3233 - * @param details Details to identify the cookie being retrieved. 3234 - */ 3235 - get(details: GetDetailsType): Promise<Cookie | null>; 3236 - /** 3237 - * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, 3238 - * with those with the longest path first. If multiple cookies have the same path length, 3239 - * those with the earliest creation time will be first. 3240 - * 3241 - * @param details Information to filter the cookies being retrieved. 3242 - */ 3243 - getAll(details: GetAllDetailsType): Promise<Cookie[]>; 3244 - /** 3245 - * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. 3246 - * 3247 - * @param details Details about the cookie being set. 3248 - */ 3249 - set(details: SetDetailsType): Promise<Cookie>; 3250 - /** 3251 - * Deletes a cookie by name. 3252 - * 3253 - * @param details Information to identify the cookie to remove. 3254 - */ 3255 - remove(details: RemoveDetailsType): Promise<RemoveCallbackDetailsType | null>; 3256 - /** 3257 - * Lists all existing cookie stores. 3258 - */ 3259 - getAllCookieStores(): Promise<CookieStore[]>; 3260 - /** 3261 - * Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a 3262 - * two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of 3263 - * "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with 3264 - * "cause" "explicit". 3265 - */ 3266 - onChanged: Events.Event<(changeInfo: OnChangedChangeInfoType) => void>; 3267 - } 3268 - } 3269 - /** 3270 - * Namespace: browser.declarativeContent 3271 - */ 3272 - namespace DeclarativeContent { 3273 - /** 3274 - * See <a href="https://developer.mozilla.org/en-US/docs/Web/API/ImageData">https://developer.mozilla. 3275 - * org/en-US/docs/Web/API/ImageData</a>. 3276 - */ 3277 - interface ImageDataType extends ImageData { 3278 - [s: string]: unknown; 3279 - } 3280 - /** 3281 - * Matches the state of a web page based on various criteria. 3282 - */ 3283 - interface PageStateMatcher { 3284 - /** 3285 - * Matches if the conditions of the <code>UrlFilter</code> are fulfilled for the top-level URL of the page. 3286 - * Optional. 3287 - */ 3288 - pageUrl?: Browser.Events.UrlFilter; 3289 - /** 3290 - * Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's 3291 - * main frame. All selectors in this array must be <a href="http://www.w3.org/TR/selectors4/#compound"> 3292 - * compound selectors</a> to speed up matching. Note: Listing hundreds of CSS selectors or listing CSS selectors that match 3293 - * hundreds of times per page can slow down web sites. 3294 - * Optional. 3295 - */ 3296 - css?: string[]; 3297 - /** 3298 - * Matches if the bookmarked state of the page is equal to the specified value. Requres the <a 3299 - * href='/docs/extensions/develop/concepts/declare-permissions'>bookmarks permission</a>. 3300 - * Optional. 3301 - */ 3302 - isBookmarked?: boolean; 3303 - } 3304 - /** 3305 - * Please use ShowAction. 3306 - */ 3307 - type ShowPageAction = never; 3308 - /** 3309 - * A declarative event action that sets the extension's toolbar $(ref:action action) to an enabled state while the 3310 - * corresponding conditions are met. This action can be used without <a 3311 - * href="/docs/extensions/develop/concepts/declare-permissions#host-permissions">host permissions</a>. 3312 - * If the extension has the <a href="/docs/extensions/develop/concepts/activeTab">activeTab</a> permission, 3313 - * clicking the page action grants access to the active tab.<p>On pages where the conditions are not met the extension's 3314 - * toolbar action will be grey-scale, and clicking it will open the context menu, instead of triggering the action.</p> 3315 - */ 3316 - interface ShowAction { 3317 - [s: string]: unknown; 3318 - } 3319 - /** 3320 - * Declarative event action that sets the n-<abbr title="device-independent pixel">dip</abbr> 3321 - * square icon for the extension's $(ref:pageAction page action) or $(ref:browserAction browser action) 3322 - * while the corresponding conditions are met. This action can be used without <a 3323 - * href="/docs/extensions/develop/concepts/declare-permissions#host-permissions">host permissions</a>, 3324 - * but the extension must have a page or browser action.<p>Exactly one of <code>imageData</code> or <code>path</code> 3325 - * must be specified. Both are dictionaries mapping a number of pixels to an image representation. 3326 - * The image representation in <code>imageData</code> is an <a href="https://developer.mozilla. 3327 - * org/en-US/docs/Web/API/ImageData">ImageData</a> object; for example, from a <code>canvas</code> element, 3328 - * while the image representation in <code>path</code> is the path to an image file relative to the extension's manifest. 3329 - * If <code>scale</code> screen pixels fit into a device-independent pixel, the <code>scale * n</code> icon is used. 3330 - * If that scale is missing, another image is resized to the required size.</p> 3331 - */ 3332 - interface SetIcon { 3333 - /** 3334 - * Either an <code>ImageData</code> object or a dictionary {size -> ImageData} representing an icon to be set. 3335 - * If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. 3336 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, 3337 - * then an image with size <code>scale * n</code> is selected, where <i>n</i> is the size of the icon in the UI. 3338 - * At least one image must be specified. Note that <code>details.imageData = foo</code> is equivalent to <code>details. 3339 - * imageData = {'16': foo}</code>. 3340 - * Optional. 3341 - */ 3342 - imageData?: ImageDataType | SetIconImageDataC2Type; 3343 - } 3344 - /** 3345 - * Declarative event action that injects a content script. <p><b>WARNING:</b> This action is still experimental and is not 3346 - * supported on stable builds of Chrome.</p> 3347 - */ 3348 - interface RequestContentScript { 3349 - /** 3350 - * Names of CSS files to be injected as a part of the content script. 3351 - * Optional. 3352 - */ 3353 - css?: string[]; 3354 - /** 3355 - * Names of JavaScript files to be injected as a part of the content script. 3356 - * Optional. 3357 - */ 3358 - js?: string[]; 3359 - /** 3360 - * Whether the content script runs in all frames of the matching page, or in only the top frame. Default is <code> 3361 - * false</code>. 3362 - * Optional. 3363 - */ 3364 - allFrames?: boolean; 3365 - /** 3366 - * Whether to insert the content script on <code>about:blank</code> and <code>about:srcdoc</code>. Default is <code> 3367 - * false</code>. 3368 - * Optional. 3369 - */ 3370 - matchAboutBlank?: boolean; 3371 - } 3372 - interface Rule<TCondition, TAction> { 3373 - /** 3374 - * List of conditions that can trigger the actions. 3375 - */ 3376 - conditions: TCondition[]; 3377 - /** 3378 - * List of actions that are triggered if one of the conditions is fulfilled. 3379 - */ 3380 - actions: TAction[]; 3381 - } 3382 - /** 3383 - * An object which allows the addition and removal of rules for declarative content. 3384 - */ 3385 - interface RuleEvent<TCondition, TAction> { 3386 - /** 3387 - * Registers rules to handle events. 3388 - * 3389 - * @param rules Rules to be registered. These do not replace previously registered rules. 3390 - */ 3391 - addRules(rules: Array<Rule<TCondition, TAction>>): void; 3392 - /** 3393 - * Fetches currently registered rules. 3394 - * 3395 - * @param rules Optional. Rule ids to fetch. 3396 - * @param callback Optional. Called when rules have been fetched. 3397 - */ 3398 - getRules(rules?: string[], callback?: (rules: Array<Rule<TCondition, TAction>>) => void): void; 3399 - /** 3400 - * Unregisters currently registered rules. 3401 - * 3402 - * @param rules Optional. Rule ids to be unregistered. 3403 - * @param callback Optional. Called when rules were unregistered. 3404 - */ 3405 - removeRules(rules?: string[], callback?: () => void): void; 3406 - } 3407 - interface SetIconImageDataC2Type { 3408 - [s: string]: unknown; 3409 - } 3410 - interface Static { 3411 - PageStateMatcher: { 3412 - new (options?: PageStateMatcher): PageStateMatcher; 3413 - }; 3414 - ShowAction: { 3415 - new (options?: ShowAction): ShowAction; 3416 - }; 3417 - SetIcon: { 3418 - new (options?: SetIcon): SetIcon; 3419 - }; 3420 - RequestContentScript: { 3421 - new (options?: RequestContentScript): RequestContentScript; 3422 - }; 3423 - onPageChanged: RuleEvent<PageStateMatcher, RequestContentScript | SetIcon | ShowPageAction | ShowAction>; 3424 - } 3425 - } 3426 - /** 3427 - * Namespace: browser.declarativeNetRequest 3428 - */ 3429 - namespace DeclarativeNetRequest { 3430 - /** 3431 - * How the requested resource will be used. Comparable to the webRequest.ResourceType type. 3432 - * object_subrequest is unsupported. 3433 - */ 3434 - type ResourceType = "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "object" | "object_subrequest" | "xmlhttprequest" | "xslt" | "ping" | "beacon" | "xml_dtd" | "font" | "media" | "websocket" | "csp_report" | "imageset" | "web_manifest" | "speculative" | "json" | "other"; 3435 - /** 3436 - * Describes the reason why a given regular expression isn't supported. 3437 - */ 3438 - type UnsupportedRegexReason = "syntaxError" | "memoryLimitExceeded"; 3439 - interface MatchedRule { 3440 - /** 3441 - * A matching rule's ID. 3442 - */ 3443 - ruleId: number; 3444 - /** 3445 - * ID of the Ruleset this rule belongs to. 3446 - */ 3447 - rulesetId: string; 3448 - /** 3449 - * ID of the extension, if this rule belongs to a different extension. 3450 - * Optional. 3451 - */ 3452 - extensionId?: string; 3453 - } 3454 - /** 3455 - * Describes the type of the Rule.action.redirect.transform property. 3456 - */ 3457 - interface URLTransform { 3458 - /** 3459 - * The new scheme for the request. 3460 - * Optional. 3461 - */ 3462 - scheme?: URLTransformSchemeEnum; 3463 - /** 3464 - * The new username for the request. 3465 - * Optional. 3466 - */ 3467 - username?: string; 3468 - /** 3469 - * The new password for the request. 3470 - * Optional. 3471 - */ 3472 - password?: string; 3473 - /** 3474 - * The new host name for the request. 3475 - * Optional. 3476 - */ 3477 - host?: string; 3478 - /** 3479 - * The new port for the request. If empty, the existing port is cleared. 3480 - * Optional. 3481 - */ 3482 - port?: string; 3483 - /** 3484 - * The new path for the request. If empty, the existing path is cleared. 3485 - * Optional. 3486 - */ 3487 - path?: string; 3488 - /** 3489 - * The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with 3490 - * '?'. Cannot be specified if 'queryTransform' is specified. 3491 - * Optional. 3492 - */ 3493 - query?: string; 3494 - /** 3495 - * Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified. 3496 - * Optional. 3497 - */ 3498 - queryTransform?: URLTransformQueryTransformType; 3499 - /** 3500 - * The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should 3501 - * begin with '#'. 3502 - * Optional. 3503 - */ 3504 - fragment?: string; 3505 - } 3506 - interface Rule { 3507 - /** 3508 - * An id which uniquely identifies a rule. Mandatory and should be >= 1. 3509 - */ 3510 - id: number; 3511 - /** 3512 - * Rule priority. Defaults to 1. When specified, should be >= 1 3513 - * Optional. 3514 - */ 3515 - priority?: number; 3516 - /** 3517 - * The condition under which this rule is triggered. 3518 - */ 3519 - condition: RuleConditionType; 3520 - /** 3521 - * The action to take if this rule is matched. 3522 - */ 3523 - action: RuleActionType; 3524 - } 3525 - interface GetRulesFilter { 3526 - /** 3527 - * If specified, only rules with matching IDs are included. 3528 - * Optional. 3529 - */ 3530 - ruleIds?: number[]; 3531 - } 3532 - interface UpdateDynamicRulesOptionsType { 3533 - /** 3534 - * IDs of the rules to remove. Any invalid IDs will be ignored. 3535 - * Optional. 3536 - */ 3537 - removeRuleIds?: number[]; 3538 - /** 3539 - * Rules to add. 3540 - * Optional. 3541 - */ 3542 - addRules?: Rule[]; 3543 - } 3544 - interface UpdateSessionRulesOptionsType { 3545 - /** 3546 - * IDs of the rules to remove. Any invalid IDs will be ignored. 3547 - * Optional. 3548 - */ 3549 - removeRuleIds?: number[]; 3550 - /** 3551 - * Rules to add. 3552 - * Optional. 3553 - */ 3554 - addRules?: Rule[]; 3555 - } 3556 - interface UpdateEnabledRulesetsUpdateRulesetOptionsType { 3557 - /** 3558 - * Optional. 3559 - */ 3560 - disableRulesetIds?: string[]; 3561 - /** 3562 - * Optional. 3563 - */ 3564 - enableRulesetIds?: string[]; 3565 - } 3566 - interface UpdateStaticRulesOptionsType { 3567 - rulesetId: string; 3568 - /** 3569 - * Optional. 3570 - */ 3571 - disableRuleIds?: number[]; 3572 - /** 3573 - * Optional. 3574 - */ 3575 - enableRuleIds?: number[]; 3576 - } 3577 - interface GetDisabledRuleIdsOptionsType { 3578 - rulesetId: string; 3579 - } 3580 - interface IsRegexSupportedRegexOptionsType { 3581 - /** 3582 - * The regular expresson to check. 3583 - */ 3584 - regex: string; 3585 - /** 3586 - * Whether the 'regex' specified is case sensitive. 3587 - * Optional. 3588 - */ 3589 - isCaseSensitive?: boolean; 3590 - /** 3591 - * Whether the 'regex' specified requires capturing. Capturing is only required for redirect rules which specify a 3592 - * 'regexSubstition' action. 3593 - * Optional. 3594 - */ 3595 - requireCapturing?: boolean; 3596 - } 3597 - interface IsRegexSupportedCallbackResultType { 3598 - /** 3599 - * Whether the given regex is supported 3600 - */ 3601 - isSupported: boolean; 3602 - /** 3603 - * Specifies the reason why the regular expression is not supported. Only provided if 'isSupported' is false. 3604 - * Optional. 3605 - */ 3606 - reason?: UnsupportedRegexReason; 3607 - } 3608 - /** 3609 - * The details of the request to test. 3610 - */ 3611 - interface TestMatchOutcomeRequestType { 3612 - /** 3613 - * The URL of the hypothetical request. 3614 - */ 3615 - url: string; 3616 - /** 3617 - * The initiator URL (if any) for the hypothetical request. 3618 - * Optional. 3619 - */ 3620 - initiator?: string; 3621 - /** 3622 - * Standard HTTP method of the hypothetical request. 3623 - * Optional. 3624 - */ 3625 - method?: string; 3626 - /** 3627 - * The resource type of the hypothetical request. 3628 - */ 3629 - type: ResourceType; 3630 - /** 3631 - * The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. 3632 - * Default is -1, meaning that the request isn't related to a tab. 3633 - * Optional. 3634 - */ 3635 - tabId?: number; 3636 - } 3637 - interface TestMatchOutcomeOptionsType { 3638 - /** 3639 - * Whether to account for rules from other installed extensions during rule evaluation. 3640 - * Optional. 3641 - */ 3642 - includeOtherExtensions?: boolean; 3643 - } 3644 - interface TestMatchOutcomeCallbackResultType { 3645 - /** 3646 - * The rules (if any) that match the hypothetical request. 3647 - */ 3648 - matchedRules: MatchedRule[]; 3649 - } 3650 - /** 3651 - * The new scheme for the request. 3652 - */ 3653 - type URLTransformSchemeEnum = "http" | "https" | "moz-extension"; 3654 - interface URLTransformQueryTransformAddOrReplaceParamsItemType { 3655 - key: string; 3656 - value: string; 3657 - /** 3658 - * If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing. 3659 - * Optional. 3660 - */ 3661 - replaceOnly?: boolean; 3662 - } 3663 - /** 3664 - * Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified. 3665 - */ 3666 - interface URLTransformQueryTransformType { 3667 - /** 3668 - * The list of query keys to be removed. 3669 - * Optional. 3670 - */ 3671 - removeParams?: string[]; 3672 - /** 3673 - * The list of query key-value pairs to be added or replaced. 3674 - * Optional. 3675 - */ 3676 - addOrReplaceParams?: URLTransformQueryTransformAddOrReplaceParamsItemType[]; 3677 - } 3678 - /** 3679 - * Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted, 3680 - * all requests are matched. 3681 - */ 3682 - type RuleConditionDomainTypeEnum = "firstParty" | "thirdParty"; 3683 - /** 3684 - * The condition under which this rule is triggered. 3685 - */ 3686 - interface RuleConditionType { 3687 - /** 3688 - * TODO: link to doc explaining supported pattern. The pattern which is matched against the network request url. 3689 - * Only one of 'urlFilter' or 'regexFilter' can be specified. 3690 - * Optional. 3691 - */ 3692 - urlFilter?: string; 3693 - /** 3694 - * Regular expression to match against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified. 3695 - * Optional. 3696 - */ 3697 - regexFilter?: string; 3698 - /** 3699 - * Whether 'urlFilter' or 'regexFilter' is case-sensitive. 3700 - * Optional. 3701 - */ 3702 - isUrlFilterCaseSensitive?: boolean; 3703 - /** 3704 - * The rule will only match network requests originating from the list of 'initiatorDomains'. If the list is omitted, 3705 - * the rule is applied to requests from all domains. 3706 - * Optional. 3707 - */ 3708 - initiatorDomains?: string[]; 3709 - /** 3710 - * The rule will not match network requests originating from the list of 'initiatorDomains'. 3711 - * If the list is empty or omitted, no domains are excluded. This takes precedence over 'initiatorDomains'. 3712 - * Optional. 3713 - */ 3714 - excludedInitiatorDomains?: string[]; 3715 - /** 3716 - * The rule will only match network requests when the domain matches one from the list of 'requestDomains'. 3717 - * If the list is omitted, the rule is applied to requests from all domains. 3718 - * Optional. 3719 - */ 3720 - requestDomains?: string[]; 3721 - /** 3722 - * The rule will not match network requests when the domains matches one from the list of 'excludedRequestDomains'. 3723 - * If the list is empty or omitted, no domains are excluded. This takes precedence over 'requestDomains'. 3724 - * Optional. 3725 - */ 3726 - excludedRequestDomains?: string[]; 3727 - /** 3728 - * List of resource types which the rule can match. When the rule action is 'allowAllRequests', 3729 - * this must be specified and may only contain 'main_frame' or 'sub_frame'. Cannot be specified if 'excludedResourceTypes' 3730 - * is specified. If neither of them is specified, all resource types except 'main_frame' are matched. 3731 - * Optional. 3732 - */ 3733 - resourceTypes?: ResourceType[]; 3734 - /** 3735 - * List of resource types which the rule won't match. Cannot be specified if 'resourceTypes' is specified. 3736 - * If neither of them is specified, all resource types except 'main_frame' are matched. 3737 - * Optional. 3738 - */ 3739 - excludedResourceTypes?: ResourceType[]; 3740 - /** 3741 - * List of HTTP request methods which the rule can match. Should be a lower-case method such as 'connect', 'delete', 'get', 3742 - * 'head', 'options', 'patch', 'post', 'put'.' 3743 - * Optional. 3744 - */ 3745 - requestMethods?: string[]; 3746 - /** 3747 - * List of request methods which the rule won't match. Cannot be specified if 'requestMethods' is specified. 3748 - * If neither of them is specified, all request methods are matched. 3749 - * Optional. 3750 - */ 3751 - excludedRequestMethods?: string[]; 3752 - /** 3753 - * Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted, 3754 - * all requests are matched. 3755 - * Optional. 3756 - */ 3757 - domainType?: RuleConditionDomainTypeEnum; 3758 - /** 3759 - * List of tabIds which the rule should match. An ID of -1 matches requests which don't originate from a tab. 3760 - * Only supported for session-scoped rules. 3761 - * Optional. 3762 - */ 3763 - tabIds?: number[]; 3764 - /** 3765 - * List of tabIds which the rule should not match. An ID of -1 excludes requests which don't originate from a tab. 3766 - * Only supported for session-scoped rules. 3767 - * Optional. 3768 - */ 3769 - excludedTabIds?: number[]; 3770 - } 3771 - type RuleActionTypeEnum = "block" | "redirect" | "allow" | "upgradeScheme" | "modifyHeaders" | "allowAllRequests"; 3772 - /** 3773 - * Describes how the redirect should be performed. Only valid when type is 'redirect'. 3774 - */ 3775 - interface RuleActionRedirectType { 3776 - /** 3777 - * Path relative to the extension directory. Should start with '/'. 3778 - * Optional. 3779 - */ 3780 - extensionPath?: string; 3781 - /** 3782 - * Url transformations to perform. 3783 - * Optional. 3784 - */ 3785 - transform?: URLTransform; 3786 - /** 3787 - * The redirect url. Redirects to JavaScript urls are not allowed. 3788 - * Optional. 3789 - */ 3790 - url?: string; 3791 - /** 3792 - * Substitution pattern for rules which specify a 'regexFilter'. The first match of regexFilter within the url will be 3793 - * replaced with this pattern. Within regexSubstitution, backslash-escaped digits (\1 to \9) 3794 - * can be used to insert the corresponding capture groups. \0 refers to the entire matching text. 3795 - * Optional. 3796 - */ 3797 - regexSubstitution?: string; 3798 - } 3799 - interface RuleActionRequestHeadersItemType { 3800 - /** 3801 - * The name of the request header to be modified. 3802 - */ 3803 - header: string; 3804 - /** 3805 - * The operation to be performed on a header. 3806 - */ 3807 - operation: "append" | "set" | "remove"; 3808 - /** 3809 - * The new value for the header. Must be specified for the 'append' and 'set' operations. 3810 - * Optional. 3811 - */ 3812 - value?: string; 3813 - } 3814 - interface RuleActionResponseHeadersItemType { 3815 - /** 3816 - * The name of the response header to be modified. 3817 - */ 3818 - header: string; 3819 - /** 3820 - * The operation to be performed on a header. 3821 - */ 3822 - operation: "append" | "set" | "remove"; 3823 - /** 3824 - * The new value for the header. Must be specified for the 'append' and 'set' operations. 3825 - * Optional. 3826 - */ 3827 - value?: string; 3828 - } 3829 - /** 3830 - * The action to take if this rule is matched. 3831 - */ 3832 - interface RuleActionType { 3833 - type: RuleActionTypeEnum; 3834 - /** 3835 - * Describes how the redirect should be performed. Only valid when type is 'redirect'. 3836 - * Optional. 3837 - */ 3838 - redirect?: RuleActionRedirectType; 3839 - /** 3840 - * The request headers to modify for the request. Only valid when type is 'modifyHeaders'. 3841 - * Optional. 3842 - */ 3843 - requestHeaders?: RuleActionRequestHeadersItemType[]; 3844 - /** 3845 - * The response headers to modify for the request. Only valid when type is 'modifyHeaders'. 3846 - * Optional. 3847 - */ 3848 - responseHeaders?: RuleActionResponseHeadersItemType[]; 3849 - } 3850 - interface Static { 3851 - /** 3852 - * Modifies the current set of dynamic rules for the extension. The rules with IDs listed in options. 3853 - * removeRuleIds are first removed, and then the rules given in options.addRules are added. 3854 - * These rules are persisted across browser sessions and extension updates. 3855 - * 3856 - * @returns Called when the dynamic rules have been updated 3857 - */ 3858 - updateDynamicRules(options: UpdateDynamicRulesOptionsType): Promise<void>; 3859 - /** 3860 - * Modifies the current set of session scoped rules for the extension. The rules with IDs listed in options. 3861 - * removeRuleIds are first removed, and then the rules given in options.addRules are added. 3862 - * These rules are not persisted across sessions and are backed in memory. 3863 - * 3864 - * @returns Called when the session rules have been updated 3865 - */ 3866 - updateSessionRules(options: UpdateSessionRulesOptionsType): Promise<void>; 3867 - /** 3868 - * Returns the ids for the current set of enabled static rulesets. 3869 - */ 3870 - getEnabledRulesets(): Promise<string[]>; 3871 - /** 3872 - * Modifies the static rulesets enabled/disabled state. 3873 - */ 3874 - updateEnabledRulesets(updateRulesetOptions: UpdateEnabledRulesetsUpdateRulesetOptionsType): Promise<void>; 3875 - /** 3876 - * Modified individual static rules enabled/disabled state. Changes to rules belonging to a disabled ruleset will take 3877 - * effect when the ruleset becomes enabled. 3878 - */ 3879 - updateStaticRules(options: UpdateStaticRulesOptionsType): Promise<void>; 3880 - /** 3881 - * Returns the remaining number of static rules an extension can enable 3882 - */ 3883 - getAvailableStaticRuleCount(): Promise<number>; 3884 - /** 3885 - * Returns the list of individual disabled static rules from a given static ruleset id. 3886 - */ 3887 - getDisabledRuleIds(options: GetDisabledRuleIdsOptionsType): Promise<number[]>; 3888 - /** 3889 - * Returns the current set of dynamic rules for the extension. 3890 - * 3891 - * @param filter Optional. An object to filter the set of dynamic rules for the extension. 3892 - */ 3893 - getDynamicRules(filter?: GetRulesFilter): Promise<Rule[]>; 3894 - /** 3895 - * Returns the current set of session scoped rules for the extension. 3896 - * 3897 - * @param filter Optional. An object to filter the set of session scoped rules for the extension. 3898 - */ 3899 - getSessionRules(filter?: GetRulesFilter): Promise<Rule[]>; 3900 - /** 3901 - * Checks if the given regular expression will be supported as a 'regexFilter' rule condition. 3902 - */ 3903 - isRegexSupported(regexOptions: IsRegexSupportedRegexOptionsType): Promise<IsRegexSupportedCallbackResultType>; 3904 - /** 3905 - * Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request. 3906 - * 3907 - * @param request The details of the request to test. 3908 - * @param options Optional. 3909 - * @returns Called with the details of matched rules. 3910 - */ 3911 - testMatchOutcome(request: TestMatchOutcomeRequestType, options?: TestMatchOutcomeOptionsType): Promise<TestMatchOutcomeCallbackResultType>; 3912 - /** 3913 - * Ruleset ID for the dynamic rules added by the extension. 3914 - */ 3915 - DYNAMIC_RULESET_ID: "_dynamic"; 3916 - /** 3917 - * The minimum number of static rules guaranteed to an extension across its enabled static rulesets. 3918 - * Any rules above this limit will count towards the global static rule limit. 3919 - */ 3920 - GUARANTEED_MINIMUM_STATIC_RULES: number; 3921 - /** 3922 - * The maximum number of static Rulesets an extension can specify as part of the rule_resources manifest key. 3923 - */ 3924 - MAX_NUMBER_OF_STATIC_RULESETS: number; 3925 - /** 3926 - * The maximum number of static rules that can be disabled on each static ruleset. 3927 - */ 3928 - MAX_NUMBER_OF_DISABLED_STATIC_RULES: number; 3929 - /** 3930 - * The maximum number of static Rulesets an extension can enable at any one time. 3931 - */ 3932 - MAX_NUMBER_OF_ENABLED_STATIC_RULESETS: number; 3933 - /** 3934 - * Deprecated property returning the maximum number of dynamic and session rules an extension can add, 3935 - * replaced by MAX_NUMBER_OF_DYNAMIC_RULES/MAX_NUMBER_OF_SESSION_RULES. 3936 - */ 3937 - MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES: number; 3938 - /** 3939 - * The maximum number of dynamic session rules an extension can add. 3940 - */ 3941 - MAX_NUMBER_OF_DYNAMIC_RULES: number; 3942 - /** 3943 - * The maximum number of dynamic session rules an extension can add. 3944 - */ 3945 - MAX_NUMBER_OF_SESSION_RULES: number; 3946 - /** 3947 - * The maximum number of regular expression rules that an extension can add. This limit is evaluated separately for the set 3948 - * of session rules, dynamic rules and those specified in the rule_resources file. 3949 - */ 3950 - MAX_NUMBER_OF_REGEX_RULES: number; 3951 - /** 3952 - * Ruleset ID for the session-scoped rules added by the extension. 3953 - */ 3954 - SESSION_RULESET_ID: "_session"; 3955 - } 3956 - } 3957 - /** 3958 - * Namespace: browser.devtools 3959 - */ 3960 - namespace Devtools { 3961 - interface Static { 3962 - inspectedWindow: InspectedWindow.Static; 3963 - network: Network.Static; 3964 - panels: Panels.Static; 3965 - } 3966 - } 3967 - /** 3968 - * Namespace: browser.dns 3969 - */ 3970 - namespace Dns { 3971 - /** 3972 - * An object encapsulating a DNS Record. 3973 - */ 3974 - interface DNSRecord { 3975 - /** 3976 - * The canonical hostname for this record. this value is empty if the record was not fetched with the 'canonical_name' 3977 - * flag. 3978 - * Optional. 3979 - */ 3980 - canonicalName?: string; 3981 - /** 3982 - * Record retreived with TRR. 3983 - */ 3984 - isTRR: string; 3985 - addresses: string[]; 3986 - } 3987 - type ResolveFlags = ResolveFlagsItemEnum[]; 3988 - type ResolveFlagsItemEnum = "allow_name_collisions" | "bypass_cache" | "canonical_name" | "disable_ipv4" | "disable_ipv6" | "disable_trr" | "offline" | "priority_low" | "priority_medium" | "speculate"; 3989 - interface Static { 3990 - /** 3991 - * Resolves a hostname to a DNS record. 3992 - * 3993 - * @param flags Optional. 3994 - */ 3995 - resolve(hostname: string, flags?: ResolveFlags): Promise<DNSRecord>; 3996 - } 3997 - } 3998 - /** 3999 - * Namespace: browser.downloads 4000 - */ 4001 - namespace Downloads { 4002 - type FilenameConflictAction = "uniquify" | "overwrite" | "prompt"; 4003 - type InterruptReason = "FILE_FAILED" | "FILE_ACCESS_DENIED" | "FILE_NO_SPACE" | "FILE_NAME_TOO_LONG" | "FILE_TOO_LARGE" | "FILE_VIRUS_INFECTED" | "FILE_TRANSIENT_ERROR" | "FILE_BLOCKED" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_SHORT" | "NETWORK_FAILED" | "NETWORK_TIMEOUT" | "NETWORK_DISCONNECTED" | "NETWORK_SERVER_DOWN" | "NETWORK_INVALID_REQUEST" | "SERVER_FAILED" | "SERVER_NO_RANGE" | "SERVER_BAD_CONTENT" | "SERVER_UNAUTHORIZED" | "SERVER_CERT_PROBLEM" | "SERVER_FORBIDDEN" | "USER_CANCELED" | "USER_SHUTDOWN" | "CRASH"; 4004 - /** 4005 - * <dl><dt>file</dt><dd>The download's filename is suspicious.</dd><dt>url</dt><dd>The download's URL is known to be 4006 - * malicious.</dd><dt>content</dt><dd>The downloaded file is known to be malicious.</dd><dt>uncommon</dt><dd> 4007 - * The download's URL is not commonly downloaded and could be dangerous.</dd><dt>safe</dt><dd> 4008 - * The download presents no known danger to the user's computer.</dd></dl>These string constants will never change, 4009 - * however the set of DangerTypes may change. 4010 - */ 4011 - type DangerType = "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted"; 4012 - /** 4013 - * <dl><dt>in_progress</dt><dd>The download is currently receiving data from the server.</dd><dt>interrupted</dt><dd> 4014 - * An error broke the connection with the file host.</dd><dt>complete</dt><dd>The download completed successfully.</dd></dl> 4015 - * These string constants will never change, however the set of States may change. 4016 - */ 4017 - type State = "in_progress" | "interrupted" | "complete"; 4018 - interface DownloadItem { 4019 - /** 4020 - * An identifier that is persistent across browser sessions. 4021 - */ 4022 - id: number; 4023 - /** 4024 - * Absolute URL. 4025 - */ 4026 - url: string; 4027 - /** 4028 - * Optional. 4029 - */ 4030 - referrer?: string; 4031 - /** 4032 - * Absolute local path. 4033 - */ 4034 - filename: string; 4035 - /** 4036 - * False if this download is recorded in the history, true if it is not recorded. 4037 - */ 4038 - incognito: boolean; 4039 - /** 4040 - * The cookie store ID of the contextual identity. 4041 - * Optional. 4042 - */ 4043 - cookieStoreId?: string; 4044 - /** 4045 - * Indication of whether this download is thought to be safe or known to be suspicious. 4046 - */ 4047 - danger: DangerType; 4048 - /** 4049 - * The file's MIME type. 4050 - * Optional. 4051 - */ 4052 - mime?: string; 4053 - /** 4054 - * Number of milliseconds between the unix epoch and when this download began. 4055 - */ 4056 - startTime: string; 4057 - /** 4058 - * Number of milliseconds between the unix epoch and when this download ended. 4059 - * Optional. 4060 - */ 4061 - endTime?: string; 4062 - /** 4063 - * Optional. 4064 - */ 4065 - estimatedEndTime?: string; 4066 - /** 4067 - * Indicates whether the download is progressing, interrupted, or complete. 4068 - */ 4069 - state: State; 4070 - /** 4071 - * True if the download has stopped reading data from the host, but kept the connection open. 4072 - */ 4073 - paused: boolean; 4074 - canResume: boolean; 4075 - /** 4076 - * Number indicating why a download was interrupted. 4077 - * Optional. 4078 - */ 4079 - error?: InterruptReason; 4080 - /** 4081 - * Number of bytes received so far from the host, without considering file compression. 4082 - */ 4083 - bytesReceived: number; 4084 - /** 4085 - * Number of bytes in the whole file, without considering file compression, or -1 if unknown. 4086 - */ 4087 - totalBytes: number; 4088 - /** 4089 - * Number of bytes in the whole file post-decompression, or -1 if unknown. 4090 - */ 4091 - fileSize: number; 4092 - exists: boolean; 4093 - /** 4094 - * Optional. 4095 - */ 4096 - byExtensionId?: string; 4097 - /** 4098 - * Optional. 4099 - */ 4100 - byExtensionName?: string; 4101 - } 4102 - interface StringDelta { 4103 - /** 4104 - * Optional. 4105 - */ 4106 - current?: string; 4107 - /** 4108 - * Optional. 4109 - */ 4110 - previous?: string; 4111 - } 4112 - interface DoubleDelta { 4113 - /** 4114 - * Optional. 4115 - */ 4116 - current?: number; 4117 - /** 4118 - * Optional. 4119 - */ 4120 - previous?: number; 4121 - } 4122 - interface BooleanDelta { 4123 - /** 4124 - * Optional. 4125 - */ 4126 - current?: boolean; 4127 - /** 4128 - * Optional. 4129 - */ 4130 - previous?: boolean; 4131 - } 4132 - /** 4133 - * A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string 4134 - */ 4135 - type DownloadTime = string | ExtensionTypes.DateType; 4136 - /** 4137 - * Parameters that combine to specify a predicate that can be used to select a set of downloads. 4138 - * Used for example in search() and erase() 4139 - */ 4140 - interface DownloadQuery { 4141 - /** 4142 - * This array of search terms limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> 4143 - * or <code>url</code> contain all of the search terms that do not begin with a dash '-' and none of the search terms that 4144 - * do begin with a dash. 4145 - * Optional. 4146 - */ 4147 - query?: string[]; 4148 - /** 4149 - * Limits results to downloads that started before the given ms since the epoch. 4150 - * Optional. 4151 - */ 4152 - startedBefore?: DownloadTime; 4153 - /** 4154 - * Limits results to downloads that started after the given ms since the epoch. 4155 - * Optional. 4156 - */ 4157 - startedAfter?: DownloadTime; 4158 - /** 4159 - * Limits results to downloads that ended before the given ms since the epoch. 4160 - * Optional. 4161 - */ 4162 - endedBefore?: DownloadTime; 4163 - /** 4164 - * Limits results to downloads that ended after the given ms since the epoch. 4165 - * Optional. 4166 - */ 4167 - endedAfter?: DownloadTime; 4168 - /** 4169 - * Limits results to downloads whose totalBytes is greater than the given integer. 4170 - * Optional. 4171 - */ 4172 - totalBytesGreater?: number; 4173 - /** 4174 - * Limits results to downloads whose totalBytes is less than the given integer. 4175 - * Optional. 4176 - */ 4177 - totalBytesLess?: number; 4178 - /** 4179 - * Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> 4180 - * matches the given regular expression. 4181 - * Optional. 4182 - */ 4183 - filenameRegex?: string; 4184 - /** 4185 - * Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>url</code> 4186 - * matches the given regular expression. 4187 - * Optional. 4188 - */ 4189 - urlRegex?: string; 4190 - /** 4191 - * Setting this integer limits the number of results. Otherwise, all matching <a href='#type-DownloadItem'>DownloadItems</a> 4192 - * will be returned. 4193 - * Optional. 4194 - */ 4195 - limit?: number; 4196 - /** 4197 - * Setting elements of this array to <a href='#type-DownloadItem'>DownloadItem</a> properties in order to sort the search 4198 - * results. For example, setting <code>orderBy='startTime'</code> sorts the <a href='#type-DownloadItem'>DownloadItems</a> 4199 - * by their start time in ascending order. To specify descending order, prefix <code>orderBy</code> 4200 - * with a hyphen: '-startTime'. 4201 - * Optional. 4202 - */ 4203 - orderBy?: string[]; 4204 - /** 4205 - * Optional. 4206 - */ 4207 - id?: number; 4208 - /** 4209 - * Absolute URL. 4210 - * Optional. 4211 - */ 4212 - url?: string; 4213 - /** 4214 - * Absolute local path. 4215 - * Optional. 4216 - */ 4217 - filename?: string; 4218 - /** 4219 - * The cookie store ID of the contextual identity. 4220 - * Optional. 4221 - */ 4222 - cookieStoreId?: string; 4223 - /** 4224 - * Indication of whether this download is thought to be safe or known to be suspicious. 4225 - * Optional. 4226 - */ 4227 - danger?: DangerType; 4228 - /** 4229 - * The file's MIME type. 4230 - * Optional. 4231 - */ 4232 - mime?: string; 4233 - /** 4234 - * Optional. 4235 - */ 4236 - startTime?: string; 4237 - /** 4238 - * Optional. 4239 - */ 4240 - endTime?: string; 4241 - /** 4242 - * Indicates whether the download is progressing, interrupted, or complete. 4243 - * Optional. 4244 - */ 4245 - state?: State; 4246 - /** 4247 - * True if the download has stopped reading data from the host, but kept the connection open. 4248 - * Optional. 4249 - */ 4250 - paused?: boolean; 4251 - /** 4252 - * Why a download was interrupted. 4253 - * Optional. 4254 - */ 4255 - error?: InterruptReason; 4256 - /** 4257 - * Number of bytes received so far from the host, without considering file compression. 4258 - * Optional. 4259 - */ 4260 - bytesReceived?: number; 4261 - /** 4262 - * Number of bytes in the whole file, without considering file compression, or -1 if unknown. 4263 - * Optional. 4264 - */ 4265 - totalBytes?: number; 4266 - /** 4267 - * Number of bytes in the whole file post-decompression, or -1 if unknown. 4268 - * Optional. 4269 - */ 4270 - fileSize?: number; 4271 - /** 4272 - * Optional. 4273 - */ 4274 - exists?: boolean; 4275 - } 4276 - /** 4277 - * What to download and how. 4278 - */ 4279 - interface DownloadOptionsType { 4280 - /** 4281 - * The URL to download. 4282 - */ 4283 - url: string; 4284 - /** 4285 - * A file path relative to the Downloads directory to contain the downloaded file. 4286 - * Optional. 4287 - */ 4288 - filename?: string; 4289 - /** 4290 - * Whether to associate the download with a private browsing session. 4291 - * Optional. 4292 - */ 4293 - incognito?: boolean; 4294 - /** 4295 - * The cookie store ID of the contextual identity; requires "cookies" permission. 4296 - * Optional. 4297 - */ 4298 - cookieStoreId?: string; 4299 - /** 4300 - * Optional. 4301 - */ 4302 - conflictAction?: FilenameConflictAction; 4303 - /** 4304 - * Use a file-chooser to allow the user to select a filename. If the option is not specified, 4305 - * the file chooser will be shown only if the Firefox "Always ask you where to save files" option is enabled (i.e. 4306 - * the pref <code>browser.download.useDownloadDir</code> is set to <code>false</code>). 4307 - * Optional. 4308 - */ 4309 - saveAs?: boolean; 4310 - /** 4311 - * The HTTP method to use if the URL uses the HTTP[S] protocol. 4312 - * Optional. 4313 - */ 4314 - method?: DownloadOptionsTypeMethodEnum; 4315 - /** 4316 - * Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a 4317 - * dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>, 4318 - * restricted to those allowed by XMLHttpRequest. 4319 - * Optional. 4320 - */ 4321 - headers?: DownloadOptionsTypeHeadersItemType[]; 4322 - /** 4323 - * Post body. 4324 - * Optional. 4325 - */ 4326 - body?: string; 4327 - /** 4328 - * When this flag is set to <code>true</code>, then the browser will allow downloads to proceed after encountering HTTP 4329 - * errors such as <code>404 Not Found</code>. 4330 - * Optional. 4331 - */ 4332 - allowHttpErrors?: boolean; 4333 - } 4334 - interface GetFileIconOptionsType { 4335 - /** 4336 - * The size of the icon. The returned icon will be square with dimensions size * size pixels. 4337 - * The default size for the icon is 32x32 pixels. 4338 - * Optional. 4339 - */ 4340 - size?: number; 4341 - } 4342 - interface OnChangedDownloadDeltaType { 4343 - /** 4344 - * The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that changed. 4345 - */ 4346 - id: number; 4347 - /** 4348 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>url</code>. 4349 - * Optional. 4350 - */ 4351 - url?: StringDelta; 4352 - /** 4353 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>filename</code>. 4354 - * Optional. 4355 - */ 4356 - filename?: StringDelta; 4357 - /** 4358 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>danger</code>. 4359 - * Optional. 4360 - */ 4361 - danger?: StringDelta; 4362 - /** 4363 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>mime</code>. 4364 - * Optional. 4365 - */ 4366 - mime?: StringDelta; 4367 - /** 4368 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>startTime</code>. 4369 - * Optional. 4370 - */ 4371 - startTime?: StringDelta; 4372 - /** 4373 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>endTime</code>. 4374 - * Optional. 4375 - */ 4376 - endTime?: StringDelta; 4377 - /** 4378 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>state</code>. 4379 - * Optional. 4380 - */ 4381 - state?: StringDelta; 4382 - /** 4383 - * Optional. 4384 - */ 4385 - canResume?: BooleanDelta; 4386 - /** 4387 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>paused</code>. 4388 - * Optional. 4389 - */ 4390 - paused?: BooleanDelta; 4391 - /** 4392 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>error</code>. 4393 - * Optional. 4394 - */ 4395 - error?: StringDelta; 4396 - /** 4397 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>totalBytes</code>. 4398 - * Optional. 4399 - */ 4400 - totalBytes?: DoubleDelta; 4401 - /** 4402 - * Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>fileSize</code>. 4403 - * Optional. 4404 - */ 4405 - fileSize?: DoubleDelta; 4406 - /** 4407 - * Optional. 4408 - */ 4409 - exists?: BooleanDelta; 4410 - } 4411 - /** 4412 - * The HTTP method to use if the URL uses the HTTP[S] protocol. 4413 - */ 4414 - type DownloadOptionsTypeMethodEnum = "GET" | "POST"; 4415 - interface DownloadOptionsTypeHeadersItemType { 4416 - /** 4417 - * Name of the HTTP header. 4418 - */ 4419 - name: string; 4420 - /** 4421 - * Value of the HTTP header. 4422 - */ 4423 - value: string; 4424 - } 4425 - interface Static { 4426 - /** 4427 - * Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its 4428 - * hostname. If both <code>filename</code> and <code>saveAs</code> are specified, then the Save As dialog will be displayed, 4429 - * pre-populated with the specified <code>filename</code>. If the download started successfully, <code>callback</code> 4430 - * will be called with the new <a href='#type-DownloadItem'>DownloadItem</a>'s <code>downloadId</code>. 4431 - * If there was an error starting the download, then <code>callback</code> will be called with <code> 4432 - * downloadId=undefined</code> and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> 4433 - * will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. 4434 - * You must not parse it. 4435 - * 4436 - * @param options What to download and how. 4437 - */ 4438 - download(options: DownloadOptionsType): Promise<number>; 4439 - /** 4440 - * Find <a href='#type-DownloadItem'>DownloadItems</a>. Set <code>query</code> to the empty object to get all <a 4441 - * href='#type-DownloadItem'>DownloadItems</a>. To get a specific <a href='#type-DownloadItem'>DownloadItem</a>, 4442 - * set only the <code>id</code> field. 4443 - */ 4444 - search(query: DownloadQuery): Promise<DownloadItem[]>; 4445 - /** 4446 - * Pause the download. If the request was successful the download is in a paused state. Otherwise <a href='extension. 4447 - * html#property-lastError'>chrome.extension.lastError</a> contains an error message. 4448 - * The request will fail if the download is not active. 4449 - * 4450 - * @param downloadId The id of the download to pause. 4451 - */ 4452 - pause(downloadId: number): Promise<void>; 4453 - /** 4454 - * Resume a paused download. If the request was successful the download is in progress and unpaused. 4455 - * Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. 4456 - * The request will fail if the download is not active. 4457 - * 4458 - * @param downloadId The id of the download to resume. 4459 - */ 4460 - resume(downloadId: number): Promise<void>; 4461 - /** 4462 - * Cancel a download. When <code>callback</code> is run, the download is cancelled, completed, 4463 - * interrupted or doesn't exist anymore. 4464 - * 4465 - * @param downloadId The id of the download to cancel. 4466 - */ 4467 - cancel(downloadId: number): Promise<void>; 4468 - /** 4469 - * Retrieve an icon for the specified download. For new downloads, file icons are available after the <a 4470 - * href='#event-onCreated'>onCreated</a> event has been received. The image returned by this function while a download is 4471 - * in progress may be different from the image returned after the download is complete. 4472 - * Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. 4473 - * The icon that is returned will therefore depend on a number of factors including state of the download, platform, 4474 - * registered file types and visual theme. If a file icon cannot be determined, <a href='extension. 4475 - * html#property-lastError'>chrome.extension.lastError</a> will contain an error message. 4476 - * 4477 - * @param downloadId The identifier for the download. 4478 - * @param options Optional. 4479 - */ 4480 - getFileIcon(downloadId: number, options?: GetFileIconOptionsType): Promise<string>; 4481 - /** 4482 - * Open the downloaded file. 4483 - */ 4484 - open(downloadId: number): Promise<void>; 4485 - /** 4486 - * Show the downloaded file in its folder in a file manager. 4487 - */ 4488 - show(downloadId: number): Promise<boolean>; 4489 - showDefaultFolder(): void; 4490 - /** 4491 - * Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from history 4492 - */ 4493 - erase(query: DownloadQuery): Promise<number[]>; 4494 - removeFile(downloadId: number): Promise<void>; 4495 - /** 4496 - * This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> object when a download begins. 4497 - */ 4498 - onCreated: Events.Event<(downloadItem: DownloadItem) => void>; 4499 - /** 4500 - * Fires with the <code>downloadId</code> when a download is erased from history. 4501 - * 4502 - * @param downloadId The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that was erased. 4503 - */ 4504 - onErased: Events.Event<(downloadId: number) => void>; 4505 - /** 4506 - * When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties except <code>bytesReceived</code> changes, 4507 - * this event fires with the <code>downloadId</code> and an object containing the properties that changed. 4508 - */ 4509 - onChanged: Events.Event<(downloadDelta: OnChangedDownloadDeltaType) => void>; 4510 - } 4511 - } 4512 - /** 4513 - * Namespace: browser.events 4514 - */ 4515 - namespace Events { 4516 - /** 4517 - * Description of a declarative rule for handling events. 4518 - */ 4519 - interface Rule { 4520 - /** 4521 - * Optional identifier that allows referencing this rule. 4522 - * Optional. 4523 - */ 4524 - id?: string; 4525 - /** 4526 - * Tags can be used to annotate rules and perform operations on sets of rules. 4527 - * Optional. 4528 - */ 4529 - tags?: string[]; 4530 - /** 4531 - * List of conditions that can trigger the actions. 4532 - */ 4533 - conditions: unknown[]; 4534 - /** 4535 - * List of actions that are triggered if one of the condtions is fulfilled. 4536 - */ 4537 - actions: unknown[]; 4538 - /** 4539 - * Optional priority of this rule. Defaults to 100. 4540 - * Optional. 4541 - */ 4542 - priority?: number; 4543 - } 4544 - /** 4545 - * An object which allows the addition and removal of listeners for a Chrome event. 4546 - */ 4547 - // eslint-disable-next-line @typescript-eslint/no-explicit-any 4548 - interface Event<T extends (...args: any[]) => any> { 4549 - /** 4550 - * Registers an event listener <em>callback</em> to an event. 4551 - * 4552 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 4553 - * @param ...params Further parameters, depending on the event. 4554 - */ 4555 - addListener(callback: T, ...params: unknown[]): void; 4556 - /** 4557 - * Deregisters an event listener <em>callback</em> from an event. 4558 - * 4559 - * @param callback Listener that shall be unregistered. 4560 - */ 4561 - removeListener(callback: T): void; 4562 - /** 4563 - * @param callback Listener whose registration status shall be tested. 4564 - * @returns True if <em>callback</em> is registered to the event. 4565 - */ 4566 - hasListener(callback: T): boolean; 4567 - } 4568 - /** 4569 - * Filters URLs for various criteria. See <a href='events#filtered'>event filtering</a>. All criteria are case sensitive. 4570 - */ 4571 - interface UrlFilter { 4572 - /** 4573 - * Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 4574 - * 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the 4575 - * beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') 4576 - * and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done 4577 - * separately using hostSuffix, because no implicit dot is added at the end of the host name. 4578 - * Optional. 4579 - */ 4580 - hostContains?: string; 4581 - /** 4582 - * Matches if the host name of the URL is equal to a specified string. 4583 - * Optional. 4584 - */ 4585 - hostEquals?: string; 4586 - /** 4587 - * Matches if the host name of the URL starts with a specified string. 4588 - * Optional. 4589 - */ 4590 - hostPrefix?: string; 4591 - /** 4592 - * Matches if the host name of the URL ends with a specified string. 4593 - * Optional. 4594 - */ 4595 - hostSuffix?: string; 4596 - /** 4597 - * Matches if the path segment of the URL contains a specified string. 4598 - * Optional. 4599 - */ 4600 - pathContains?: string; 4601 - /** 4602 - * Matches if the path segment of the URL is equal to a specified string. 4603 - * Optional. 4604 - */ 4605 - pathEquals?: string; 4606 - /** 4607 - * Matches if the path segment of the URL starts with a specified string. 4608 - * Optional. 4609 - */ 4610 - pathPrefix?: string; 4611 - /** 4612 - * Matches if the path segment of the URL ends with a specified string. 4613 - * Optional. 4614 - */ 4615 - pathSuffix?: string; 4616 - /** 4617 - * Matches if the query segment of the URL contains a specified string. 4618 - * Optional. 4619 - */ 4620 - queryContains?: string; 4621 - /** 4622 - * Matches if the query segment of the URL is equal to a specified string. 4623 - * Optional. 4624 - */ 4625 - queryEquals?: string; 4626 - /** 4627 - * Matches if the query segment of the URL starts with a specified string. 4628 - * Optional. 4629 - */ 4630 - queryPrefix?: string; 4631 - /** 4632 - * Matches if the query segment of the URL ends with a specified string. 4633 - * Optional. 4634 - */ 4635 - querySuffix?: string; 4636 - /** 4637 - * Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if 4638 - * they match the default port number. 4639 - * Optional. 4640 - */ 4641 - urlContains?: string; 4642 - /** 4643 - * Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL 4644 - * if they match the default port number. 4645 - * Optional. 4646 - */ 4647 - urlEquals?: string; 4648 - /** 4649 - * Matches if the URL (without fragment identifier) matches a specified regular expression. 4650 - * Port numbers are stripped from the URL if they match the default port number. The regular expressions use the <a 4651 - * href="https://github.com/google/re2/blob/master/doc/syntax.txt">RE2 syntax</a>. 4652 - * Optional. 4653 - */ 4654 - urlMatches?: string; 4655 - /** 4656 - * Matches if the URL without query segment and fragment identifier matches a specified regular expression. 4657 - * Port numbers are stripped from the URL if they match the default port number. The regular expressions use the <a 4658 - * href="https://github.com/google/re2/blob/master/doc/syntax.txt">RE2 syntax</a>. 4659 - * Optional. 4660 - */ 4661 - originAndPathMatches?: string; 4662 - /** 4663 - * Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL 4664 - * if they match the default port number. 4665 - * Optional. 4666 - */ 4667 - urlPrefix?: string; 4668 - /** 4669 - * Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if 4670 - * they match the default port number. 4671 - * Optional. 4672 - */ 4673 - urlSuffix?: string; 4674 - /** 4675 - * Matches if the scheme of the URL is equal to any of the schemes specified in the array. 4676 - * Optional. 4677 - */ 4678 - schemes?: string[]; 4679 - /** 4680 - * Matches if the port of the URL is contained in any of the specified port lists. For example <code>[80, 443, [1000, 1200]] 4681 - * </code> matches all requests on port 80, 443 and in the range 1000-1200. 4682 - * Optional. 4683 - */ 4684 - ports?: Array<number | [ 4685 - number, 4686 - number 4687 - ]>; 4688 - } 4689 - interface Static { 4690 - [s: string]: unknown; 4691 - } 4692 - } 4693 - /** 4694 - * Namespace: browser.experiments 4695 - */ 4696 - namespace Experiments { 4697 - interface ExperimentAPI { 4698 - schema: ExperimentURL; 4699 - /** 4700 - * Optional. 4701 - */ 4702 - parent?: ExperimentAPIParentType; 4703 - /** 4704 - * Optional. 4705 - */ 4706 - child?: ExperimentAPIChildType; 4707 - } 4708 - type ExperimentURL = string; 4709 - type APIPaths = APIPath[]; 4710 - type APIPath = string[]; 4711 - type APIEvents = APIEvent[]; 4712 - type APIEvent = "startup"; 4713 - type APIParentScope = "addon_parent" | "content_parent" | "devtools_parent"; 4714 - type APIChildScope = "addon_child" | "content_child" | "devtools_child"; 4715 - interface ExperimentAPIParentType { 4716 - /** 4717 - * Optional. 4718 - */ 4719 - events?: APIEvents; 4720 - /** 4721 - * Optional. 4722 - */ 4723 - paths?: APIPaths; 4724 - script: ExperimentURL; 4725 - /** 4726 - * Optional. 4727 - */ 4728 - scopes?: APIParentScope[]; 4729 - } 4730 - interface ExperimentAPIChildType { 4731 - paths: APIPaths; 4732 - script: ExperimentURL; 4733 - scopes: APIChildScope[]; 4734 - } 4735 - interface Static { 4736 - [s: string]: unknown; 4737 - } 4738 - } 4739 - /** 4740 - * Namespace: browser.extensionTypes 4741 - */ 4742 - namespace ExtensionTypes { 4743 - /** 4744 - * The format of an image. 4745 - */ 4746 - type ImageFormat = "jpeg" | "png"; 4747 - /** 4748 - * Details about the format, quality, area and scale of the capture. 4749 - */ 4750 - interface ImageDetails { 4751 - /** 4752 - * The format of the resulting image. Default is <code>"jpeg"</code>. 4753 - * Optional. 4754 - */ 4755 - format?: ImageFormat; 4756 - /** 4757 - * When format is <code>"jpeg"</code>, controls the quality of the resulting image. This value is ignored for PNG images. 4758 - * As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store 4759 - * it will decrease. 4760 - * Optional. 4761 - */ 4762 - quality?: number; 4763 - /** 4764 - * The area of the document to capture, in CSS pixels, relative to the page. If omitted, capture the visible viewport. 4765 - * Optional. 4766 - */ 4767 - rect?: ImageDetailsRectType; 4768 - /** 4769 - * The scale of the resulting image. Defaults to <code>devicePixelRatio</code>. 4770 - * Optional. 4771 - */ 4772 - scale?: number; 4773 - /** 4774 - * If true, temporarily resets the scroll position of the document to 0. Only takes effect if rect is also specified. 4775 - * Optional. 4776 - */ 4777 - resetScrollPosition?: boolean; 4778 - } 4779 - /** 4780 - * The soonest that the JavaScript or CSS will be injected into the tab. 4781 - */ 4782 - type RunAt = "document_start" | "document_end" | "document_idle"; 4783 - /** 4784 - * The JavaScript world for a script to execute within. <code>ISOLATED</code> is the default execution environment of 4785 - * content scripts, <code>MAIN</code> is the web page's execution environment. 4786 - */ 4787 - type ExecutionWorld = "ISOLATED" | "MAIN"; 4788 - /** 4789 - * The origin of the CSS to inject, this affects the cascading order (priority) of the stylesheet. 4790 - */ 4791 - type CSSOrigin = "user" | "author"; 4792 - /** 4793 - * Details of the script or CSS to inject. Either the code or the file property must be set, 4794 - * but both may not be set at the same time. 4795 - */ 4796 - interface InjectDetails { 4797 - /** 4798 - * JavaScript or CSS code to inject.<br><br><b>Warning:</b><br>Be careful using the <code>code</code> parameter. 4799 - * Incorrect use of it may open your extension to <a href="https://en.wikipedia.org/wiki/Cross-site_scripting"> 4800 - * cross site scripting</a> attacks. 4801 - * Optional. 4802 - */ 4803 - code?: string; 4804 - /** 4805 - * JavaScript or CSS file to inject. 4806 - * Optional. 4807 - */ 4808 - file?: string; 4809 - /** 4810 - * If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. 4811 - * By default, it's <code>false</code> and is only injected into the top frame. 4812 - * Optional. 4813 - */ 4814 - allFrames?: boolean; 4815 - /** 4816 - * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has 4817 - * access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>. 4818 - * Optional. 4819 - */ 4820 - matchAboutBlank?: boolean; 4821 - /** 4822 - * The ID of the frame to inject the script into. This may not be used in combination with <code>allFrames</code>. 4823 - * Optional. 4824 - */ 4825 - frameId?: number; 4826 - /** 4827 - * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". 4828 - * Optional. 4829 - */ 4830 - runAt?: RunAt; 4831 - /** 4832 - * The css origin of the stylesheet to inject. Defaults to "author". 4833 - * Optional. 4834 - */ 4835 - cssOrigin?: CSSOrigin; 4836 - } 4837 - type DateType = string | number | Date; 4838 - type ExtensionFileOrCode = ExtensionFileOrCodeC1Type | ExtensionFileOrCodeC2Type; 4839 - /** 4840 - * A plain JSON value 4841 - */ 4842 - interface PlainJSONValue { 4843 - [s: string]: unknown; 4844 - } 4845 - /** 4846 - * The area of the document to capture, in CSS pixels, relative to the page. If omitted, capture the visible viewport. 4847 - */ 4848 - interface ImageDetailsRectType { 4849 - x: number; 4850 - y: number; 4851 - width: number; 4852 - height: number; 4853 - } 4854 - interface ExtensionFileOrCodeC1Type { 4855 - file: Browser.Manifest.ExtensionURL; 4856 - } 4857 - interface ExtensionFileOrCodeC2Type { 4858 - code: string; 4859 - } 4860 - interface Static { 4861 - [s: string]: unknown; 4862 - } 4863 - } 4864 - /** 4865 - * Namespace: browser.extension 4866 - */ 4867 - namespace Extension { 4868 - /** 4869 - * The type of extension view. 4870 - */ 4871 - type ViewType = "tab" | "popup" | "sidebar"; 4872 - interface GetViewsFetchPropertiesType { 4873 - /** 4874 - * The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 4875 - * 'popup', 'sidebar'. 4876 - * Optional. 4877 - */ 4878 - type?: ViewType; 4879 - /** 4880 - * The window to restrict the search to. If omitted, returns all views. 4881 - * Optional. 4882 - */ 4883 - windowId?: number; 4884 - /** 4885 - * Find a view according to a tab id. If this field is omitted, returns all views. 4886 - * Optional. 4887 - */ 4888 - tabId?: number; 4889 - } 4890 - interface Static { 4891 - /** 4892 - * Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. 4893 - * 4894 - * @param fetchProperties Optional. 4895 - * @returns Array of global objects 4896 - */ 4897 - getViews(fetchProperties?: GetViewsFetchPropertiesType): Window[]; 4898 - /** 4899 - * Returns the JavaScript 'window' object for the background page running inside the current extension. 4900 - * Returns null if the extension has no background page. 4901 - */ 4902 - getBackgroundPage(): Window; 4903 - /** 4904 - * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in 4905 - * Incognito' checkbox. 4906 - */ 4907 - isAllowedIncognitoAccess(): Promise<boolean>; 4908 - /** 4909 - * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow 4910 - * access to File URLs' checkbox. 4911 - */ 4912 - isAllowedFileSchemeAccess(): Promise<boolean>; 4913 - /** 4914 - * True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. 4915 - * The latter only applies to extensions with 'split' incognito_behavior. 4916 - * Optional. 4917 - */ 4918 - inIncognitoContext?: boolean; 4919 - } 4920 - } 4921 - /** 4922 - * Namespace: browser.find 4923 - */ 4924 - namespace Find { 4925 - interface RangeData { 4926 - /** 4927 - * The index of the frame containing the match. 0 corresponds to the parent window. Note that the order of objects in the 4928 - * rangeData array will sequentially line up with the order of frame indexes: for example, 4929 - * framePos for the first sequence of rangeData objects will be 0, framePos for the next sequence will be 1, and so on. 4930 - */ 4931 - framePos: number; 4932 - /** 4933 - * The ordinal position of the text node in which the match started. 4934 - */ 4935 - startTextNodePos: number; 4936 - /** 4937 - * The ordinal position of the text node in which the match ended. 4938 - */ 4939 - endTextNodePos: number; 4940 - /** 4941 - * The ordinal string position of the start of the matched word within start text node. 4942 - * If match word include in single text node, Extension can get match word between startOffset and endOffset string index 4943 - * in the single text node. 4944 - */ 4945 - startOffset: number; 4946 - /** 4947 - * The ordinal string position of the end of the matched word within end text node. 4948 - */ 4949 - endOffset: number; 4950 - } 4951 - interface Rectangle { 4952 - /** 4953 - * Pixels from the top. 4954 - */ 4955 - top: number; 4956 - /** 4957 - * Pixels from the left. 4958 - */ 4959 - left: number; 4960 - /** 4961 - * Pixels from the bottom. 4962 - */ 4963 - bottom: number; 4964 - /** 4965 - * Pixels from the right. 4966 - */ 4967 - right: number; 4968 - } 4969 - interface RectsAndTexts { 4970 - /** 4971 - * Rectangles relative to the top-left of the viewport. 4972 - */ 4973 - rectList: Rectangle[]; 4974 - /** 4975 - * an array of strings, corresponding to the rectList array. The entry at textList[i] 4976 - * contains the part of the match bounded by the rectangle at rectList[i]. 4977 - */ 4978 - textList: string[]; 4979 - } 4980 - interface RectData { 4981 - /** 4982 - * The index of the frame containing the match. 0 corresponds to the parent window. Note that the order of objects in the 4983 - * rangeData array will sequentially line up with the order of frame indexes: for example, 4984 - * framePos for the first sequence of rangeData objects will be 0, framePos for the next sequence will be 1, and so on. 4985 - */ 4986 - rectsAndTexts: RectsAndTexts; 4987 - /** 4988 - * The complete text of the match. 4989 - */ 4990 - text: string; 4991 - } 4992 - interface FindResult { 4993 - /** 4994 - * The number of results found. 4995 - */ 4996 - count: number; 4997 - /** 4998 - * If includeRangeData was given in the options parameter, then this property will be included. 4999 - * It is provided as an array of RangeData objects, one for each match. Each RangeData object describes where in the DOM 5000 - * tree the match was found. This would enable, for example, an extension to get the text surrounding each match, 5001 - * so as to display context for the matches. The items correspond to the items given in rectData, so rangeData[i] 5002 - * describes the same match as rectData[i]. 5003 - * Optional. 5004 - */ 5005 - rangeData?: RangeData[]; 5006 - /** 5007 - * If includeRectData was given in the options parameter, then this property will be included. 5008 - * It is an array of RectData objects. It contains client rectangles for all the text matched in the search, 5009 - * relative to the top-left of the viewport. Extensions can use this to provide custom highlighting of the results. 5010 - * Optional. 5011 - */ 5012 - rectData?: RectData[]; 5013 - } 5014 - /** 5015 - * Search parameters. 5016 - */ 5017 - interface FindParamsType { 5018 - /** 5019 - * Tab to query. Defaults to the active tab. 5020 - * Optional. 5021 - */ 5022 - tabId?: number; 5023 - /** 5024 - * Find only ranges with case sensitive match. 5025 - * Optional. 5026 - */ 5027 - caseSensitive?: boolean; 5028 - /** 5029 - * Find only ranges with diacritic sensitive match. 5030 - * Optional. 5031 - */ 5032 - matchDiacritics?: boolean; 5033 - /** 5034 - * Find only ranges that match entire word. 5035 - * Optional. 5036 - */ 5037 - entireWord?: boolean; 5038 - /** 5039 - * Return rectangle data which describes visual position of search results. 5040 - * Optional. 5041 - */ 5042 - includeRectData?: boolean; 5043 - /** 5044 - * Return range data which provides range data in a serializable form. 5045 - * Optional. 5046 - */ 5047 - includeRangeData?: boolean; 5048 - } 5049 - /** 5050 - * highlightResults parameters 5051 - */ 5052 - interface HighlightResultsParamsType { 5053 - /** 5054 - * Found range to be highlighted. Default highlights all ranges. 5055 - * Optional. 5056 - */ 5057 - rangeIndex?: number; 5058 - /** 5059 - * Tab to highlight. Defaults to the active tab. 5060 - * Optional. 5061 - */ 5062 - tabId?: number; 5063 - /** 5064 - * Don't scroll to highlighted item. 5065 - * Optional. 5066 - */ 5067 - noScroll?: boolean; 5068 - } 5069 - interface Static { 5070 - /** 5071 - * Search for text in document and store found ranges in array, in document order. 5072 - * 5073 - * @param queryphrase The string to search for. 5074 - * @param params Optional. Search parameters. 5075 - */ 5076 - find(queryphrase: string, params?: FindParamsType): Promise<FindResult>; 5077 - /** 5078 - * Highlight a range 5079 - * 5080 - * @param params Optional. highlightResults parameters 5081 - */ 5082 - highlightResults(params?: HighlightResultsParamsType): Promise<void>; 5083 - /** 5084 - * Remove all highlighting from previous searches. 5085 - * 5086 - * @param tabId Optional. Tab to highlight. Defaults to the active tab. 5087 - */ 5088 - removeHighlighting(tabId?: number): Promise<void>; 5089 - } 5090 - } 5091 - /** 5092 - * Namespace: browser.geckoProfiler 5093 - */ 5094 - namespace GeckoProfiler { 5095 - type ProfilerFeature = "java" | "js" | "mainthreadio" | "fileio" | "fileioall" | "nomarkerstacks" | "screenshots" | "seqstyle" | "stackwalk" | "jsallocations" | "nostacksampling" | "nativeallocations" | "ipcmessages" | "audiocallbacktracing" | "cpu" | "notimerresolutionchange" | "cpuallthreads" | "samplingallthreads" | "markersallthreads" | "unregisteredthreads" | "processcpu" | "power" | "responsiveness" | "cpufreq" | "bandwidth" | "memory" | "tracing" | "sandbox" | "flows"; 5096 - type supports = "windowLength"; 5097 - interface StartSettingsType { 5098 - /** 5099 - * The maximum size in bytes of the buffer used to store profiling data. A larger value allows capturing a profile that 5100 - * covers a greater amount of time. 5101 - */ 5102 - bufferSize: number; 5103 - /** 5104 - * The length of the window of time that's kept in the buffer. Any collected samples are discarded as soon as they are 5105 - * older than the number of seconds specified in this setting. Zero means no duration restriction. 5106 - * Optional. 5107 - */ 5108 - windowLength?: number; 5109 - /** 5110 - * Interval in milliseconds between samples of profiling data. A smaller value will increase the detail of the profiles 5111 - * captured. 5112 - */ 5113 - interval: number; 5114 - /** 5115 - * A list of active features for the profiler. 5116 - */ 5117 - features: ProfilerFeature[]; 5118 - /** 5119 - * A list of thread names for which to capture profiles. 5120 - * Optional. 5121 - */ 5122 - threads?: string[]; 5123 - } 5124 - interface Static { 5125 - /** 5126 - * Starts the profiler with the specified settings. 5127 - */ 5128 - start(settings: StartSettingsType): void; 5129 - /** 5130 - * Stops the profiler and discards any captured profile data. 5131 - */ 5132 - stop(): void; 5133 - /** 5134 - * Pauses the profiler, keeping any profile data that is already written. 5135 - */ 5136 - pause(): void; 5137 - /** 5138 - * Resumes the profiler with the settings that were initially used to start it. 5139 - */ 5140 - resume(): void; 5141 - /** 5142 - * Gathers the profile data from the current profiling session, and writes it to disk. 5143 - * The returned promise resolves to a path that locates the created file. 5144 - * 5145 - * @param fileName The name of the file inside the profile/profiler directory 5146 - */ 5147 - dumpProfileToFile(fileName: string): void; 5148 - /** 5149 - * Gathers the profile data from the current profiling session. 5150 - */ 5151 - getProfile(): void; 5152 - /** 5153 - * Gathers the profile data from the current profiling session. The returned promise resolves to an array buffer that 5154 - * contains a JSON string. 5155 - */ 5156 - getProfileAsArrayBuffer(): void; 5157 - /** 5158 - * Gathers the profile data from the current profiling session. The returned promise resolves to an array buffer that 5159 - * contains a gzipped JSON string. 5160 - */ 5161 - getProfileAsGzippedArrayBuffer(): void; 5162 - /** 5163 - * Gets the debug symbols for a particular library. 5164 - * 5165 - * @param debugName The name of the library's debug file. For example, 'xul.pdb 5166 - * @param breakpadId The Breakpad ID of the library 5167 - */ 5168 - getSymbols(debugName: string, breakpadId: string): void; 5169 - /** 5170 - * Fires when the profiler starts/stops running. 5171 - * 5172 - * @param isRunning Whether the profiler is running or not. Pausing the profiler will not affect this value. 5173 - */ 5174 - onRunning: Events.Event<(isRunning: boolean) => void>; 5175 - } 5176 - } 5177 - /** 5178 - * Namespace: browser.history 5179 - */ 5180 - namespace History { 5181 - /** 5182 - * The $(topic:transition-types)[transition type] for this visit from its referrer. 5183 - */ 5184 - type TransitionType = "link" | "typed" | "auto_bookmark" | "auto_subframe" | "manual_subframe" | "generated" | "auto_toplevel" | "form_submit" | "reload" | "keyword" | "keyword_generated"; 5185 - /** 5186 - * An object encapsulating one result of a history query. 5187 - */ 5188 - interface HistoryItem { 5189 - /** 5190 - * The unique identifier for the item. 5191 - */ 5192 - id: string; 5193 - /** 5194 - * The URL navigated to by a user. 5195 - * Optional. 5196 - */ 5197 - url?: string; 5198 - /** 5199 - * The title of the page when it was last loaded. 5200 - * Optional. 5201 - */ 5202 - title?: string; 5203 - /** 5204 - * When this page was last loaded, represented in milliseconds since the epoch. 5205 - * Optional. 5206 - */ 5207 - lastVisitTime?: number; 5208 - /** 5209 - * The number of times the user has navigated to this page. 5210 - * Optional. 5211 - */ 5212 - visitCount?: number; 5213 - /** 5214 - * The number of times the user has navigated to this page by typing in the address. 5215 - * Optional. 5216 - */ 5217 - typedCount?: number; 5218 - } 5219 - /** 5220 - * An object encapsulating one visit to a URL. 5221 - */ 5222 - interface VisitItem { 5223 - /** 5224 - * The unique identifier for the item. 5225 - */ 5226 - id: string; 5227 - /** 5228 - * The unique identifier for this visit. 5229 - */ 5230 - visitId: string; 5231 - /** 5232 - * When this visit occurred, represented in milliseconds since the epoch. 5233 - * Optional. 5234 - */ 5235 - visitTime?: number; 5236 - /** 5237 - * The visit ID of the referrer. 5238 - */ 5239 - referringVisitId: string; 5240 - /** 5241 - * The $(topic:transition-types)[transition type] for this visit from its referrer. 5242 - */ 5243 - transition: TransitionType; 5244 - } 5245 - interface SearchQueryType { 5246 - /** 5247 - * A free-text query to the history service. Leave empty to retrieve all pages. 5248 - */ 5249 - text: string; 5250 - /** 5251 - * Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past. 5252 - * Optional. 5253 - */ 5254 - startTime?: ExtensionTypes.DateType; 5255 - /** 5256 - * Limit results to those visited before this date. 5257 - * Optional. 5258 - */ 5259 - endTime?: ExtensionTypes.DateType; 5260 - /** 5261 - * The maximum number of results to retrieve. Defaults to 100. 5262 - * Optional. 5263 - */ 5264 - maxResults?: number; 5265 - } 5266 - interface GetVisitsDetailsType { 5267 - /** 5268 - * The URL for which to retrieve visit information. It must be in the format as returned from a call to history.search. 5269 - */ 5270 - url: string; 5271 - } 5272 - interface AddUrlDetailsType { 5273 - /** 5274 - * The URL to add. Must be a valid URL that can be added to history. 5275 - */ 5276 - url: string; 5277 - /** 5278 - * The title of the page. 5279 - * Optional. 5280 - */ 5281 - title?: string; 5282 - /** 5283 - * The $(topic:transition-types)[transition type] for this visit from its referrer. 5284 - * Optional. 5285 - */ 5286 - transition?: TransitionType; 5287 - /** 5288 - * The date when this visit occurred. 5289 - * Optional. 5290 - */ 5291 - visitTime?: ExtensionTypes.DateType; 5292 - } 5293 - interface DeleteUrlDetailsType { 5294 - /** 5295 - * The URL to remove. 5296 - */ 5297 - url: string; 5298 - } 5299 - interface DeleteRangeRangeType { 5300 - /** 5301 - * Items added to history after this date. 5302 - */ 5303 - startTime: ExtensionTypes.DateType; 5304 - /** 5305 - * Items added to history before this date. 5306 - */ 5307 - endTime: ExtensionTypes.DateType; 5308 - } 5309 - interface OnVisitRemovedRemovedType { 5310 - /** 5311 - * True if all history was removed. If true, then urls will be empty. 5312 - */ 5313 - allHistory: boolean; 5314 - urls: string[]; 5315 - } 5316 - interface OnTitleChangedChangedType { 5317 - /** 5318 - * The URL for which the title has changed 5319 - */ 5320 - url: string; 5321 - /** 5322 - * The new title for the URL. 5323 - */ 5324 - title: string; 5325 - } 5326 - interface Static { 5327 - /** 5328 - * Searches the history for the last visit time of each page matching the query. 5329 - */ 5330 - search(query: SearchQueryType): Promise<HistoryItem[]>; 5331 - /** 5332 - * Retrieves information about visits to a URL. 5333 - */ 5334 - getVisits(details: GetVisitsDetailsType): Promise<VisitItem[]>; 5335 - /** 5336 - * Adds a URL to the history with a default visitTime of the current time and a default $(topic:transition-types) 5337 - * [transition type] of "link". 5338 - */ 5339 - addUrl(details: AddUrlDetailsType): Promise<void>; 5340 - /** 5341 - * Removes all occurrences of the given URL from the history. 5342 - */ 5343 - deleteUrl(details: DeleteUrlDetailsType): Promise<void>; 5344 - /** 5345 - * Removes all items within the specified date range from the history. Pages will not be removed from the history unless 5346 - * all visits fall within the range. 5347 - */ 5348 - deleteRange(range: DeleteRangeRangeType): Promise<void>; 5349 - /** 5350 - * Deletes all items from the history. 5351 - */ 5352 - deleteAll(): Promise<void>; 5353 - /** 5354 - * Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. 5355 - */ 5356 - onVisited: Events.Event<(result: HistoryItem) => void>; 5357 - /** 5358 - * Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged 5359 - * from history. 5360 - */ 5361 - onVisitRemoved: Events.Event<(removed: OnVisitRemovedRemovedType) => void>; 5362 - /** 5363 - * Fired when the title of a URL is changed in the browser history. 5364 - */ 5365 - onTitleChanged: Events.Event<(changed: OnTitleChangedChangedType) => void>; 5366 - } 5367 - } 5368 - /** 5369 - * Namespace: browser.i18n 5370 - */ 5371 - namespace I18n { 5372 - /** 5373 - * An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this 5374 - * method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'> 5375 - * kLanguageInfoTable</a>. For an unknown language, <code>und</code> will be returned, which means that [percentage] 5376 - * of the text is unknown to CLD 5377 - */ 5378 - type LanguageCode = string; 5379 - /** 5380 - * LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage 5381 - */ 5382 - interface DetectLanguageCallbackResultType { 5383 - /** 5384 - * CLD detected language reliability 5385 - */ 5386 - isReliable: boolean; 5387 - /** 5388 - * array of detectedLanguage 5389 - */ 5390 - languages: DetectLanguageCallbackResultTypeLanguagesItemType[]; 5391 - } 5392 - /** 5393 - * DetectedLanguage object that holds detected ISO language code and its percentage in the input string 5394 - */ 5395 - interface DetectLanguageCallbackResultTypeLanguagesItemType { 5396 - language: LanguageCode; 5397 - /** 5398 - * The percentage of the detected language 5399 - */ 5400 - percentage: number; 5401 - } 5402 - interface Static { 5403 - /** 5404 - * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, 5405 - * use $(ref:i18n.getUILanguage). 5406 - */ 5407 - getAcceptLanguages(): Promise<LanguageCode[]>; 5408 - /** 5409 - * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). 5410 - * If the format of the <code>getMessage()</code> call is wrong &mdash; for example, <em>messageName</em> 5411 - * is not a string or the <em>substitutions</em> array has more than 9 elements &mdash; this method returns <code> 5412 - * undefined</code>. 5413 - * 5414 - * @param messageName The name of the message, as specified in the <code>$(topic:i18n-messages)[messages.json]</code> file. 5415 - * @param substitutions Optional. Substitution strings, if the message requires any. 5416 - * @returns Message localized for current locale. 5417 - */ 5418 - getMessage(messageName: string, substitutions?: string[] | string): Promise<string>; 5419 - /** 5420 - * Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages) 5421 - * which returns the preferred user languages. 5422 - * 5423 - * @returns The browser UI language code such as en-US or fr-FR. 5424 - */ 5425 - getUILanguage(): string; 5426 - /** 5427 - * Detects the language of the provided text using CLD. 5428 - * 5429 - * @param text User input string to be translated. 5430 - */ 5431 - detectLanguage(text: string): Promise<DetectLanguageCallbackResultType>; 5432 - } 5433 - } 5434 - /** 5435 - * Namespace: browser.identity 5436 - */ 5437 - namespace Identity { 5438 - /** 5439 - * An object encapsulating an OAuth account id. 5440 - */ 5441 - interface AccountInfo { 5442 - /** 5443 - * A unique identifier for the account. This ID will not change for the lifetime of the account. 5444 - */ 5445 - id: string; 5446 - } 5447 - interface LaunchWebAuthFlowDetailsType { 5448 - url: Browser.Manifest.HttpURL; 5449 - /** 5450 - * Optional. 5451 - */ 5452 - interactive?: boolean; 5453 - } 5454 - interface Static { 5455 - /** 5456 - * Starts an auth flow at the specified URL. 5457 - */ 5458 - launchWebAuthFlow(details: LaunchWebAuthFlowDetailsType): Promise<string>; 5459 - /** 5460 - * Generates a redirect URL to be used in |launchWebAuthFlow|. 5461 - * 5462 - * @param path Optional. The path appended to the end of the generated URL. 5463 - */ 5464 - getRedirectURL(path?: string): Promise<string>; 5465 - } 5466 - } 5467 - /** 5468 - * Namespace: browser.idle 5469 - */ 5470 - namespace Idle { 5471 - type IdleState = "active" | "idle" | "locked"; 5472 - interface Static { 5473 - /** 5474 - * Returns "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise. 5475 - * 5476 - * @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since 5477 - * the last user input detected. 5478 - */ 5479 - queryState(detectionIntervalInSeconds: number): Promise<IdleState>; 5480 - /** 5481 - * Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. 5482 - * The default interval is 60 seconds. 5483 - * 5484 - * @param intervalInSeconds Threshold, in seconds, used to determine when the system is in an idle state. 5485 - */ 5486 - setDetectionInterval(intervalInSeconds: number): void; 5487 - /** 5488 - * Fired when the system changes to an active or idle state. The event fires with "idle" if the the user has not generated 5489 - * any input for a specified number of seconds, and "active" when the user generates input on an idle system. 5490 - */ 5491 - onStateChanged: Events.Event<(newState: IdleState) => void>; 5492 - } 5493 - } 5494 - /** 5495 - * Namespace: browser.management 5496 - */ 5497 - namespace Management { 5498 - /** 5499 - * Information about an icon belonging to an extension. 5500 - */ 5501 - interface IconInfo { 5502 - /** 5503 - * A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, 5504 - * and 16. 5505 - */ 5506 - size: number; 5507 - /** 5508 - * The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, 5509 - * for example), append <code>?grayscale=true</code> to the URL. 5510 - */ 5511 - url: string; 5512 - } 5513 - /** 5514 - * A reason the item is disabled. 5515 - */ 5516 - type ExtensionDisabledReason = "unknown" | "permissions_increase"; 5517 - /** 5518 - * The type of this extension, 'extension' or 'theme'. 5519 - */ 5520 - type ExtensionType = "extension" | "theme"; 5521 - /** 5522 - * How the extension was installed. One of<br><var>development</var>: The extension was loaded unpacked in developer mode, 5523 - * <br><var>normal</var>: The extension was installed normally via an .xpi file,<br><var>sideload</var> 5524 - * : The extension was installed by other software on the machine,<br><var>admin</var> 5525 - * : The extension was installed by policy,<br><var>other</var>: The extension was installed by other means. 5526 - */ 5527 - type ExtensionInstallType = "development" | "normal" | "sideload" | "admin" | "other"; 5528 - /** 5529 - * Information about an installed extension. 5530 - */ 5531 - interface ExtensionInfo { 5532 - /** 5533 - * The extension's unique identifier. 5534 - */ 5535 - id: string; 5536 - /** 5537 - * The name of this extension. 5538 - */ 5539 - name: string; 5540 - /** 5541 - * A short version of the name of this extension. 5542 - * Optional. 5543 - */ 5544 - shortName?: string; 5545 - /** 5546 - * The description of this extension. 5547 - */ 5548 - description: string; 5549 - /** 5550 - * The <a href='manifest/version'>version</a> of this extension. 5551 - */ 5552 - version: string; 5553 - /** 5554 - * The <a href='manifest/version#version_name'>version name</a> of this extension if the manifest specified one. 5555 - * Optional. 5556 - */ 5557 - versionName?: string; 5558 - /** 5559 - * Whether this extension can be disabled or uninstalled by the user. 5560 - */ 5561 - mayDisable: boolean; 5562 - /** 5563 - * Whether it is currently enabled or disabled. 5564 - */ 5565 - enabled: boolean; 5566 - /** 5567 - * A reason the item is disabled. 5568 - * Optional. 5569 - */ 5570 - disabledReason?: ExtensionDisabledReason; 5571 - /** 5572 - * The type of this extension, 'extension' or 'theme'. 5573 - */ 5574 - type: ExtensionType; 5575 - /** 5576 - * The URL of the homepage of this extension. 5577 - * Optional. 5578 - */ 5579 - homepageUrl?: string; 5580 - /** 5581 - * The update URL of this extension. 5582 - * Optional. 5583 - */ 5584 - updateUrl?: string; 5585 - /** 5586 - * The url for the item's options page, if it has one. 5587 - */ 5588 - optionsUrl: string; 5589 - /** 5590 - * A list of icon information. Note that this just reflects what was declared in the manifest, 5591 - * and the actual image at that url may be larger or smaller than what was declared, 5592 - * so you might consider using explicit width and height attributes on img tags referencing these images. 5593 - * See the <a href='manifest/icons'>manifest documentation on icons</a> for more details. 5594 - * Optional. 5595 - */ 5596 - icons?: IconInfo[]; 5597 - /** 5598 - * Returns a list of API based permissions. 5599 - * Optional. 5600 - */ 5601 - permissions?: string[]; 5602 - /** 5603 - * Returns a list of host based permissions. 5604 - * Optional. 5605 - */ 5606 - hostPermissions?: string[]; 5607 - /** 5608 - * How the extension was installed. 5609 - */ 5610 - installType: ExtensionInstallType; 5611 - } 5612 - interface InstallOptionsType { 5613 - /** 5614 - * URL pointing to the XPI file on addons.mozilla.org or similar. 5615 - */ 5616 - url: Browser.Manifest.HttpURL; 5617 - /** 5618 - * A hash of the XPI file, using sha256 or stronger. 5619 - * Optional. 5620 - */ 5621 - hash?: string; 5622 - } 5623 - interface InstallCallbackResultType { 5624 - id: Browser.Manifest.ExtensionID; 5625 - } 5626 - interface UninstallSelfOptionsType { 5627 - /** 5628 - * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false. 5629 - * Optional. 5630 - */ 5631 - showConfirmDialog?: boolean; 5632 - /** 5633 - * The message to display to a user when being asked to confirm removal of the extension. 5634 - * Optional. 5635 - */ 5636 - dialogMessage?: string; 5637 - } 5638 - interface Static { 5639 - /** 5640 - * Returns a list of information about installed extensions. 5641 - */ 5642 - getAll(): Promise<ExtensionInfo[]>; 5643 - /** 5644 - * Returns information about the installed extension that has the given ID. 5645 - * 5646 - * @param id The ID from an item of $(ref:management.ExtensionInfo). 5647 - */ 5648 - get(id: Browser.Manifest.ExtensionID): Promise<ExtensionInfo>; 5649 - /** 5650 - * Installs and enables a theme extension from the given url. 5651 - */ 5652 - install(options: InstallOptionsType): Promise<InstallCallbackResultType>; 5653 - /** 5654 - * Returns information about the calling extension. Note: This function can be used without requesting the 'management' 5655 - * permission in the manifest. 5656 - */ 5657 - getSelf(): Promise<ExtensionInfo>; 5658 - /** 5659 - * Uninstalls the calling extension. Note: This function can be used without requesting the 'management' permission in the 5660 - * manifest. 5661 - * 5662 - * @param options Optional. 5663 - */ 5664 - uninstallSelf(options?: UninstallSelfOptionsType): Promise<void>; 5665 - /** 5666 - * Enables or disables the given add-on. 5667 - * 5668 - * @param id ID of the add-on to enable/disable. 5669 - * @param enabled Whether to enable or disable the add-on. 5670 - */ 5671 - setEnabled(id: string, enabled: boolean): Promise<void>; 5672 - /** 5673 - * Fired when an addon has been disabled. 5674 - */ 5675 - onDisabled: Events.Event<(info: ExtensionInfo) => void>; 5676 - /** 5677 - * Fired when an addon has been enabled. 5678 - */ 5679 - onEnabled: Events.Event<(info: ExtensionInfo) => void>; 5680 - /** 5681 - * Fired when an addon has been installed. 5682 - */ 5683 - onInstalled: Events.Event<(info: ExtensionInfo) => void>; 5684 - /** 5685 - * Fired when an addon has been uninstalled. 5686 - */ 5687 - onUninstalled: Events.Event<(info: ExtensionInfo) => void>; 5688 - } 5689 - } 5690 - /** 5691 - * Namespace: browser.manifest 5692 - */ 5693 - namespace Manifest { 5694 - /** 5695 - * Common properties for all manifest.json files 5696 - */ 5697 - interface ManifestBase { 5698 - manifest_version: number; 5699 - /** 5700 - * The applications property is deprecated, please use 'browser_specific_settings' 5701 - * Optional. 5702 - */ 5703 - applications?: DeprecatedApplications; 5704 - /** 5705 - * Optional. 5706 - */ 5707 - browser_specific_settings?: BrowserSpecificSettings; 5708 - /** 5709 - * Name must be at least 2, and should be at most 75 characters 5710 - */ 5711 - name: string; 5712 - /** 5713 - * Optional. 5714 - */ 5715 - short_name?: string; 5716 - /** 5717 - * Optional. 5718 - */ 5719 - description?: string; 5720 - /** 5721 - * Optional. 5722 - */ 5723 - author?: string; 5724 - version: string; 5725 - /** 5726 - * Optional. 5727 - */ 5728 - homepage_url?: string; 5729 - /** 5730 - * Optional. 5731 - */ 5732 - install_origins?: string[]; 5733 - /** 5734 - * Optional. 5735 - */ 5736 - developer?: ManifestBaseDeveloperType; 5737 - /** 5738 - * In addition to the version field, which is used for update purposes, version_name can be set to a descriptive version 5739 - * string and will be used for display purposes if present. If no version_name is present, 5740 - * the version field will be used for display purposes as well. 5741 - * Optional. 5742 - */ 5743 - version_name?: string; 5744 - } 5745 - /** 5746 - * Represents a WebExtension manifest.json file 5747 - */ 5748 - interface WebExtensionManifest extends ManifestBase { 5749 - /** 5750 - * Optional. 5751 - */ 5752 - minimum_chrome_version?: string; 5753 - /** 5754 - * Optional. 5755 - */ 5756 - minimum_opera_version?: string; 5757 - /** 5758 - * Optional. 5759 - */ 5760 - icons?: Record<string, ExtensionFileUrl>; 5761 - /** 5762 - * The 'split' value is not supported. 5763 - * Optional. 5764 - */ 5765 - incognito?: WebExtensionManifestIncognitoEnum; 5766 - /** 5767 - * Optional. 5768 - */ 5769 - background?: WebExtensionManifestBackgroundType; 5770 - /** 5771 - * Alias property for options_ui.page, ignored when options_ui.page is set. When using this property the options page is 5772 - * always opened in a new tab. 5773 - * Optional. 5774 - */ 5775 - options_page?: ExtensionURL; 5776 - /** 5777 - * Optional. 5778 - */ 5779 - options_ui?: WebExtensionManifestOptionsUiType; 5780 - /** 5781 - * Optional. 5782 - */ 5783 - content_scripts?: ContentScript[]; 5784 - /** 5785 - * Optional. 5786 - */ 5787 - content_security_policy?: string | WebExtensionManifestContentSecurityPolicyC2Type; 5788 - /** 5789 - * Optional. 5790 - */ 5791 - permissions?: PermissionOrOrigin[] | Permission[]; 5792 - /** 5793 - * Optional. 5794 - */ 5795 - granted_host_permissions?: boolean; 5796 - /** 5797 - * Optional. 5798 - */ 5799 - host_permissions?: MatchPattern[]; 5800 - /** 5801 - * Optional. 5802 - */ 5803 - optional_host_permissions?: MatchPattern[]; 5804 - /** 5805 - * Optional. 5806 - */ 5807 - optional_permissions?: OptionalPermissionOrOrigin[]; 5808 - /** 5809 - * Optional. 5810 - */ 5811 - web_accessible_resources?: string[] | WebExtensionManifestWebAccessibleResourcesC2ItemType[]; 5812 - /** 5813 - * Optional. 5814 - */ 5815 - hidden?: boolean; 5816 - /** 5817 - * Optional. 5818 - */ 5819 - action?: ActionManifest; 5820 - /** 5821 - * Optional. 5822 - */ 5823 - browser_action?: ActionManifest; 5824 - /** 5825 - * Optional. 5826 - */ 5827 - chrome_settings_overrides?: WebExtensionManifestChromeSettingsOverridesType; 5828 - /** 5829 - * Optional. 5830 - */ 5831 - commands?: Record<string, WebExtensionManifestCommandsType>; 5832 - /** 5833 - * Optional. 5834 - */ 5835 - declarative_net_request?: WebExtensionManifestDeclarativeNetRequestType; 5836 - /** 5837 - * Optional. 5838 - */ 5839 - devtools_page?: ExtensionURL; 5840 - /** 5841 - * Optional. 5842 - */ 5843 - experiment_apis?: WebExtensionManifestExperimentApisType; 5844 - /** 5845 - * A list of protocol handler definitions. 5846 - * Optional. 5847 - */ 5848 - protocol_handlers?: ProtocolHandler[]; 5849 - /** 5850 - * Optional. 5851 - */ 5852 - default_locale?: string; 5853 - /** 5854 - * Optional. 5855 - */ 5856 - l10n_resources?: string[]; 5857 - /** 5858 - * Optional. 5859 - */ 5860 - omnibox?: WebExtensionManifestOmniboxType; 5861 - /** 5862 - * Optional. 5863 - */ 5864 - page_action?: WebExtensionManifestPageActionType; 5865 - /** 5866 - * Optional. 5867 - */ 5868 - sidebar_action?: WebExtensionManifestSidebarActionType; 5869 - /** 5870 - * Optional. 5871 - */ 5872 - theme_experiment?: ThemeExperiment; 5873 - /** 5874 - * Optional. 5875 - */ 5876 - chrome_url_overrides?: WebExtensionManifestChromeUrlOverridesType; 5877 - /** 5878 - * Optional. 5879 - */ 5880 - user_scripts?: WebExtensionManifestUserScriptsType; 5881 - } 5882 - /** 5883 - * Represents a WebExtension language pack manifest.json file 5884 - */ 5885 - interface WebExtensionLangpackManifest extends ManifestBase { 5886 - langpack_id: string; 5887 - languages: Record<string, WebExtensionLangpackManifestLanguagesPatternType>; 5888 - /** 5889 - * Optional. 5890 - */ 5891 - sources?: Record<string, WebExtensionLangpackManifestSourcesPatternType>; 5892 - } 5893 - /** 5894 - * Represents a WebExtension dictionary manifest.json file 5895 - */ 5896 - interface WebExtensionDictionaryManifest extends ManifestBase { 5897 - dictionaries: Record<string, string>; 5898 - } 5899 - interface ThemeIcons { 5900 - /** 5901 - * A light icon to use for dark themes 5902 - */ 5903 - light: ExtensionURL; 5904 - /** 5905 - * The dark icon to use for light themes 5906 - */ 5907 - dark: ExtensionURL; 5908 - /** 5909 - * The size of the icons 5910 - */ 5911 - size: number; 5912 - } 5913 - type OptionalOnlyPermission = "trialML" | "userScripts"; 5914 - type OptionalPermissionNoPrompt = "idle" | "cookies" | "menus.overrideContext" | "scripting" | "search" | "tabGroups" | "activeTab" | "webRequest" | "webRequestAuthProvider" | "webRequestBlocking" | "webRequestFilterResponse" | "webRequestFilterResponse.serviceWorkerScript"; 5915 - type OptionalPermission = OptionalPermissionNoPrompt | "clipboardRead" | "clipboardWrite" | "geolocation" | "notifications" | "bookmarks" | "browserSettings" | "browsingData" | "declarativeNetRequestFeedback" | "devtools" | "downloads" | "downloads.open" | "find" | "history" | "management" | "pkcs11" | "privacy" | "proxy" | "nativeMessaging" | "sessions" | "tabs" | "tabHide" | "topSites" | "webNavigation" | "identity.email"; 5916 - type OptionalPermissionOrOrigin = OptionalPermission | OptionalOnlyPermission | MatchPattern; 5917 - type PermissionPrivileged = "mozillaAddons" | "activityLog" | "networkStatus" | "normandyAddonStudy"; 5918 - type CommonDataCollectionPermission = "authenticationInfo" | "bookmarksInfo" | "browsingActivity" | "financialAndPaymentInfo" | "healthInfo" | "locationInfo" | "personalCommunications" | "personallyIdentifyingInfo" | "searchTerms" | "websiteActivity" | "websiteContent"; 5919 - type DataCollectionPermission = CommonDataCollectionPermission | "none"; 5920 - type OptionalDataCollectionPermission = CommonDataCollectionPermission | "technicalAndInteraction"; 5921 - type PermissionNoPrompt = OptionalPermissionNoPrompt | PermissionPrivileged | "alarms" | "storage" | "unlimitedStorage" | "captivePortal" | "contextualIdentities" | "declarativeNetRequestWithHostAccess" | "dns" | "geckoProfiler" | "identity" | "menus" | "contextMenus" | "theme"; 5922 - type Permission = PermissionNoPrompt | OptionalPermission | "declarativeNetRequest" | string; 5923 - type PermissionOrOrigin = Permission | MatchPattern; 5924 - type HttpURL = string; 5925 - type ExtensionURL = string; 5926 - type ExtensionFileUrl = string; 5927 - type ImageDataOrExtensionURL = string; 5928 - type ExtensionID = string; 5929 - interface FirefoxSpecificProperties { 5930 - /** 5931 - * Optional. 5932 - */ 5933 - id?: ExtensionID; 5934 - /** 5935 - * Optional. 5936 - */ 5937 - update_url?: string; 5938 - /** 5939 - * Optional. 5940 - */ 5941 - strict_min_version?: string; 5942 - /** 5943 - * Optional. 5944 - */ 5945 - strict_max_version?: string; 5946 - /** 5947 - * Optional. 5948 - */ 5949 - admin_install_only?: boolean; 5950 - /** 5951 - * Optional. 5952 - */ 5953 - data_collection_permissions?: FirefoxSpecificPropertiesDataCollectionPermissionsType; 5954 - } 5955 - interface GeckoAndroidSpecificProperties { 5956 - /** 5957 - * Optional. 5958 - */ 5959 - strict_min_version?: string; 5960 - /** 5961 - * Optional. 5962 - */ 5963 - strict_max_version?: string; 5964 - } 5965 - interface DeprecatedApplications { 5966 - /** 5967 - * Optional. 5968 - */ 5969 - gecko?: FirefoxSpecificProperties; 5970 - } 5971 - interface BrowserSpecificSettings { 5972 - /** 5973 - * Optional. 5974 - */ 5975 - gecko?: FirefoxSpecificProperties; 5976 - /** 5977 - * Optional. 5978 - */ 5979 - gecko_android?: GeckoAndroidSpecificProperties; 5980 - } 5981 - type MatchPattern = "<all_urls>" | MatchPatternRestricted | MatchPatternUnestricted; 5982 - /** 5983 - * Same as MatchPattern above, but excludes <all_urls> 5984 - */ 5985 - type MatchPatternRestricted = string; 5986 - /** 5987 - * Mostly unrestricted match patterns for privileged add-ons. This should technically be rejected for unprivileged add-ons, 5988 - * but, reasons. The MatchPattern class will still refuse privileged schemes for those extensions. 5989 - */ 5990 - type MatchPatternUnestricted = string; 5991 - /** 5992 - * Details of the script or CSS to inject. Either the code or the file property must be set, 5993 - * but both may not be set at the same time. Based on InjectDetails, but using underscore rather than camel case naming 5994 - * conventions. 5995 - */ 5996 - interface ContentScript { 5997 - matches: MatchPattern[]; 5998 - /** 5999 - * Optional. 6000 - */ 6001 - exclude_matches?: MatchPattern[]; 6002 - /** 6003 - * Optional. 6004 - */ 6005 - include_globs?: string[]; 6006 - /** 6007 - * Optional. 6008 - */ 6009 - exclude_globs?: string[]; 6010 - /** 6011 - * The list of CSS files to inject 6012 - * Optional. 6013 - */ 6014 - css?: ExtensionURL[]; 6015 - /** 6016 - * The list of JS files to inject 6017 - * Optional. 6018 - */ 6019 - js?: ExtensionURL[]; 6020 - /** 6021 - * If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. 6022 - * By default, it's <code>false</code> and is only injected into the top frame. 6023 - * Optional. 6024 - */ 6025 - all_frames?: boolean; 6026 - /** 6027 - * If match_about_blank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension 6028 - * has access to its parent document. Ignored if match_origin_as_fallback is specified. By default it is <code>false</code>. 6029 - * Optional. 6030 - */ 6031 - match_about_blank?: boolean; 6032 - /** 6033 - * If match_origin_as_fallback is true, then the code is also injected in about:, data:, 6034 - * blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use 6035 - * of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is <code> 6036 - * false</code>. 6037 - * Optional. 6038 - */ 6039 - match_origin_as_fallback?: boolean; 6040 - /** 6041 - * The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". 6042 - * Optional. 6043 - */ 6044 - run_at?: Browser.ExtensionTypes.RunAt; 6045 - /** 6046 - * The JavaScript world for a script to execute within. Defaults to "ISOLATED". 6047 - * Optional. 6048 - */ 6049 - world?: Browser.ExtensionTypes.ExecutionWorld; 6050 - } 6051 - type IconPath = Record<string, ExtensionFileUrl> | ExtensionFileUrl; 6052 - type IconImageData = Record<string, ImageData> | ImageData; 6053 - interface ActionManifest { 6054 - /** 6055 - * Optional. 6056 - */ 6057 - default_title?: string; 6058 - /** 6059 - * Optional. 6060 - */ 6061 - default_icon?: IconPath; 6062 - /** 6063 - * Specifies icons to use for dark and light themes 6064 - * Optional. 6065 - */ 6066 - theme_icons?: ThemeIcons[]; 6067 - /** 6068 - * Optional. 6069 - */ 6070 - default_popup?: string; 6071 - /** 6072 - * Deprecated in Manifest V3. 6073 - * Optional. 6074 - */ 6075 - browser_style?: boolean; 6076 - /** 6077 - * Defines the location the browserAction will appear by default. The default location is navbar. 6078 - * Optional. 6079 - */ 6080 - default_area?: ActionManifestDefaultAreaEnum; 6081 - } 6082 - type KeyName = string; 6083 - /** 6084 - * Represents a protocol handler definition. 6085 - */ 6086 - interface ProtocolHandler { 6087 - /** 6088 - * A user-readable title string for the protocol handler. This will be displayed to the user in interface objects as needed. 6089 - */ 6090 - name: string; 6091 - /** 6092 - * The protocol the site wishes to handle, specified as a string. For example, you can register to handle SMS text message 6093 - * links by registering to handle the "sms" scheme. 6094 - */ 6095 - protocol: "bitcoin" | "dat" | "dweb" | "ftp" | "geo" | "gopher" | "im" | "ipfs" | "ipns" | "irc" | "ircs" | "magnet" | "mailto" | "matrix" | "mms" | "news" | "nntp" | "sip" | "sms" | "smsto" | "ssb" | "ssh" | "tel" | "urn" | "webcal" | "wtai" | "xmpp" | string; 6096 - /** 6097 - * The URL of the handler, as a string. This string should include "%s" as a placeholder which will be replaced with the 6098 - * escaped URL of the document to be handled. This URL might be a true URL, or it could be a phone number, email address, 6099 - * or so forth. 6100 - */ 6101 - uriTemplate: ExtensionURL | HttpURL; 6102 - } 6103 - type ThemeColor = string | [ 6104 - number, 6105 - number, 6106 - number 6107 - ] | [ 6108 - number, 6109 - number, 6110 - number, 6111 - number 6112 - ]; 6113 - interface ThemeExperiment { 6114 - /** 6115 - * Optional. 6116 - */ 6117 - stylesheet?: ExtensionURL; 6118 - /** 6119 - * Optional. 6120 - */ 6121 - images?: ThemeExperimentImagesType; 6122 - /** 6123 - * Optional. 6124 - */ 6125 - colors?: ThemeExperimentColorsType; 6126 - /** 6127 - * Optional. 6128 - */ 6129 - properties?: ThemeExperimentPropertiesType; 6130 - } 6131 - interface ThemeType { 6132 - /** 6133 - * Optional. 6134 - */ 6135 - images?: ThemeTypeImagesType; 6136 - /** 6137 - * Optional. 6138 - */ 6139 - colors?: ThemeTypeColorsType; 6140 - /** 6141 - * Optional. 6142 - */ 6143 - properties?: ThemeTypePropertiesType; 6144 - } 6145 - /** 6146 - * Contents of manifest.json for a static theme 6147 - */ 6148 - interface ThemeManifest extends Browser.Manifest.ManifestBase { 6149 - theme: ThemeType; 6150 - /** 6151 - * Optional. 6152 - */ 6153 - dark_theme?: ThemeType; 6154 - /** 6155 - * Optional. 6156 - */ 6157 - default_locale?: string; 6158 - /** 6159 - * Optional. 6160 - */ 6161 - theme_experiment?: ThemeExperiment; 6162 - /** 6163 - * Optional. 6164 - */ 6165 - icons?: Record<string, string>; 6166 - } 6167 - interface ManifestBaseDeveloperType { 6168 - /** 6169 - * Optional. 6170 - */ 6171 - name?: string; 6172 - /** 6173 - * Optional. 6174 - */ 6175 - url?: string; 6176 - } 6177 - /** 6178 - * The 'split' value is not supported. 6179 - */ 6180 - type WebExtensionManifestIncognitoEnum = "not_allowed" | "spanning" | "split"; 6181 - /** 6182 - * Only supported for page/scripts; not for service_worker yet, see bug 1775574 6183 - */ 6184 - type WebExtensionManifestBackgroundTypeEnum = "module" | "classic"; 6185 - type WebExtensionManifestBackgroundPreferredEnvironmentItemEnum = "service_worker" | "document"; 6186 - interface WebExtensionManifestBackgroundType { 6187 - /** 6188 - * Optional. 6189 - */ 6190 - service_worker?: ExtensionURL; 6191 - /** 6192 - * Optional. 6193 - */ 6194 - page?: ExtensionURL; 6195 - /** 6196 - * Optional. 6197 - */ 6198 - scripts?: ExtensionURL[]; 6199 - /** 6200 - * Only supported for page/scripts; not for service_worker yet, see bug 1775574 6201 - * Optional. 6202 - */ 6203 - type?: WebExtensionManifestBackgroundTypeEnum; 6204 - /** 6205 - * Optional. 6206 - */ 6207 - persistent?: boolean; 6208 - /** 6209 - * Optional. 6210 - */ 6211 - preferred_environment?: WebExtensionManifestBackgroundPreferredEnvironmentItemEnum[]; 6212 - } 6213 - interface WebExtensionManifestOptionsUiType { 6214 - page: ExtensionURL; 6215 - /** 6216 - * Defaults to true in Manifest V2; Deprecated in Manifest V3. 6217 - * Optional. 6218 - */ 6219 - browser_style?: boolean; 6220 - /** 6221 - * chrome_style is ignored in Firefox. Its replacement (browser_style) has been deprecated. 6222 - * Optional. 6223 - */ 6224 - chrome_style?: boolean; 6225 - /** 6226 - * Optional. 6227 - */ 6228 - open_in_tab?: boolean; 6229 - } 6230 - interface WebExtensionManifestContentSecurityPolicyC2Type { 6231 - /** 6232 - * The Content Security Policy used for extension pages. 6233 - * Optional. 6234 - */ 6235 - extension_pages?: string; 6236 - /** 6237 - * In addition, Manifest V3 disallows certain CSP modifications for `extension_pages` that were permitted in Manifest V2. 6238 - * The `script-src`, `object-src`, and `worker-src` directives may only have the following values: 6239 - * - `self` 6240 - * - `none` - Any localhost source, (`http://localhost`, `http://127.0.0.1`, or any port on those domains) 6241 - * Optional. 6242 - */ 6243 - sandbox?: string; 6244 - } 6245 - interface WebExtensionManifestWebAccessibleResourcesC2ItemType { 6246 - resources: string[]; 6247 - /** 6248 - * Optional. 6249 - */ 6250 - matches?: MatchPattern[]; 6251 - /** 6252 - * Optional. 6253 - */ 6254 - extension_ids?: Array<ExtensionID | "*">; 6255 - } 6256 - interface WebExtensionManifestChromeSettingsOverridesSearchProviderType { 6257 - name: string; 6258 - /** 6259 - * Optional. 6260 - */ 6261 - keyword?: string | string[]; 6262 - search_url: string; 6263 - /** 6264 - * Optional. 6265 - */ 6266 - favicon_url?: string; 6267 - /** 6268 - * Optional. 6269 - */ 6270 - suggest_url?: string; 6271 - /** 6272 - * GET parameters to the search_url as a query string. 6273 - * Optional. 6274 - */ 6275 - search_url_get_params?: string; 6276 - /** 6277 - * POST parameters to the search_url as a query string. 6278 - * Optional. 6279 - */ 6280 - search_url_post_params?: string; 6281 - /** 6282 - * GET parameters to the suggest_url as a query string. 6283 - * Optional. 6284 - */ 6285 - suggest_url_get_params?: string; 6286 - /** 6287 - * POST parameters to the suggest_url as a query string. 6288 - * Optional. 6289 - */ 6290 - suggest_url_post_params?: string; 6291 - /** 6292 - * Encoding of the search term. 6293 - * Optional. 6294 - */ 6295 - encoding?: string; 6296 - /** 6297 - * Sets the default engine to a built-in engine only. 6298 - * Optional. 6299 - */ 6300 - is_default?: boolean; 6301 - } 6302 - interface WebExtensionManifestChromeSettingsOverridesType { 6303 - /** 6304 - * Optional. 6305 - */ 6306 - homepage?: string; 6307 - /** 6308 - * Optional. 6309 - */ 6310 - search_provider?: WebExtensionManifestChromeSettingsOverridesSearchProviderType; 6311 - } 6312 - interface WebExtensionManifestCommandsSuggestedKeyType { 6313 - /** 6314 - * Optional. 6315 - */ 6316 - default?: KeyName; 6317 - /** 6318 - * Optional. 6319 - */ 6320 - mac?: KeyName; 6321 - /** 6322 - * Optional. 6323 - */ 6324 - linux?: KeyName; 6325 - /** 6326 - * Optional. 6327 - */ 6328 - windows?: KeyName; 6329 - /** 6330 - * Optional. 6331 - */ 6332 - chromeos?: string; 6333 - /** 6334 - * Optional. 6335 - */ 6336 - android?: string; 6337 - /** 6338 - * Optional. 6339 - */ 6340 - ios?: string; 6341 - } 6342 - interface WebExtensionManifestCommandsType { 6343 - /** 6344 - * Optional. 6345 - */ 6346 - suggested_key?: WebExtensionManifestCommandsSuggestedKeyType; 6347 - /** 6348 - * Optional. 6349 - */ 6350 - description?: string; 6351 - } 6352 - interface WebExtensionManifestDeclarativeNetRequestRuleResourcesItemType { 6353 - /** 6354 - * A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use. 6355 - */ 6356 - id: string; 6357 - /** 6358 - * Whether the ruleset is enabled by default. 6359 - */ 6360 - enabled: boolean; 6361 - /** 6362 - * The path of the JSON ruleset relative to the extension directory. 6363 - */ 6364 - path: Browser.Manifest.ExtensionURL; 6365 - } 6366 - interface WebExtensionManifestDeclarativeNetRequestType { 6367 - rule_resources: WebExtensionManifestDeclarativeNetRequestRuleResourcesItemType[]; 6368 - } 6369 - interface WebExtensionManifestExperimentApisType { 6370 - [s: string]: Browser.Experiments.ExperimentAPI; 6371 - } 6372 - interface WebExtensionManifestOmniboxType { 6373 - keyword: string; 6374 - } 6375 - interface WebExtensionManifestPageActionType { 6376 - /** 6377 - * Optional. 6378 - */ 6379 - default_title?: string; 6380 - /** 6381 - * Optional. 6382 - */ 6383 - default_icon?: IconPath; 6384 - /** 6385 - * Optional. 6386 - */ 6387 - default_popup?: string; 6388 - /** 6389 - * Deprecated in Manifest V3. 6390 - * Optional. 6391 - */ 6392 - browser_style?: boolean; 6393 - /** 6394 - * Optional. 6395 - */ 6396 - show_matches?: MatchPattern[]; 6397 - /** 6398 - * Optional. 6399 - */ 6400 - hide_matches?: MatchPatternRestricted[]; 6401 - /** 6402 - * Optional. 6403 - */ 6404 - pinned?: boolean; 6405 - } 6406 - interface WebExtensionManifestSidebarActionType { 6407 - /** 6408 - * Optional. 6409 - */ 6410 - default_title?: string; 6411 - /** 6412 - * Optional. 6413 - */ 6414 - default_icon?: IconPath; 6415 - /** 6416 - * Defaults to true in Manifest V2; Deprecated in Manifest V3. 6417 - * Optional. 6418 - */ 6419 - browser_style?: boolean; 6420 - default_panel: string; 6421 - /** 6422 - * Whether or not the sidebar is opened at install. Default is <code>true</code>. 6423 - * Optional. 6424 - */ 6425 - open_at_install?: boolean; 6426 - } 6427 - interface WebExtensionManifestChromeUrlOverridesType { 6428 - /** 6429 - * Optional. 6430 - */ 6431 - newtab?: ExtensionURL; 6432 - } 6433 - interface WebExtensionManifestUserScriptsType { 6434 - /** 6435 - * Optional. 6436 - */ 6437 - api_script?: Browser.Manifest.ExtensionURL; 6438 - } 6439 - interface WebExtensionLangpackManifestLanguagesPatternType { 6440 - chrome_resources: Record<string, ExtensionURL | Record<string, ExtensionURL>>; 6441 - version: string; 6442 - } 6443 - interface WebExtensionLangpackManifestSourcesPatternType { 6444 - base_path: ExtensionURL; 6445 - /** 6446 - * Optional. 6447 - */ 6448 - paths?: string[]; 6449 - } 6450 - interface FirefoxSpecificPropertiesDataCollectionPermissionsType { 6451 - /** 6452 - * Optional. 6453 - */ 6454 - required?: DataCollectionPermission[]; 6455 - /** 6456 - * Optional. 6457 - */ 6458 - optional?: OptionalDataCollectionPermission[]; 6459 - } 6460 - /** 6461 - * Defines the location the browserAction will appear by default. The default location is navbar. 6462 - */ 6463 - type ActionManifestDefaultAreaEnum = "navbar" | "menupanel" | "tabstrip" | "personaltoolbar"; 6464 - interface ThemeExperimentImagesType { 6465 - [s: string]: unknown; 6466 - } 6467 - interface ThemeExperimentColorsType { 6468 - [s: string]: unknown; 6469 - } 6470 - interface ThemeExperimentPropertiesType { 6471 - [s: string]: unknown; 6472 - } 6473 - interface ThemeTypeImagesType { 6474 - /** 6475 - * Optional. 6476 - */ 6477 - additional_backgrounds?: ImageDataOrExtensionURL[]; 6478 - /** 6479 - * Optional. 6480 - */ 6481 - theme_frame?: ImageDataOrExtensionURL; 6482 - } 6483 - interface ThemeTypeColorsType { 6484 - /** 6485 - * Optional. 6486 - */ 6487 - tab_selected?: ThemeColor; 6488 - /** 6489 - * Optional. 6490 - */ 6491 - frame?: ThemeColor; 6492 - /** 6493 - * Optional. 6494 - */ 6495 - frame_inactive?: ThemeColor; 6496 - /** 6497 - * Optional. 6498 - */ 6499 - tab_background_text?: ThemeColor; 6500 - /** 6501 - * Optional. 6502 - */ 6503 - tab_background_separator?: ThemeColor; 6504 - /** 6505 - * Optional. 6506 - */ 6507 - tab_loading?: ThemeColor; 6508 - /** 6509 - * Optional. 6510 - */ 6511 - tab_text?: ThemeColor; 6512 - /** 6513 - * Optional. 6514 - */ 6515 - tab_line?: ThemeColor; 6516 - /** 6517 - * Optional. 6518 - */ 6519 - toolbar?: ThemeColor; 6520 - /** 6521 - * This color property is an alias of 'bookmark_text'. 6522 - * Optional. 6523 - */ 6524 - toolbar_text?: ThemeColor; 6525 - /** 6526 - * Optional. 6527 - */ 6528 - bookmark_text?: ThemeColor; 6529 - /** 6530 - * Optional. 6531 - */ 6532 - toolbar_field?: ThemeColor; 6533 - /** 6534 - * Optional. 6535 - */ 6536 - toolbar_field_text?: ThemeColor; 6537 - /** 6538 - * Optional. 6539 - */ 6540 - toolbar_field_border?: ThemeColor; 6541 - /** 6542 - * Optional. 6543 - */ 6544 - toolbar_top_separator?: ThemeColor; 6545 - /** 6546 - * Optional. 6547 - */ 6548 - toolbar_bottom_separator?: ThemeColor; 6549 - /** 6550 - * Optional. 6551 - */ 6552 - toolbar_vertical_separator?: ThemeColor; 6553 - /** 6554 - * Optional. 6555 - */ 6556 - icons?: ThemeColor; 6557 - /** 6558 - * Optional. 6559 - */ 6560 - icons_attention?: ThemeColor; 6561 - /** 6562 - * Optional. 6563 - */ 6564 - button_background_hover?: ThemeColor; 6565 - /** 6566 - * Optional. 6567 - */ 6568 - button_background_active?: ThemeColor; 6569 - /** 6570 - * Optional. 6571 - */ 6572 - popup?: ThemeColor; 6573 - /** 6574 - * Optional. 6575 - */ 6576 - popup_text?: ThemeColor; 6577 - /** 6578 - * Optional. 6579 - */ 6580 - popup_border?: ThemeColor; 6581 - /** 6582 - * Optional. 6583 - */ 6584 - toolbar_field_focus?: ThemeColor; 6585 - /** 6586 - * Optional. 6587 - */ 6588 - toolbar_field_text_focus?: ThemeColor; 6589 - /** 6590 - * Optional. 6591 - */ 6592 - toolbar_field_border_focus?: ThemeColor; 6593 - /** 6594 - * Optional. 6595 - */ 6596 - popup_highlight?: ThemeColor; 6597 - /** 6598 - * Optional. 6599 - */ 6600 - popup_highlight_text?: ThemeColor; 6601 - /** 6602 - * Optional. 6603 - */ 6604 - ntp_background?: ThemeColor; 6605 - /** 6606 - * Optional. 6607 - */ 6608 - ntp_card_background?: ThemeColor; 6609 - /** 6610 - * Optional. 6611 - */ 6612 - ntp_text?: ThemeColor; 6613 - /** 6614 - * Optional. 6615 - */ 6616 - sidebar?: ThemeColor; 6617 - /** 6618 - * Optional. 6619 - */ 6620 - sidebar_border?: ThemeColor; 6621 - /** 6622 - * Optional. 6623 - */ 6624 - sidebar_text?: ThemeColor; 6625 - /** 6626 - * Optional. 6627 - */ 6628 - sidebar_highlight?: ThemeColor; 6629 - /** 6630 - * Optional. 6631 - */ 6632 - sidebar_highlight_text?: ThemeColor; 6633 - /** 6634 - * Optional. 6635 - */ 6636 - toolbar_field_highlight?: ThemeColor; 6637 - /** 6638 - * Optional. 6639 - */ 6640 - toolbar_field_highlight_text?: ThemeColor; 6641 - } 6642 - type ThemeTypePropertiesAdditionalBackgroundsAlignmentItemEnum = "bottom" | "center" | "left" | "right" | "top" | "center bottom" | "center center" | "center top" | "left bottom" | "left center" | "left top" | "right bottom" | "right center" | "right top"; 6643 - type ThemeTypePropertiesAdditionalBackgroundsTilingItemEnum = "no-repeat" | "repeat" | "repeat-x" | "repeat-y"; 6644 - type ThemeTypePropertiesColorSchemeEnum = "auto" | "light" | "dark" | "system"; 6645 - type ThemeTypePropertiesContentColorSchemeEnum = "auto" | "light" | "dark" | "system"; 6646 - interface ThemeTypePropertiesType { 6647 - /** 6648 - * Optional. 6649 - */ 6650 - additional_backgrounds_alignment?: ThemeTypePropertiesAdditionalBackgroundsAlignmentItemEnum[]; 6651 - /** 6652 - * Optional. 6653 - */ 6654 - additional_backgrounds_tiling?: ThemeTypePropertiesAdditionalBackgroundsTilingItemEnum[]; 6655 - /** 6656 - * Optional. 6657 - */ 6658 - color_scheme?: ThemeTypePropertiesColorSchemeEnum; 6659 - /** 6660 - * Optional. 6661 - */ 6662 - content_color_scheme?: ThemeTypePropertiesContentColorSchemeEnum; 6663 - } 6664 - interface Static { 6665 - [s: string]: unknown; 6666 - } 6667 - } 6668 - /** 6669 - * Namespace: browser.contextMenus 6670 - */ 6671 - namespace ContextMenus { 6672 - interface Static extends Menus.Static { 6673 - [s: string]: unknown; 6674 - } 6675 - } 6676 - /** 6677 - * Namespace: browser.menus 6678 - */ 6679 - namespace Menus { 6680 - /** 6681 - * The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts 6682 - * except for 'tab' and 'tools_menu'. 6683 - */ 6684 - type ContextType = "all" | "page" | "frame" | "selection" | "link" | "editable" | "password" | "image" | "video" | "audio" | "launcher" | "bookmark" | "page_action" | "tab" | "tools_menu" | "browser_action" | "action"; 6685 - /** 6686 - * The type of menu item. 6687 - */ 6688 - type ItemType = "normal" | "checkbox" | "radio" | "separator"; 6689 - /** 6690 - * Information sent when a context menu item is clicked. 6691 - */ 6692 - interface OnClickData { 6693 - /** 6694 - * The ID of the menu item that was clicked. 6695 - */ 6696 - menuItemId: number | string; 6697 - /** 6698 - * The parent ID, if any, for the item clicked. 6699 - * Optional. 6700 - */ 6701 - parentMenuItemId?: number | string; 6702 - /** 6703 - * The type of view where the menu is clicked. May be unset if the menu is not associated with a view. 6704 - * Optional. 6705 - */ 6706 - viewType?: Browser.Extension.ViewType; 6707 - /** 6708 - * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements. 6709 - * Optional. 6710 - */ 6711 - mediaType?: string; 6712 - /** 6713 - * If the element is a link, the text of that link. 6714 - * Optional. 6715 - */ 6716 - linkText?: string; 6717 - /** 6718 - * If the element is a link, the URL it points to. 6719 - * Optional. 6720 - */ 6721 - linkUrl?: string; 6722 - /** 6723 - * Will be present for elements with a 'src' URL. 6724 - * Optional. 6725 - */ 6726 - srcUrl?: string; 6727 - /** 6728 - * The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where 6729 - * there is no current page, such as in a launcher context menu. 6730 - * Optional. 6731 - */ 6732 - pageUrl?: string; 6733 - /** 6734 - * The id of the frame of the element where the context menu was clicked. 6735 - * Optional. 6736 - */ 6737 - frameId?: number; 6738 - /** 6739 - * The URL of the frame of the element where the context menu was clicked, if it was in a frame. 6740 - * Optional. 6741 - */ 6742 - frameUrl?: string; 6743 - /** 6744 - * The text for the context selection, if any. 6745 - * Optional. 6746 - */ 6747 - selectionText?: string; 6748 - /** 6749 - * A flag indicating whether the element is editable (text input, textarea, etc.). 6750 - */ 6751 - editable: boolean; 6752 - /** 6753 - * A flag indicating the state of a checkbox or radio item before it was clicked. 6754 - * Optional. 6755 - */ 6756 - wasChecked?: boolean; 6757 - /** 6758 - * A flag indicating the state of a checkbox or radio item after it is clicked. 6759 - * Optional. 6760 - */ 6761 - checked?: boolean; 6762 - /** 6763 - * The id of the bookmark where the context menu was clicked, if it was on a bookmark. 6764 - * Optional. 6765 - */ 6766 - bookmarkId?: string; 6767 - /** 6768 - * An array of keyboard modifiers that were held while the menu item was clicked. 6769 - */ 6770 - modifiers: OnClickDataModifiersItemEnum[]; 6771 - /** 6772 - * An integer value of button by which menu item was clicked. 6773 - * Optional. 6774 - */ 6775 - button?: number; 6776 - /** 6777 - * An identifier of the clicked element, if any. Use menus.getTargetElement in the page to find the corresponding element. 6778 - * Optional. 6779 - */ 6780 - targetElementId?: number; 6781 - } 6782 - interface CreateCreatePropertiesType { 6783 - /** 6784 - * The type of menu item. Defaults to 'normal' if not specified. 6785 - * Optional. 6786 - */ 6787 - type?: ItemType; 6788 - /** 6789 - * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension. 6790 - * Optional. 6791 - */ 6792 - id?: string; 6793 - /** 6794 - * Optional. 6795 - */ 6796 - icons?: Record<string, string>; 6797 - /** 6798 - * The text to be displayed in the item; this is <em>required</em> unless <code>type</code> is 'separator'. 6799 - * When the context is 'selection', you can use <code>%s</code> within the string to show the selected text. For example, 6800 - * if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", 6801 - * the context menu item for the selection is "Translate 'cool' to Pig Latin". 6802 - * Optional. 6803 - */ 6804 - title?: string; 6805 - /** 6806 - * The initial state of a checkbox or radio item: true for selected and false for unselected. 6807 - * Only one radio item can be selected at a time in a given group of radio items. 6808 - * Optional. 6809 - */ 6810 - checked?: boolean; 6811 - /** 6812 - * List of contexts this menu item will appear in. Defaults to ['page'] if not specified. 6813 - * Optional. 6814 - */ 6815 - contexts?: ContextType[]; 6816 - /** 6817 - * List of view types where the menu item will be shown. Defaults to any view, including those without a viewType. 6818 - * Optional. 6819 - */ 6820 - viewTypes?: Browser.Extension.ViewType[]; 6821 - /** 6822 - * Whether the item is visible in the menu. 6823 - * Optional. 6824 - */ 6825 - visible?: boolean; 6826 - /** 6827 - * A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, 6828 - * they should register a listener for $(ref:contextMenus.onClicked). 6829 - * 6830 - * @param info Information about the item clicked and the context where the click happened. 6831 - * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions. 6832 - */ 6833 - onclick?(info: OnClickData, tab: Browser.Tabs.Tab): void; 6834 - /** 6835 - * The ID of a parent menu item; this makes the item a child of a previously added item. 6836 - * Optional. 6837 - */ 6838 - parentId?: number | string; 6839 - /** 6840 - * Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. 6841 - * (This applies to frames as well.) For details on the format of a pattern, see $(topic:match_patterns)[Match Patterns]. 6842 - * Optional. 6843 - */ 6844 - documentUrlPatterns?: string[]; 6845 - /** 6846 - * Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of 6847 - * anchor tags. 6848 - * Optional. 6849 - */ 6850 - targetUrlPatterns?: string[]; 6851 - /** 6852 - * Whether this context menu item is enabled or disabled. Defaults to true. 6853 - * Optional. 6854 - */ 6855 - enabled?: boolean; 6856 - /** 6857 - * Specifies a command to issue for the context click. 6858 - * Optional. 6859 - */ 6860 - command?: string | "_execute_browser_action" | "_execute_page_action" | "_execute_sidebar_action" | "_execute_action" | "_execute_page_action" | "_execute_sidebar_action"; 6861 - } 6862 - /** 6863 - * The properties to update. Accepts the same values as the create function. 6864 - */ 6865 - interface UpdateUpdatePropertiesType { 6866 - /** 6867 - * Optional. 6868 - */ 6869 - type?: ItemType; 6870 - /** 6871 - * Optional. 6872 - */ 6873 - icons?: Record<string, string>; 6874 - /** 6875 - * Optional. 6876 - */ 6877 - title?: string; 6878 - /** 6879 - * Optional. 6880 - */ 6881 - checked?: boolean; 6882 - /** 6883 - * Optional. 6884 - */ 6885 - contexts?: ContextType[]; 6886 - /** 6887 - * Optional. 6888 - */ 6889 - viewTypes?: Browser.Extension.ViewType[]; 6890 - /** 6891 - * Whether the item is visible in the menu. 6892 - * Optional. 6893 - */ 6894 - visible?: boolean; 6895 - /** 6896 - * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions. 6897 - */ 6898 - onclick?(info: OnClickData, tab: Browser.Tabs.Tab): void; 6899 - /** 6900 - * Note: You cannot change an item to be a child of one of its own descendants. 6901 - * Optional. 6902 - */ 6903 - parentId?: number | string; 6904 - /** 6905 - * Optional. 6906 - */ 6907 - documentUrlPatterns?: string[]; 6908 - /** 6909 - * Optional. 6910 - */ 6911 - targetUrlPatterns?: string[]; 6912 - /** 6913 - * Optional. 6914 - */ 6915 - enabled?: boolean; 6916 - } 6917 - interface OverrideContextContextOptionsType { 6918 - /** 6919 - * Whether to also include default menu items in the menu. 6920 - * Optional. 6921 - */ 6922 - showDefaults?: boolean; 6923 - /** 6924 - * ContextType to override, to allow menu items from other extensions in the menu. Currently only 'bookmark' and 'tab' are 6925 - * supported. showDefaults cannot be used with this option. 6926 - * Optional. 6927 - */ 6928 - context?: OverrideContextContextOptionsTypeContextEnum; 6929 - /** 6930 - * Required when context is 'bookmark'. Requires 'bookmark' permission. 6931 - * Optional. 6932 - */ 6933 - bookmarkId?: string; 6934 - /** 6935 - * Required when context is 'tab'. Requires 'tabs' permission. 6936 - * Optional. 6937 - */ 6938 - tabId?: number; 6939 - } 6940 - /** 6941 - * Information about the context of the menu action and the created menu items. For more information about each property, 6942 - * see OnClickData. The following properties are only set if the extension has host permissions for the given context: 6943 - * linkUrl, linkText, srcUrl, pageUrl, frameUrl, selectionText. 6944 - */ 6945 - interface OnShownInfoType { 6946 - /** 6947 - * A list of IDs of the menu items that were shown. 6948 - */ 6949 - menuIds: Array<number | string>; 6950 - /** 6951 - * A list of all contexts that apply to the menu. 6952 - */ 6953 - contexts: ContextType[]; 6954 - /** 6955 - * Optional. 6956 - */ 6957 - viewType?: Browser.Extension.ViewType; 6958 - editable: boolean; 6959 - /** 6960 - * Optional. 6961 - */ 6962 - mediaType?: string; 6963 - /** 6964 - * Optional. 6965 - */ 6966 - linkUrl?: string; 6967 - /** 6968 - * Optional. 6969 - */ 6970 - linkText?: string; 6971 - /** 6972 - * Optional. 6973 - */ 6974 - srcUrl?: string; 6975 - /** 6976 - * Optional. 6977 - */ 6978 - pageUrl?: string; 6979 - /** 6980 - * Optional. 6981 - */ 6982 - frameUrl?: string; 6983 - /** 6984 - * Optional. 6985 - */ 6986 - selectionText?: string; 6987 - /** 6988 - * Optional. 6989 - */ 6990 - targetElementId?: number; 6991 - } 6992 - type OnClickDataModifiersItemEnum = "Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl"; 6993 - /** 6994 - * ContextType to override, to allow menu items from other extensions in the menu. Currently only 'bookmark' and 'tab' are 6995 - * supported. showDefaults cannot be used with this option. 6996 - */ 6997 - type OverrideContextContextOptionsTypeContextEnum = "bookmark" | "tab"; 6998 - interface Static { 6999 - /** 7000 - * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation 7001 - * callback fires (the details will be in $(ref:runtime.lastError)). 7002 - * 7003 - * @param callback Optional. Called when the item has been created in the browser. If there were any problems creating the 7004 - * item, details will be available in $(ref:runtime.lastError). 7005 - * @returns The ID of the newly created item. 7006 - */ 7007 - create(createProperties: CreateCreatePropertiesType, callback?: () => void): number | string; 7008 - /** 7009 - * Updates a previously created context menu item. 7010 - * 7011 - * @param id The ID of the item to update. 7012 - * @param updateProperties The properties to update. Accepts the same values as the create function. 7013 - * @returns Called when the context menu has been updated. 7014 - */ 7015 - update(id: number | string, updateProperties: UpdateUpdatePropertiesType): Promise<void>; 7016 - /** 7017 - * Removes a context menu item. 7018 - * 7019 - * @param menuItemId The ID of the context menu item to remove. 7020 - * @returns Called when the context menu has been removed. 7021 - */ 7022 - remove(menuItemId: number | string): Promise<void>; 7023 - /** 7024 - * Removes all context menu items added by this extension. 7025 - * 7026 - * @returns Called when removal is complete. 7027 - */ 7028 - removeAll(): Promise<void>; 7029 - /** 7030 - * Show the matching menu items from this extension instead of the default menu. This should be called during a 7031 - * 'contextmenu' DOM event handler, and only applies to the menu that opens after this event. 7032 - */ 7033 - overrideContext(contextOptions: OverrideContextContextOptionsType): void; 7034 - /** 7035 - * Updates the extension items in the shown menu, including changes that have been made since the menu was shown. 7036 - * Has no effect if the menu is hidden. Rebuilding a shown menu is an expensive operation, 7037 - * only invoke this method when necessary. 7038 - */ 7039 - refresh(): Promise<void>; 7040 - /** 7041 - * Retrieve the element that was associated with a recent contextmenu event. 7042 - * 7043 - * @param targetElementId The identifier of the clicked element, available as info.targetElementId in the menus.onShown, 7044 - * onClicked or onclick event. 7045 - */ 7046 - getTargetElement(targetElementId: number): Element; 7047 - /** 7048 - * Fired when a context menu item is clicked. 7049 - * 7050 - * @param info Information about the item clicked and the context where the click happened. 7051 - * @param tab Optional. The details of the tab where the click took place. If the click did not take place in a tab, 7052 - * this parameter will be missing. 7053 - */ 7054 - onClicked: Events.Event<(info: OnClickData, tab: Browser.Tabs.Tab | undefined) => void>; 7055 - /** 7056 - * Fired when a menu is shown. The extension can add, modify or remove menu items and call menus.refresh() 7057 - * to update the menu. 7058 - * 7059 - * @param info Information about the context of the menu action and the created menu items. 7060 - * For more information about each property, see OnClickData. The following properties are only set if the extension has 7061 - * host permissions for the given context: linkUrl, linkText, srcUrl, pageUrl, frameUrl, selectionText. 7062 - * @param tab The details of the tab where the menu was opened. 7063 - */ 7064 - onShown: Events.Event<(info: OnShownInfoType, tab: Browser.Tabs.Tab) => void>; 7065 - /** 7066 - * Fired when a menu is hidden. This event is only fired if onShown has fired before. 7067 - */ 7068 - onHidden: Events.Event<() => void>; 7069 - /** 7070 - * The maximum number of top level extension items that can be added to an extension action context menu. 7071 - * Any items beyond this limit will be ignored. 7072 - */ 7073 - ACTION_MENU_TOP_LEVEL_LIMIT: 6; 7074 - } 7075 - } 7076 - /** 7077 - * Namespace: browser.networkStatus 7078 - */ 7079 - namespace NetworkStatus { 7080 - interface NetworkLinkInfo { 7081 - /** 7082 - * Status of the network link, if "unknown" then link is usually assumed to be "up" 7083 - */ 7084 - status: NetworkLinkInfoStatusEnum; 7085 - /** 7086 - * If known, the type of network connection that is avialable. 7087 - */ 7088 - type: NetworkLinkInfoTypeEnum; 7089 - /** 7090 - * If known, the network id or name. 7091 - * Optional. 7092 - */ 7093 - id?: string; 7094 - } 7095 - /** 7096 - * Status of the network link, if "unknown" then link is usually assumed to be "up" 7097 - */ 7098 - type NetworkLinkInfoStatusEnum = "unknown" | "up" | "down"; 7099 - /** 7100 - * If known, the type of network connection that is avialable. 7101 - */ 7102 - type NetworkLinkInfoTypeEnum = "unknown" | "ethernet" | "usb" | "wifi" | "wimax" | "mobile"; 7103 - interface Static { 7104 - /** 7105 - * Returns the $(ref:NetworkLinkInfo) of the current network connection. 7106 - */ 7107 - getLinkInfo(): void; 7108 - /** 7109 - * Fired when the network connection state changes. 7110 - */ 7111 - onConnectionChanged: Events.Event<(details: NetworkLinkInfo) => void>; 7112 - } 7113 - } 7114 - /** 7115 - * Namespace: browser.normandyAddonStudy 7116 - */ 7117 - namespace NormandyAddonStudy { 7118 - interface Study { 7119 - /** 7120 - * The ID of the recipe for the study. 7121 - */ 7122 - recipeId: number; 7123 - /** 7124 - * A slug to identify the study. 7125 - */ 7126 - slug: string; 7127 - /** 7128 - * The name presented on about:studies. 7129 - */ 7130 - userFacingName: string; 7131 - /** 7132 - * The description presented on about:studies. 7133 - */ 7134 - userFacingDescription: string; 7135 - /** 7136 - * The study branch in which the user is enrolled. 7137 - */ 7138 - branch: string; 7139 - /** 7140 - * The state of the study. 7141 - */ 7142 - active: boolean; 7143 - /** 7144 - * The ID of the extension installed by the study. 7145 - */ 7146 - addonId: string; 7147 - /** 7148 - * The URL of the XPI that was downloaded and installed by the study. 7149 - */ 7150 - addonUrl: string; 7151 - /** 7152 - * The version of the extension installed by the study. 7153 - */ 7154 - addonVersion: string; 7155 - /** 7156 - * The start date for the study. 7157 - */ 7158 - studyStartDate: ExtensionTypes.DateType; 7159 - /** 7160 - * The end date for the study. 7161 - */ 7162 - studyEndDate: ExtensionTypes.DateType; 7163 - /** 7164 - * The record ID for the extension in Normandy server's database. 7165 - */ 7166 - extensionApiId: number; 7167 - /** 7168 - * A hash of the extension XPI file. 7169 - */ 7170 - extensionHash: string; 7171 - /** 7172 - * The algorithm used to hash the extension XPI file. 7173 - */ 7174 - extensionHashAlgorithm: string; 7175 - } 7176 - interface Static { 7177 - /** 7178 - * Returns a study object for the current study. 7179 - */ 7180 - getStudy(): void; 7181 - /** 7182 - * Marks the study as ended and then uninstalls the addon. 7183 - * 7184 - * @param reason The reason why the study is ending. 7185 - */ 7186 - endStudy(reason: string): void; 7187 - /** 7188 - * Returns an object with metadata about the client which may be required for constructing survey URLs. 7189 - */ 7190 - getClientMetadata(): void; 7191 - /** 7192 - * Fired when a user unenrolls from a study but before the addon is uninstalled. 7193 - * 7194 - * @param reason The reason why the study is ending. 7195 - */ 7196 - onUnenroll: Events.Event<(reason: string) => void>; 7197 - } 7198 - } 7199 - /** 7200 - * Namespace: browser.notifications 7201 - */ 7202 - namespace Notifications { 7203 - type TemplateType = "basic" | "image" | "list" | "progress"; 7204 - type PermissionLevel = "granted" | "denied"; 7205 - interface NotificationItem { 7206 - /** 7207 - * Title of one item of a list notification. 7208 - */ 7209 - title: string; 7210 - /** 7211 - * Additional details about this item. 7212 - */ 7213 - message: string; 7214 - } 7215 - interface CreateNotificationOptions { 7216 - /** 7217 - * Which type of notification to display. 7218 - */ 7219 - type: TemplateType; 7220 - /** 7221 - * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. 7222 - * Optional. 7223 - */ 7224 - iconUrl?: string; 7225 - /** 7226 - * A URL to the app icon mask. 7227 - * Optional. 7228 - */ 7229 - appIconMaskUrl?: string; 7230 - /** 7231 - * Title of the notification (e.g. sender name for email). 7232 - */ 7233 - title: string; 7234 - /** 7235 - * Main notification content. 7236 - */ 7237 - message: string; 7238 - /** 7239 - * Alternate notification content with a lower-weight font. 7240 - * Optional. 7241 - */ 7242 - contextMessage?: string; 7243 - /** 7244 - * Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. 7245 - * Optional. 7246 - */ 7247 - priority?: number; 7248 - /** 7249 - * A timestamp associated with the notification, in milliseconds past the epoch. 7250 - * Optional. 7251 - */ 7252 - eventTime?: number; 7253 - /** 7254 - * A URL to the image thumbnail for image-type notifications. 7255 - * Optional. 7256 - */ 7257 - imageUrl?: string; 7258 - /** 7259 - * Items for multi-item notifications. 7260 - * Optional. 7261 - */ 7262 - items?: NotificationItem[]; 7263 - /** 7264 - * Current progress ranges from 0 to 100. 7265 - * Optional. 7266 - */ 7267 - progress?: number; 7268 - /** 7269 - * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification. 7270 - * Optional. 7271 - */ 7272 - isClickable?: boolean; 7273 - } 7274 - interface UpdateNotificationOptions { 7275 - /** 7276 - * Which type of notification to display. 7277 - * Optional. 7278 - */ 7279 - type?: TemplateType; 7280 - /** 7281 - * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. 7282 - * Optional. 7283 - */ 7284 - iconUrl?: string; 7285 - /** 7286 - * A URL to the app icon mask. 7287 - * Optional. 7288 - */ 7289 - appIconMaskUrl?: string; 7290 - /** 7291 - * Title of the notification (e.g. sender name for email). 7292 - * Optional. 7293 - */ 7294 - title?: string; 7295 - /** 7296 - * Main notification content. 7297 - * Optional. 7298 - */ 7299 - message?: string; 7300 - /** 7301 - * Alternate notification content with a lower-weight font. 7302 - * Optional. 7303 - */ 7304 - contextMessage?: string; 7305 - /** 7306 - * Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. 7307 - * Optional. 7308 - */ 7309 - priority?: number; 7310 - /** 7311 - * A timestamp associated with the notification, in milliseconds past the epoch. 7312 - * Optional. 7313 - */ 7314 - eventTime?: number; 7315 - /** 7316 - * A URL to the image thumbnail for image-type notifications. 7317 - * Optional. 7318 - */ 7319 - imageUrl?: string; 7320 - /** 7321 - * Items for multi-item notifications. 7322 - * Optional. 7323 - */ 7324 - items?: NotificationItem[]; 7325 - /** 7326 - * Current progress ranges from 0 to 100. 7327 - * Optional. 7328 - */ 7329 - progress?: number; 7330 - /** 7331 - * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification. 7332 - * Optional. 7333 - */ 7334 - isClickable?: boolean; 7335 - } 7336 - interface Static { 7337 - /** 7338 - * Creates and displays a notification. 7339 - * 7340 - * @param notificationId Optional. Identifier of the notification. If it is empty, this method generates an id. 7341 - * If it matches an existing notification, this method first clears that notification before proceeding with the create 7342 - * operation. 7343 - * @param options Contents of the notification. 7344 - */ 7345 - create(notificationId: string | undefined, options: CreateNotificationOptions): Promise<string>; 7346 - /** 7347 - * Creates and displays a notification. 7348 - * 7349 - * @param options Contents of the notification. 7350 - */ 7351 - create(options: CreateNotificationOptions): Promise<string>; 7352 - /** 7353 - * Clears an existing notification. 7354 - * 7355 - * @param notificationId The id of the notification to be updated. 7356 - */ 7357 - clear(notificationId: string): Promise<boolean>; 7358 - /** 7359 - * Retrieves all the notifications. 7360 - */ 7361 - getAll(): Promise<Record<string, CreateNotificationOptions>>; 7362 - /** 7363 - * Fired when the notification closed, either by the system or by user action. 7364 - * 7365 - * @param notificationId The notificationId of the closed notification. 7366 - * @param byUser True if the notification was closed by the user. 7367 - */ 7368 - onClosed: Events.Event<(notificationId: string, byUser: boolean) => void>; 7369 - /** 7370 - * Fired when the user clicked in a non-button area of the notification. 7371 - * 7372 - * @param notificationId The notificationId of the clicked notification. 7373 - */ 7374 - onClicked: Events.Event<(notificationId: string) => void>; 7375 - /** 7376 - * Fired when the user pressed a button in the notification. 7377 - * 7378 - * @param notificationId The notificationId of the clicked notification. 7379 - * @param buttonIndex The index of the button clicked by the user. 7380 - */ 7381 - onButtonClicked: Events.Event<(notificationId: string, buttonIndex: number) => void>; 7382 - /** 7383 - * Fired when the notification is shown. 7384 - * 7385 - * @param notificationId The notificationId of the shown notification. 7386 - */ 7387 - onShown: Events.Event<(notificationId: string) => void>; 7388 - } 7389 - } 7390 - /** 7391 - * Namespace: browser.omnibox 7392 - */ 7393 - namespace Omnibox { 7394 - /** 7395 - * The style type. 7396 - */ 7397 - type DescriptionStyleType = "url" | "match" | "dim"; 7398 - /** 7399 - * The window disposition for the omnibox query. This is the recommended context to display results. For example, 7400 - * if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should 7401 - * take place in a new selected tab. 7402 - */ 7403 - type OnInputEnteredDisposition = "currentTab" | "newForegroundTab" | "newBackgroundTab"; 7404 - /** 7405 - * A suggest result. 7406 - */ 7407 - interface SuggestResult { 7408 - /** 7409 - * The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry. 7410 - */ 7411 - content: string; 7412 - /** 7413 - * The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. 7414 - * The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), 7415 - * and 'dim' (for dim helper text). The styles can be nested, eg. <dim><match>dimmed match</match></dim>. 7416 - * You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 7417 - */ 7418 - description: string; 7419 - /** 7420 - * Whether the suggest result can be deleted by the user. 7421 - * Optional. 7422 - */ 7423 - deletable?: boolean; 7424 - } 7425 - /** 7426 - * A suggest result. 7427 - */ 7428 - interface DefaultSuggestResult { 7429 - /** 7430 - * The text that is displayed in the URL dropdown. 7431 - */ 7432 - description: string; 7433 - } 7434 - interface Static { 7435 - /** 7436 - * Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the 7437 - * first suggestion row underneath the URL bar. 7438 - * 7439 - * @param suggestion A partial SuggestResult object, without the 'content' parameter. 7440 - */ 7441 - setDefaultSuggestion(suggestion: DefaultSuggestResult): void; 7442 - /** 7443 - * User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once 7444 - * per input session, and before any onInputChanged events. 7445 - */ 7446 - onInputStarted: Events.Event<() => void>; 7447 - /** 7448 - * User has changed what is typed into the omnibox. 7449 - * 7450 - * @param suggest A callback passed to the onInputChanged event used for sending suggestions back to the browser. 7451 - */ 7452 - onInputChanged: Events.Event<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>; 7453 - /** 7454 - * User has accepted what is typed into the omnibox. 7455 - */ 7456 - onInputEntered: Events.Event<(text: string, disposition: OnInputEnteredDisposition) => void>; 7457 - /** 7458 - * User has ended the keyword input session without accepting the input. 7459 - */ 7460 - onInputCancelled: Events.Event<() => void>; 7461 - /** 7462 - * User has deleted a suggested result. 7463 - */ 7464 - onDeleteSuggestion: Events.Event<(text: string) => void>; 7465 - } 7466 - } 7467 - /** 7468 - * Namespace: browser.pageAction 7469 - */ 7470 - namespace PageAction { 7471 - /** 7472 - * Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element). 7473 - */ 7474 - interface ImageDataType extends ImageData { 7475 - [s: string]: unknown; 7476 - } 7477 - /** 7478 - * Information sent when a page action is clicked. 7479 - */ 7480 - interface OnClickData { 7481 - /** 7482 - * An array of keyboard modifiers that were held while the menu item was clicked. 7483 - */ 7484 - modifiers: OnClickDataModifiersItemEnum[]; 7485 - /** 7486 - * An integer value of button by which menu item was clicked. 7487 - * Optional. 7488 - */ 7489 - button?: number; 7490 - } 7491 - interface IsShownDetailsType { 7492 - /** 7493 - * Specify the tab to get the shownness from. 7494 - */ 7495 - tabId: number; 7496 - } 7497 - interface SetTitleDetailsType { 7498 - /** 7499 - * The id of the tab for which you want to modify the page action. 7500 - */ 7501 - tabId: number; 7502 - /** 7503 - * The tooltip string. 7504 - */ 7505 - title: string | null; 7506 - } 7507 - interface GetTitleDetailsType { 7508 - /** 7509 - * Specify the tab to get the title from. 7510 - */ 7511 - tabId: number; 7512 - } 7513 - interface SetIconDetailsType { 7514 - /** 7515 - * The id of the tab for which you want to modify the page action. 7516 - */ 7517 - tabId: number; 7518 - /** 7519 - * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. 7520 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 7521 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 7522 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 7523 - * At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details. 7524 - * imageData = {'19': foo}' 7525 - * Optional. 7526 - */ 7527 - imageData?: ImageDataType | Record<string, ImageDataType>; 7528 - /** 7529 - * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. 7530 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 7531 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 7532 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 7533 - * At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' 7534 - * Optional. 7535 - */ 7536 - path?: string | Record<string, string>; 7537 - } 7538 - interface SetPopupDetailsType { 7539 - /** 7540 - * The id of the tab for which you want to modify the page action. 7541 - */ 7542 - tabId: number; 7543 - /** 7544 - * The html file to show in a popup. If set to the empty string (''), no popup is shown. 7545 - */ 7546 - popup: string | null; 7547 - } 7548 - interface GetPopupDetailsType { 7549 - /** 7550 - * Specify the tab to get the popup from. 7551 - */ 7552 - tabId: number; 7553 - } 7554 - type OnClickDataModifiersItemEnum = "Shift" | "Alt" | "Command" | "Ctrl" | "MacCtrl"; 7555 - interface Static { 7556 - /** 7557 - * Shows the page action. The page action is shown whenever the tab is selected. 7558 - * 7559 - * @param tabId The id of the tab for which you want to modify the page action. 7560 - */ 7561 - show(tabId: number): Promise<void>; 7562 - /** 7563 - * Hides the page action. 7564 - * 7565 - * @param tabId The id of the tab for which you want to modify the page action. 7566 - */ 7567 - hide(tabId: number): Promise<void>; 7568 - /** 7569 - * Checks whether the page action is shown. 7570 - */ 7571 - isShown(details: IsShownDetailsType): Promise<boolean>; 7572 - /** 7573 - * Sets the title of the page action. This is displayed in a tooltip over the page action. 7574 - */ 7575 - setTitle(details: SetTitleDetailsType): void; 7576 - /** 7577 - * Gets the title of the page action. 7578 - */ 7579 - getTitle(details: GetTitleDetailsType): Promise<string>; 7580 - /** 7581 - * Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data 7582 - * from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> 7583 - * property must be specified. 7584 - */ 7585 - setIcon(details: SetIconDetailsType): Promise<void>; 7586 - /** 7587 - * Sets the html document to be opened as a popup when the user clicks on the page action's icon. 7588 - */ 7589 - setPopup(details: SetPopupDetailsType): Promise<void>; 7590 - /** 7591 - * Gets the html document set as the popup for this page action. 7592 - */ 7593 - getPopup(details: GetPopupDetailsType): Promise<string>; 7594 - /** 7595 - * Opens the extension page action in the active window. 7596 - */ 7597 - openPopup(): Promise<void>; 7598 - /** 7599 - * Fired when a page action icon is clicked. This event will not fire if the page action has a popup. 7600 - * 7601 - * @param info Optional. 7602 - */ 7603 - onClicked: Events.Event<(tab: Browser.Tabs.Tab, info: OnClickData | undefined) => void>; 7604 - } 7605 - } 7606 - /** 7607 - * Namespace: browser.permissions 7608 - */ 7609 - namespace Permissions { 7610 - interface Permissions { 7611 - /** 7612 - * Optional. 7613 - */ 7614 - permissions?: Array<Browser.Manifest.OptionalPermission | Browser.Manifest.OptionalOnlyPermission>; 7615 - /** 7616 - * Optional. 7617 - */ 7618 - origins?: Browser.Manifest.MatchPattern[]; 7619 - /** 7620 - * Optional. 7621 - */ 7622 - data_collection?: Browser.Manifest.OptionalDataCollectionPermission[]; 7623 - } 7624 - interface AnyPermissions { 7625 - /** 7626 - * Optional. 7627 - */ 7628 - permissions?: Array<Browser.Manifest.Permission | Browser.Manifest.OptionalOnlyPermission>; 7629 - /** 7630 - * Optional. 7631 - */ 7632 - origins?: Browser.Manifest.MatchPattern[]; 7633 - /** 7634 - * Optional. 7635 - */ 7636 - data_collection?: Browser.Manifest.OptionalDataCollectionPermission[]; 7637 - } 7638 - interface Static { 7639 - /** 7640 - * Get a list of all the extension's permissions. 7641 - */ 7642 - getAll(): Promise<AnyPermissions>; 7643 - /** 7644 - * Check if the extension has the given permissions. 7645 - */ 7646 - contains(permissions: AnyPermissions): Promise<boolean>; 7647 - /** 7648 - * Request the given permissions. 7649 - */ 7650 - request(permissions: Permissions): Promise<boolean>; 7651 - /** 7652 - * Relinquish the given permissions. 7653 - */ 7654 - remove(permissions: Permissions): Promise<boolean>; 7655 - /** 7656 - * Fired when the extension acquires new permissions. 7657 - */ 7658 - onAdded: Events.Event<(permissions: Permissions) => void>; 7659 - /** 7660 - * Fired when permissions are removed from the extension. 7661 - */ 7662 - onRemoved: Events.Event<(permissions: Permissions) => void>; 7663 - } 7664 - } 7665 - /** 7666 - * Namespace: browser.pkcs11 7667 - */ 7668 - namespace Pkcs11 { 7669 - interface Token { 7670 - /** 7671 - * Name of the token. 7672 - */ 7673 - name: string; 7674 - /** 7675 - * Name of the token's manufacturer. 7676 - */ 7677 - manufacturer: string; 7678 - /** 7679 - * Hardware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0". 7680 - */ 7681 - HWVersion: string; 7682 - /** 7683 - * Firmware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0". 7684 - */ 7685 - FWVersion: string; 7686 - /** 7687 - * Serial number, whose format is defined by the token specification. 7688 - */ 7689 - serial: string; 7690 - /** 7691 - * true if the token is logged on already, false otherwise. 7692 - */ 7693 - isLoggedIn: boolean; 7694 - } 7695 - interface ModuleSlot { 7696 - /** 7697 - * The name of the slot. 7698 - */ 7699 - name: string; 7700 - /** 7701 - * The token of the slot. 7702 - */ 7703 - token: Token | null; 7704 - } 7705 - interface Static { 7706 - /** 7707 - * checks whether a PKCS#11 module, given by name, is installed 7708 - */ 7709 - isModuleInstalled(name: string): Promise<boolean>; 7710 - /** 7711 - * Install a PKCS#11 module with a given name 7712 - * 7713 - * @param flags Optional. 7714 - */ 7715 - installModule(name: string, flags?: number): Promise<void>; 7716 - /** 7717 - * Remove an installed PKCS#11 module from firefox 7718 - */ 7719 - uninstallModule(name: string): Promise<void>; 7720 - /** 7721 - * Enumerate a module's slots, each with their name and whether a token is present 7722 - */ 7723 - getModuleSlots(name: string): Promise<undefined>; 7724 - } 7725 - } 7726 - /** 7727 - * Namespace: browser.privacy 7728 - */ 7729 - namespace Privacy { 7730 - interface Static { 7731 - network: Network.Static; 7732 - services: Services.Static; 7733 - websites: Websites.Static; 7734 - } 7735 - } 7736 - /** 7737 - * Namespace: browser.proxy 7738 - */ 7739 - namespace Proxy { 7740 - /** 7741 - * An object which describes proxy settings. 7742 - */ 7743 - interface ProxyConfig { 7744 - /** 7745 - * The type of proxy to use. 7746 - * Optional. 7747 - */ 7748 - proxyType?: ProxyConfigProxyTypeEnum; 7749 - /** 7750 - * The address of the http proxy, can include a port. 7751 - * Optional. 7752 - */ 7753 - http?: string; 7754 - /** 7755 - * Use the http proxy server for all protocols. 7756 - * Optional. 7757 - */ 7758 - httpProxyAll?: boolean; 7759 - /** 7760 - * The address of the ssl proxy, can include a port. 7761 - * Optional. 7762 - */ 7763 - ssl?: string; 7764 - /** 7765 - * The address of the socks proxy, can include a port. 7766 - * Optional. 7767 - */ 7768 - socks?: string; 7769 - /** 7770 - * The version of the socks proxy. 7771 - * Optional. 7772 - */ 7773 - socksVersion?: number; 7774 - /** 7775 - * A list of hosts which should not be proxied. 7776 - * Optional. 7777 - */ 7778 - passthrough?: string; 7779 - /** 7780 - * A URL to use to configure the proxy. 7781 - * Optional. 7782 - */ 7783 - autoConfigUrl?: string; 7784 - /** 7785 - * Do not prompt for authentication if password is saved. 7786 - * Optional. 7787 - */ 7788 - autoLogin?: boolean; 7789 - /** 7790 - * Proxy DNS when using SOCKS. DNS queries get leaked to the network when set to false. True by default for SOCKS v5. 7791 - * False by default for SOCKS v4. 7792 - * Optional. 7793 - */ 7794 - proxyDNS?: boolean; 7795 - /** 7796 - * If true (the default value), do not use newer TLS protocol features that might have interoperability problems on the 7797 - * Internet. This is intended only for use with critical infrastructure like the updates, 7798 - * and is only available to privileged addons. 7799 - * Optional. 7800 - */ 7801 - respectBeConservative?: boolean; 7802 - } 7803 - interface OnRequestDetailsType { 7804 - /** 7805 - * The ID of the request. Request IDs are unique within a browser session. As a result, 7806 - * they could be used to relate different events of the same request. 7807 - */ 7808 - requestId: string; 7809 - url: string; 7810 - /** 7811 - * Standard HTTP method. 7812 - */ 7813 - method: string; 7814 - /** 7815 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 7816 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 7817 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 7818 - * Frame IDs are unique within a tab. 7819 - */ 7820 - frameId: number; 7821 - /** 7822 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 7823 - */ 7824 - parentFrameId: number; 7825 - /** 7826 - * True for private browsing requests. 7827 - * Optional. 7828 - */ 7829 - incognito?: boolean; 7830 - /** 7831 - * The cookie store ID of the contextual identity. 7832 - * Optional. 7833 - */ 7834 - cookieStoreId?: string; 7835 - /** 7836 - * URL of the resource that triggered this request. 7837 - * Optional. 7838 - */ 7839 - originUrl?: string; 7840 - /** 7841 - * URL of the page into which the requested resource will be loaded. 7842 - * Optional. 7843 - */ 7844 - documentUrl?: string; 7845 - /** 7846 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 7847 - */ 7848 - tabId: number; 7849 - /** 7850 - * How the requested resource will be used. 7851 - */ 7852 - type: Browser.WebRequest.ResourceType; 7853 - /** 7854 - * The time when this signal is triggered, in milliseconds since the epoch. 7855 - */ 7856 - timeStamp: number; 7857 - /** 7858 - * Indicates if this response was fetched from disk cache. 7859 - */ 7860 - fromCache: boolean; 7861 - /** 7862 - * The HTTP request headers that are going to be sent out with this request. 7863 - * Optional. 7864 - */ 7865 - requestHeaders?: Browser.WebRequest.HttpHeaders; 7866 - /** 7867 - * Url classification if the request has been classified. 7868 - */ 7869 - urlClassification: Browser.WebRequest.UrlClassification; 7870 - /** 7871 - * Indicates if this request and its content window hierarchy is third party. 7872 - */ 7873 - thirdParty: boolean; 7874 - } 7875 - interface OnErrorErrorType { 7876 - [s: string]: unknown; 7877 - } 7878 - /** 7879 - * The type of proxy to use. 7880 - */ 7881 - type ProxyConfigProxyTypeEnum = "none" | "autoDetect" | "system" | "manual" | "autoConfig"; 7882 - /** 7883 - * Fired when proxy data is needed for a request. 7884 - */ 7885 - interface OnRequestEvent extends Events.Event<(details: OnRequestDetailsType) => void> { 7886 - /** 7887 - * Registers an event listener <em>callback</em> to an event. 7888 - * 7889 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 7890 - * @param filter A set of filters that restricts the events that will be sent to this listener. 7891 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 7892 - */ 7893 - addListener(callback: (details: OnRequestDetailsType) => void, filter: Browser.WebRequest.RequestFilter, extraInfoSpec?: string[]): void; 7894 - } 7895 - interface Static { 7896 - /** 7897 - * Fired when proxy data is needed for a request. 7898 - */ 7899 - onRequest: OnRequestEvent; 7900 - /** 7901 - * Notifies about errors caused by the invalid use of the proxy API. 7902 - */ 7903 - onError: Events.Event<(error: OnErrorErrorType) => void>; 7904 - /** 7905 - * Configures proxy settings. This setting's value is an object of type ProxyConfig. 7906 - */ 7907 - settings: Browser.Types.Setting; 7908 - } 7909 - } 7910 - /** 7911 - * Namespace: browser.runtime 7912 - */ 7913 - namespace Runtime { 7914 - /** 7915 - * A filter to match against existing extension context. Matching contexts must match all specified filters. 7916 - */ 7917 - interface ContextFilter { 7918 - /** 7919 - * Optional. 7920 - */ 7921 - contextIds?: string[]; 7922 - /** 7923 - * Optional. 7924 - */ 7925 - contextTypes?: ContextType[]; 7926 - /** 7927 - * Optional. 7928 - */ 7929 - documentIds?: string[]; 7930 - /** 7931 - * Optional. 7932 - */ 7933 - documentOrigins?: string[]; 7934 - /** 7935 - * Optional. 7936 - */ 7937 - documentUrls?: string[]; 7938 - /** 7939 - * Optional. 7940 - */ 7941 - frameIds?: number[]; 7942 - /** 7943 - * Optional. 7944 - */ 7945 - tabIds?: number[]; 7946 - /** 7947 - * Optional. 7948 - */ 7949 - windowIds?: number[]; 7950 - /** 7951 - * Optional. 7952 - */ 7953 - incognito?: boolean; 7954 - } 7955 - /** 7956 - * The type of extension view. 7957 - */ 7958 - type ContextType = "BACKGROUND" | "POPUP" | "SIDE_PANEL" | "TAB"; 7959 - /** 7960 - * A context hosting extension content 7961 - */ 7962 - interface ExtensionContext { 7963 - /** 7964 - * An unique identifier associated to this context 7965 - */ 7966 - contextId: string; 7967 - /** 7968 - * The type of the context 7969 - */ 7970 - contextType: ContextType; 7971 - /** 7972 - * The origin of the document associated with this context, or undefined if it is not hosted in a document 7973 - * Optional. 7974 - */ 7975 - documentOrigin?: string; 7976 - /** 7977 - * The URL of the document associated with this context, or undefined if it is not hosted in a document 7978 - * Optional. 7979 - */ 7980 - documentUrl?: string; 7981 - /** 7982 - * Whether the context is associated with an private browsing context. 7983 - */ 7984 - incognito: boolean; 7985 - /** 7986 - * The frame ID for this context, or -1 if it is not hosted in a frame. 7987 - */ 7988 - frameId: number; 7989 - /** 7990 - * The tab ID for this context, or -1 if it is not hosted in a tab. 7991 - */ 7992 - tabId: number; 7993 - /** 7994 - * The window ID for this context, or -1 if it is not hosted in a window. 7995 - */ 7996 - windowId: number; 7997 - } 7998 - /** 7999 - * An object which allows two way communication with other pages. 8000 - */ 8001 - interface Port { 8002 - name: string; 8003 - disconnect(): void; 8004 - onDisconnect: Events.Event<(port: Port) => void>; 8005 - onMessage: Events.Event<(message: unknown, port: Port) => void>; 8006 - /** 8007 - * Send a message to the other end. This takes one argument, which is a JSON object representing the message to send. 8008 - * It will be delivered to any script listening to the port's onMessage event, or to the native application if this port 8009 - * is connected to a native application. 8010 - */ 8011 - postMessage(message: unknown): void; 8012 - /** 8013 - * This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners. 8014 - * Optional. 8015 - */ 8016 - sender?: MessageSender; 8017 - /** 8018 - * If the port was disconnected due to an error, this will be set to an object with a string property message, 8019 - * giving you more information about the error. See onDisconnect. 8020 - * Optional. 8021 - */ 8022 - error?: PortErrorType; 8023 - } 8024 - /** 8025 - * An object containing information about the script context that sent a message or request. 8026 - */ 8027 - interface MessageSender { 8028 - /** 8029 - * The $(ref:tabs.Tab) which opened the connection, if any. This property will <strong>only</strong> 8030 - * be present when the connection was opened from a tab (including content scripts), and <strong>only</strong> 8031 - * if the receiver is an extension, not an app. 8032 - * Optional. 8033 - */ 8034 - tab?: Browser.Tabs.Tab; 8035 - /** 8036 - * The $(topic:frame_ids)[frame] that opened the connection. 0 for top-level frames, positive for child frames. 8037 - * This will only be set when <code>tab</code> is set. 8038 - * Optional. 8039 - */ 8040 - frameId?: number; 8041 - /** 8042 - * The ID of the extension or app that opened the connection, if any. 8043 - * Optional. 8044 - */ 8045 - id?: string; 8046 - /** 8047 - * The URL of the page or frame that opened the connection. If the sender is in an iframe, 8048 - * it will be iframe's URL not the URL of the page which hosts it. 8049 - * Optional. 8050 - */ 8051 - url?: string; 8052 - /** 8053 - * The worldId of the USER_SCRIPT world that sent the message. Only present on onUserScriptMessage and onUserScriptConnect 8054 - * (in port.sender) events. 8055 - * Optional. 8056 - */ 8057 - userScriptWorldId?: string; 8058 - } 8059 - /** 8060 - * The operating system the browser is running on. 8061 - */ 8062 - type PlatformOs = "mac" | "win" | "android" | "cros" | "linux" | "openbsd"; 8063 - /** 8064 - * The machine's processor architecture. 8065 - */ 8066 - type PlatformArch = "aarch64" | "arm" | "ppc64" | "s390x" | "sparc64" | "x86-32" | "x86-64" | "noarch"; 8067 - /** 8068 - * An object containing information about the current platform. 8069 - */ 8070 - interface PlatformInfo { 8071 - /** 8072 - * The operating system the browser is running on. 8073 - */ 8074 - os: PlatformOs; 8075 - /** 8076 - * The machine's processor architecture. 8077 - */ 8078 - arch: PlatformArch; 8079 - } 8080 - /** 8081 - * An object containing information about the current browser. 8082 - */ 8083 - interface BrowserInfo { 8084 - /** 8085 - * The name of the browser, for example 'Firefox'. 8086 - */ 8087 - name: string; 8088 - /** 8089 - * The name of the browser vendor, for example 'Mozilla'. 8090 - */ 8091 - vendor: string; 8092 - /** 8093 - * The browser's version, for example '42.0.0' or '0.8.1pre'. 8094 - */ 8095 - version: string; 8096 - /** 8097 - * The browser's build ID/date, for example '20160101'. 8098 - */ 8099 - buildID: string; 8100 - } 8101 - /** 8102 - * Result of the update check. 8103 - */ 8104 - type RequestUpdateCheckStatus = "throttled" | "no_update" | "update_available"; 8105 - /** 8106 - * The reason that this event is being dispatched. 8107 - */ 8108 - type OnInstalledReason = "install" | "update" | "browser_update"; 8109 - /** 8110 - * The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application 8111 - * is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a 8112 - * newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy. 8113 - */ 8114 - type OnRestartRequiredReason = "app_update" | "os_update" | "periodic"; 8115 - /** 8116 - * The performance warning event category, e.g. 'content_script'. 8117 - */ 8118 - type OnPerformanceWarningCategory = "content_script"; 8119 - /** 8120 - * The performance warning event severity. Will be 'high' for serious and user-visible issues. 8121 - */ 8122 - type OnPerformanceWarningSeverity = "low" | "medium" | "high"; 8123 - /** 8124 - * The third parameter is a function to call (at most once) when you have a response. 8125 - * The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> 8126 - * listener in the same document, then only one may send a response. <code>sendResponse</code> 8127 - * becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to 8128 - * send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> 8129 - * is called). 8130 - */ 8131 - type OnMessageListenerCallback = (message: unknown, sender: MessageSender, sendResponse: (response: unknown) => void) => true; 8132 - /** 8133 - * The return value should be a promise of any JSON-ifiable object. If you have more than one <code>onMessage</code> 8134 - * listener in the same document, then only one may send a response. 8135 - */ 8136 - type OnMessageListenerAsync = (message: unknown, sender: MessageSender) => Promise<unknown>; 8137 - type OnMessageListenerNoResponse = (message: unknown, sender: MessageSender) => void; 8138 - type OnMessageListener = OnMessageListenerCallback | OnMessageListenerAsync | OnMessageListenerNoResponse; 8139 - /** 8140 - * If an update is available, this contains more information about the available update. 8141 - */ 8142 - interface RequestUpdateCheckCallbackDetailsType { 8143 - /** 8144 - * The version of the available update. 8145 - */ 8146 - version: string; 8147 - } 8148 - interface ConnectConnectInfoType { 8149 - /** 8150 - * Will be passed into onConnect for processes that are listening for the connection event. 8151 - * Optional. 8152 - */ 8153 - name?: string; 8154 - /** 8155 - * Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection 8156 - * event. 8157 - * Optional. 8158 - */ 8159 - includeTlsChannelId?: boolean; 8160 - } 8161 - interface SendMessageOptionsType { 8162 - [s: string]: unknown; 8163 - } 8164 - interface OnInstalledDetailsType { 8165 - /** 8166 - * The reason that this event is being dispatched. 8167 - */ 8168 - reason: OnInstalledReason; 8169 - /** 8170 - * Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 8171 - * 'update'. 8172 - * Optional. 8173 - */ 8174 - previousVersion?: string; 8175 - /** 8176 - * Indicates whether the addon is installed as a temporary extension. 8177 - */ 8178 - temporary: boolean; 8179 - } 8180 - /** 8181 - * The manifest details of the available update. 8182 - */ 8183 - interface OnUpdateAvailableDetailsType { 8184 - /** 8185 - * The version number of the available update. 8186 - */ 8187 - version: string; 8188 - } 8189 - interface OnPerformanceWarningDetailsType { 8190 - /** 8191 - * The performance warning event category, e.g. 'content_script'. 8192 - */ 8193 - category: OnPerformanceWarningCategory; 8194 - /** 8195 - * The performance warning event severity, e.g. 'high'. 8196 - */ 8197 - severity: OnPerformanceWarningSeverity; 8198 - /** 8199 - * The $(ref:tabs.Tab) that the performance warning relates to, if any. 8200 - * Optional. 8201 - */ 8202 - tabId?: number; 8203 - /** 8204 - * An explanation of what the warning means, and hopefully how to address it. 8205 - */ 8206 - description: string; 8207 - } 8208 - /** 8209 - * This will be defined during an API method callback if there was an error 8210 - */ 8211 - interface PropertyLastErrorType { 8212 - /** 8213 - * Details about the error which occurred. 8214 - * Optional. 8215 - */ 8216 - message?: string; 8217 - } 8218 - /** 8219 - * If the port was disconnected due to an error, this will be set to an object with a string property message, 8220 - * giving you more information about the error. See onDisconnect. 8221 - */ 8222 - interface PortErrorType { 8223 - message: string; 8224 - } 8225 - interface Static { 8226 - /** 8227 - * Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. 8228 - * If the background page is an event page, the system will ensure it is loaded before calling the callback. 8229 - * If there is no background page, an error is set. 8230 - */ 8231 - getBackgroundPage(): Promise<Window>; 8232 - /** 8233 - * Fetches information about active contexts associated with this extension 8234 - * 8235 - * @param filter A filter to find matching context. 8236 - */ 8237 - getContexts(filter: ContextFilter): Promise<ExtensionContext[]>; 8238 - /** 8239 - * <p>Open your Extension's options page, if possible.</p><p>The precise behavior may depend on your manifest's <code> 8240 - * $(topic:optionsV2)[options_ui]</code> or <code>$(topic:options)[options_page]</code> key, 8241 - * or what the browser happens to support at the time.</p><p>If your Extension does not declare an options page, 8242 - * or the browser failed to create one for some other reason, the callback will set $(ref:lastError).</p> 8243 - */ 8244 - openOptionsPage(): Promise<void>; 8245 - /** 8246 - * Returns details about the app or extension from the manifest. The object returned is a serialization of the full 8247 - * $(topic:manifest)[manifest file]. 8248 - * 8249 - * @returns The manifest details. 8250 - */ 8251 - getManifest(): Promise<Manifest.WebExtensionManifest>; 8252 - /** 8253 - * Converts a relative path within an app/extension install directory to a fully-qualified URL. 8254 - * 8255 - * @param path A path to a resource within an app/extension expressed relative to its install directory. 8256 - * @returns The fully-qualified URL to the resource. 8257 - */ 8258 - getURL(path: string): Promise<string>; 8259 - /** 8260 - * Get the frameId of any window global or frame element. 8261 - * 8262 - * @param target A WindowProxy or a Browsing Context container element (IFrame, Frame, Embed, Object) for the target frame. 8263 - * @returns The frameId of the target frame, or -1 if it doesn't exist. 8264 - */ 8265 - getFrameId(target: unknown): number; 8266 - /** 8267 - * Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, 8268 - * and implement surveys. Maximum 1023 characters. 8269 - * 8270 - * @param url Optional. URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. 8271 - * Set an empty string to not open a new tab upon uninstallation. 8272 - * @returns Called when the uninstall URL is set. If the given URL is invalid, $(ref:runtime.lastError) will be set. 8273 - */ 8274 - setUninstallURL(url?: string): Promise<void>; 8275 - /** 8276 - * Reloads the app or extension. 8277 - */ 8278 - reload(): void; 8279 - /** 8280 - * Requests an update check for this app/extension. 8281 - */ 8282 - requestUpdateCheck(): Promise<[ 8283 - RequestUpdateCheckStatus, 8284 - RequestUpdateCheckCallbackDetailsType 8285 - ]>; 8286 - /** 8287 - * Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. 8288 - * This is useful for content scripts connecting to their extension processes, inter-app/extension communication, 8289 - * and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a 8290 - * content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect). 8291 - * 8292 - * @param extensionId Optional. The ID of the extension or app to connect to. If omitted, 8293 - * a connection will be attempted with your own extension. Required if sending messages from a web page for 8294 - * $(topic:manifest/externally_connectable)[web messaging]. 8295 - * @param connectInfo Optional. 8296 - * @returns Port through which messages can be sent and received. The port's $(ref:runtime.Port onDisconnect) 8297 - * event is fired if the extension/app does not exist. 8298 - */ 8299 - connect(extensionId?: string, connectInfo?: ConnectConnectInfoType): Port; 8300 - /** 8301 - * Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. 8302 - * This is useful for content scripts connecting to their extension processes, inter-app/extension communication, 8303 - * and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a 8304 - * content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect). 8305 - * 8306 - * @param connectInfo Optional. 8307 - * @returns Port through which messages can be sent and received. The port's $(ref:runtime.Port onDisconnect) 8308 - * event is fired if the extension/app does not exist. 8309 - */ 8310 - connect(connectInfo?: ConnectConnectInfoType): Port; 8311 - /** 8312 - * Connects to a native application in the host machine. 8313 - * 8314 - * @param application The name of the registered application to connect to. 8315 - * @returns Port through which messages can be sent and received with the application 8316 - */ 8317 - connectNative(application: string): Port; 8318 - /** 8319 - * Sends a single message to event listeners within your extension/app or a different extension/app. 8320 - * Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. 8321 - * If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime. 8322 - * onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this 8323 - * method. To send messages to content scripts, use $(ref:tabs.sendMessage). 8324 - * 8325 - * @param extensionId Optional. The ID of the extension/app to send the message to. If omitted, 8326 - * the message will be sent to your own extension/app. Required if sending messages from a web page for 8327 - * $(topic:manifest/externally_connectable)[web messaging]. 8328 - * @param options Optional. 8329 - */ 8330 - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics 8331 - sendMessage<TMessage = unknown, TResponse = unknown>(extensionId: string | undefined, message: TMessage, options?: SendMessageOptionsType): Promise<TResponse>; 8332 - /** 8333 - * Sends a single message to event listeners within your extension/app or a different extension/app. 8334 - * Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. 8335 - * If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime. 8336 - * onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this 8337 - * method. To send messages to content scripts, use $(ref:tabs.sendMessage). 8338 - * 8339 - * @param options Optional. 8340 - */ 8341 - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics 8342 - sendMessage<TMessage = unknown, TResponse = unknown>(message: TMessage, options?: SendMessageOptionsType): Promise<TResponse>; 8343 - /** 8344 - * Send a single message to a native application. 8345 - * 8346 - * @param application The name of the native messaging host. 8347 - * @param message The message that will be passed to the native messaging host. 8348 - */ 8349 - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics 8350 - sendNativeMessage<TMessage = unknown, TResponse = unknown>(application: string, message: TMessage): Promise<TResponse>; 8351 - /** 8352 - * Returns information about the current browser. 8353 - * 8354 - * @returns Called with results 8355 - */ 8356 - getBrowserInfo(): Promise<BrowserInfo>; 8357 - /** 8358 - * Returns information about the current platform. 8359 - * 8360 - * @returns Called with results 8361 - */ 8362 - getPlatformInfo(): Promise<PlatformInfo>; 8363 - /** 8364 - * Fired when a profile that has this extension installed first starts up. This event is not fired for incognito profiles. 8365 - */ 8366 - onStartup: Events.Event<() => void>; 8367 - /** 8368 - * Fired when the extension is first installed, when the extension is updated to a new version, 8369 - * and when the browser is updated to a new version. 8370 - */ 8371 - onInstalled: Events.Event<(details: OnInstalledDetailsType) => void>; 8372 - /** 8373 - * Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. 8374 - * Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed 8375 - * to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent 8376 - * and the page won't be unloaded. 8377 - */ 8378 - onSuspend: Events.Event<() => void>; 8379 - /** 8380 - * Sent after onSuspend to indicate that the app won't be unloaded after all. 8381 - */ 8382 - onSuspendCanceled: Events.Event<() => void>; 8383 - /** 8384 - * Fired when an update is available, but isn't installed immediately because the app is currently running. 8385 - * If you do nothing, the update will be installed the next time the background page gets unloaded, 8386 - * if you want it to be installed sooner you can explicitly call $(ref:runtime.reload). 8387 - * If your extension is using a persistent background page, the background page of course never gets unloaded, 8388 - * so unless you call $(ref:runtime.reload) manually in response to this event the update will not get installed until the 8389 - * next time the browser itself restarts. If no handlers are listening for this event, 8390 - * and your extension has a persistent background page, it behaves as if $(ref:runtime.reload) 8391 - * is called in response to this event. 8392 - * 8393 - * @param details The manifest details of the available update. 8394 - */ 8395 - onUpdateAvailable: Events.Event<(details: OnUpdateAvailableDetailsType) => void>; 8396 - /** 8397 - * Fired when a connection is made from either an extension process or a content script. 8398 - */ 8399 - onConnect: Events.Event<(port: Port) => void>; 8400 - /** 8401 - * Fired when a connection is made from a USER_SCRIPT world registered through the userScripts API. 8402 - */ 8403 - onUserScriptConnect: Events.Event<(port: Port) => void>; 8404 - /** 8405 - * Fired when a connection is made from another extension. 8406 - */ 8407 - onConnectExternal: Events.Event<(port: Port) => void>; 8408 - /** 8409 - * Fired when a message is sent from either an extension process or a content script. 8410 - */ 8411 - onMessage: Events.Event<OnMessageListener>; 8412 - /** 8413 - * Fired when a message is sent from another extension/app. Cannot be used in a content script. 8414 - */ 8415 - onMessageExternal: Events.Event<OnMessageListener>; 8416 - /** 8417 - * Fired when a message is sent from a USER_SCRIPT world registered through the userScripts API. 8418 - */ 8419 - onUserScriptMessage: Events.Event<OnMessageListener>; 8420 - /** 8421 - * Fired when a runtime performance issue is detected with the extension. Observe this event to be proactively notified of 8422 - * runtime performance problems with the extension. 8423 - */ 8424 - onPerformanceWarning: Events.Event<(details: OnPerformanceWarningDetailsType) => void>; 8425 - /** 8426 - * This will be defined during an API method callback if there was an error 8427 - * Optional. 8428 - */ 8429 - lastError?: PropertyLastErrorType; 8430 - /** 8431 - * The ID of the extension/app. 8432 - */ 8433 - id: string; 8434 - } 8435 - } 8436 - /** 8437 - * Namespace: browser.scripting 8438 - */ 8439 - namespace Scripting { 8440 - /** 8441 - * Details of a script injection 8442 - */ 8443 - interface ScriptInjection { 8444 - /** 8445 - * The arguments to curry into a provided function. This is only valid if the <code>func</code> parameter is specified. 8446 - * These arguments must be JSON-serializable. 8447 - * Optional. 8448 - */ 8449 - args?: unknown[]; 8450 - /** 8451 - * The path of the JS files to inject, relative to the extension's root directory. Exactly one of <code>files</code> 8452 - * and <code>func</code> must be specified. 8453 - * Optional. 8454 - */ 8455 - files?: string[]; 8456 - /** 8457 - * A JavaScript function to inject. This function will be serialized, and then deserialized for injection. 8458 - * This means that any bound parameters and execution context will be lost. Exactly one of <code>files</code> and <code> 8459 - * func</code> must be specified. 8460 - * 8461 - * @param ...args The arguments 8462 - * @returns The return value 8463 - */ 8464 - func?(...args: unknown[]): unknown; 8465 - /** 8466 - * Details specifying the target into which to inject the script. 8467 - */ 8468 - target: InjectionTarget; 8469 - /** 8470 - * Optional. 8471 - */ 8472 - world?: ExecutionWorld; 8473 - /** 8474 - * Whether the injection should be triggered in the target as soon as possible (but not necessarily prior to page load). 8475 - * Optional. 8476 - */ 8477 - injectImmediately?: boolean; 8478 - } 8479 - /** 8480 - * Result of a script injection. 8481 - */ 8482 - interface InjectionResult { 8483 - /** 8484 - * The frame ID associated with the injection. 8485 - */ 8486 - frameId: number; 8487 - /** 8488 - * The result of the script execution. 8489 - * Optional. 8490 - */ 8491 - result?: unknown; 8492 - /** 8493 - * The error property is set when the script execution failed. The value is typically an (Error) 8494 - * object with a message property, but could be any value (including primitives and undefined) 8495 - * if the script threw or rejected with such a value. 8496 - * Optional. 8497 - */ 8498 - error?: unknown; 8499 - /** 8500 - * Whether the script should inject into all frames within the tab. Defaults to false. 8501 - * This must not be true if frameIds is specified. 8502 - * Optional. 8503 - */ 8504 - allFrames?: boolean; 8505 - } 8506 - /** 8507 - * Details of the script to insert. 8508 - */ 8509 - interface InjectionTarget { 8510 - /** 8511 - * The IDs of specific frames to inject into. 8512 - * Optional. 8513 - */ 8514 - frameIds?: number[]; 8515 - /** 8516 - * Whether the script should inject into all frames within the tab. Defaults to false. 8517 - * This must not be true if frameIds is specified. 8518 - * Optional. 8519 - */ 8520 - allFrames?: boolean; 8521 - /** 8522 - * The ID of the tab into which to inject. 8523 - */ 8524 - tabId: number; 8525 - } 8526 - interface CSSInjection { 8527 - /** 8528 - * A string containing the CSS to inject. Exactly one of <code>files</code> and <code>css</code> must be specified. 8529 - * Optional. 8530 - */ 8531 - css?: string; 8532 - /** 8533 - * The path of the CSS files to inject, relative to the extension's root directory. Exactly one of <code>files</code> 8534 - * and <code>css</code> must be specified. 8535 - * Optional. 8536 - */ 8537 - files?: string[]; 8538 - /** 8539 - * The style origin for the injection. Defaults to <code>'AUTHOR'</code>. 8540 - * Optional. 8541 - */ 8542 - origin?: CSSInjectionOriginEnum; 8543 - /** 8544 - * Details specifying the target into which to inject the CSS. 8545 - */ 8546 - target: InjectionTarget; 8547 - } 8548 - interface ContentScriptFilter { 8549 - /** 8550 - * The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code> 8551 - * unregisterContentScripts()</code>. 8552 - * Optional. 8553 - */ 8554 - ids?: string[]; 8555 - } 8556 - /** 8557 - * The JavaScript world for a script to execute within. <code>ISOLATED</code> is the default execution environment of 8558 - * content scripts, <code>MAIN</code> is the web page's execution environment. 8559 - */ 8560 - type ExecutionWorld = "ISOLATED" | "MAIN"; 8561 - interface RegisteredContentScript { 8562 - /** 8563 - * If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. 8564 - * Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements 8565 - * are not met. Defaults to false, meaning that only the top frame is matched. 8566 - * Optional. 8567 - */ 8568 - allFrames?: boolean; 8569 - /** 8570 - * Excludes pages that this content script would otherwise be injected into. 8571 - * Optional. 8572 - */ 8573 - excludeMatches?: string[]; 8574 - /** 8575 - * The id of the content script, specified in the API call. 8576 - */ 8577 - id: string; 8578 - /** 8579 - * The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this 8580 - * array. 8581 - * Optional. 8582 - */ 8583 - js?: Browser.Manifest.ExtensionURL[]; 8584 - /** 8585 - * Specifies which pages this content script will be injected into. Must be specified for <code>registerContentScripts() 8586 - * </code>. 8587 - * Optional. 8588 - */ 8589 - matches?: string[]; 8590 - /** 8591 - * If matchOriginAsFallback is true, then the code is also injected in about:, data:, 8592 - * blob: when their origin matches the pattern in 'matches', even if the actual document origin is opaque (due to the use 8593 - * of CSP sandbox or iframe sandbox). Match patterns in 'matches' must specify a wildcard path glob. By default it is <code> 8594 - * false</code>. 8595 - * Optional. 8596 - */ 8597 - matchOriginAsFallback?: boolean; 8598 - /** 8599 - * Specifies when JavaScript files are injected into the web page. The preferred and default value is <code> 8600 - * document_idle</code>. 8601 - * Optional. 8602 - */ 8603 - runAt?: Browser.ExtensionTypes.RunAt; 8604 - /** 8605 - * The JavaScript world for a script to execute within. Defaults to "ISOLATED". 8606 - * Optional. 8607 - */ 8608 - world?: ExecutionWorld; 8609 - /** 8610 - * Specifies if this content script will persist into future sessions. This is currently NOT supported. 8611 - * Optional. 8612 - */ 8613 - persistAcrossSessions?: boolean; 8614 - /** 8615 - * The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array. 8616 - * Optional. 8617 - */ 8618 - css?: Browser.Manifest.ExtensionURL[]; 8619 - } 8620 - /** 8621 - * The origin for a style change. See style origins for more info. 8622 - * 8623 - * "AUTHOR": The author origin is the style origin which contains all of the styles which are part of the document, 8624 - * whether embedded within the HTML or loaded from an external stylesheet file. 8625 - * "USER": The user origin is the style origin containing any CSS that the user of the web browser has added. 8626 - * These may be from adding styles using a developer tool or from a browser extension that automatically applies custom 8627 - * styles to content, such as Stylus or Stylish. 8628 - */ 8629 - type StyleOrigin = "AUTHOR" | "USER"; 8630 - /** 8631 - * Details of the css to insert. 8632 - */ 8633 - interface CSSInjection { 8634 - /** 8635 - * A string containing the CSS to inject. Exactly one of files and css must be specified. 8636 - * Optional. 8637 - */ 8638 - css?: string; 8639 - /** 8640 - * The path of the CSS files to inject, relative to the extension's root directory. NOTE: Currently a maximum of one file 8641 - * is supported. Exactly one of files and css must be specified. 8642 - * Optional. 8643 - */ 8644 - files?: string[]; 8645 - /** 8646 - * The style origin for the injection. Defaults to 'AUTHOR'. 8647 - * Optional. 8648 - */ 8649 - origin?: StyleOrigin; 8650 - /** 8651 - * Details specifying the target into which to insert the CSS. 8652 - */ 8653 - target: InjectionTarget; 8654 - } 8655 - interface UpdateContentScriptsScriptsItemType extends RegisteredContentScript { 8656 - /** 8657 - * Specifies if this content script will persist into future sessions. 8658 - * Optional. 8659 - */ 8660 - persistAcrossSessions?: boolean; 8661 - } 8662 - /** 8663 - * The style origin for the injection. Defaults to <code>'AUTHOR'</code>. 8664 - */ 8665 - type CSSInjectionOriginEnum = "USER" | "AUTHOR"; 8666 - interface Static { 8667 - /** 8668 - * Injects a script into a target context. The script will be run at <code>document_idle</code>. 8669 - * 8670 - * @param injection The details of the script which to inject. 8671 - * @returns Invoked upon completion of the injection. The resulting array contains the result of execution for each frame 8672 - * where the injection succeeded. 8673 - */ 8674 - executeScript(injection: ScriptInjection): Promise<InjectionResult[]>; 8675 - /** 8676 - * Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored. 8677 - * 8678 - * @param injection The details of the styles to insert. 8679 - * @returns Invoked upon completion of the injection. 8680 - */ 8681 - insertCSS(injection: CSSInjection): Promise<void>; 8682 - /** 8683 - * Removes a CSS stylesheet that was previously inserted by this extension from a target context. 8684 - * 8685 - * @param injection The details of the styles to remove. Note that the <code>css</code>, <code>files</code>, and <code> 8686 - * origin</code> properties must exactly match the stylesheet inserted through <code>insertCSS</code>. 8687 - * Attempting to remove a non-existent stylesheet is a no-op. 8688 - * @returns Invoked upon completion of the injection. 8689 - */ 8690 - removeCSS(injection: CSSInjection): Promise<void>; 8691 - /** 8692 - * Registers one or more content scripts for this extension. 8693 - * 8694 - * @param scripts Contains a list of scripts to be registered. If there are errors during script parsing/file validation, 8695 - * or if the IDs specified already exist, then no scripts are registered. 8696 - * @returns Invoked upon completion of the registration. 8697 - */ 8698 - registerContentScripts(scripts: RegisteredContentScript[]): Promise<void>; 8699 - /** 8700 - * Returns all dynamically registered content scripts for this extension that match the given filter. 8701 - * 8702 - * @param filter Optional. An object to filter the extension's dynamically registered scripts. 8703 - * @returns The resulting array contains the registered content scripts. 8704 - */ 8705 - getRegisteredContentScripts(filter?: ContentScriptFilter): Promise<RegisteredContentScript[]>; 8706 - /** 8707 - * Unregisters one or more content scripts for this extension. 8708 - * 8709 - * @param filter Optional. If specified, only unregisters dynamic content scripts which match the filter. Otherwise, 8710 - * all of the extension's dynamic content scripts are unregistered. 8711 - * @returns Invoked upon completion of the unregistration. 8712 - */ 8713 - unregisterContentScripts(filter?: ContentScriptFilter): Promise<void>; 8714 - /** 8715 - * Updates one or more content scripts for this extension. 8716 - * 8717 - * @param scripts Contains a list of scripts to be updated. If there are errors during script parsing/file validation, 8718 - * or if the IDs specified do not already exist, then no scripts are updated. 8719 - * @returns Invoked when scripts have been updated. 8720 - */ 8721 - updateContentScripts(scripts: UpdateContentScriptsScriptsItemType[]): Promise<void>; 8722 - } 8723 - } 8724 - /** 8725 - * Namespace: browser.search 8726 - */ 8727 - namespace Search { 8728 - /** 8729 - * An object encapsulating a search engine 8730 - */ 8731 - interface SearchEngine { 8732 - name: string; 8733 - isDefault: boolean; 8734 - /** 8735 - * Optional. 8736 - */ 8737 - alias?: string; 8738 - /** 8739 - * Optional. 8740 - */ 8741 - favIconUrl?: string; 8742 - } 8743 - /** 8744 - * Location where search results should be displayed. 8745 - */ 8746 - type Disposition = "CURRENT_TAB" | "NEW_TAB" | "NEW_WINDOW"; 8747 - interface SearchSearchPropertiesType { 8748 - /** 8749 - * Terms to search for. 8750 - */ 8751 - query: string; 8752 - /** 8753 - * Search engine to use. Uses the default if not specified. 8754 - * Optional. 8755 - */ 8756 - engine?: string; 8757 - /** 8758 - * Location where search results should be displayed. NEW_TAB is the default. 8759 - * Optional. 8760 - */ 8761 - disposition?: Disposition; 8762 - /** 8763 - * The ID of the tab for the search results. If not specified, a new tab is created, unless disposition is set. 8764 - * tabId cannot be used with disposition. 8765 - * Optional. 8766 - */ 8767 - tabId?: number; 8768 - } 8769 - interface QueryQueryInfoType { 8770 - /** 8771 - * String to query with the default search provider. 8772 - */ 8773 - text: string; 8774 - /** 8775 - * Location where search results should be displayed. CURRENT_TAB is the default. 8776 - * Optional. 8777 - */ 8778 - disposition?: Disposition; 8779 - /** 8780 - * Location where search results should be displayed. tabId cannot be used with disposition. 8781 - * Optional. 8782 - */ 8783 - tabId?: number; 8784 - } 8785 - interface Static { 8786 - /** 8787 - * Gets a list of search engines. 8788 - * 8789 - * @returns A Promise that will be fulfilled with an array of search engine objects. 8790 - */ 8791 - get(): Promise<SearchEngine[]>; 8792 - /** 8793 - * Perform a search. 8794 - */ 8795 - search(searchProperties: SearchSearchPropertiesType): Promise<void>; 8796 - /** 8797 - * Use the chrome.search API to search via the default provider. 8798 - */ 8799 - query(queryInfo: QueryQueryInfoType): Promise<void>; 8800 - } 8801 - } 8802 - /** 8803 - * Namespace: browser.sessions 8804 - */ 8805 - namespace Sessions { 8806 - interface Filter { 8807 - /** 8808 - * The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of 8809 - * entries ($(ref:sessions.MAX_SESSION_RESULTS)). 8810 - * Optional. 8811 - */ 8812 - maxResults?: number; 8813 - } 8814 - interface Session { 8815 - /** 8816 - * The time when the window or tab was closed or modified, represented in milliseconds since the epoch. 8817 - */ 8818 - lastModified: number; 8819 - /** 8820 - * The $(ref:tabs.Tab), if this entry describes a tab. Either this or $(ref:sessions.Session.window) will be set. 8821 - * Optional. 8822 - */ 8823 - tab?: Browser.Tabs.Tab; 8824 - /** 8825 - * The $(ref:windows.Window), if this entry describes a window. Either this or $(ref:sessions.Session.tab) will be set. 8826 - * Optional. 8827 - */ 8828 - window?: Browser.Windows.Window; 8829 - } 8830 - interface Device { 8831 - info: string; 8832 - /** 8833 - * The name of the foreign device. 8834 - */ 8835 - deviceName: string; 8836 - /** 8837 - * A list of open window sessions for the foreign device, sorted from most recently to least recently modified session. 8838 - */ 8839 - sessions: Session[]; 8840 - } 8841 - interface Static { 8842 - /** 8843 - * Forget a recently closed tab. 8844 - * 8845 - * @param windowId The windowId of the window to which the recently closed tab to be forgotten belongs. 8846 - * @param sessionId The sessionId (closedId) of the recently closed tab to be forgotten. 8847 - */ 8848 - forgetClosedTab(windowId: number, sessionId: string): Promise<void>; 8849 - /** 8850 - * Forget a recently closed window. 8851 - * 8852 - * @param sessionId The sessionId (closedId) of the recently closed window to be forgotten. 8853 - */ 8854 - forgetClosedWindow(sessionId: string): Promise<void>; 8855 - /** 8856 - * Gets the list of recently closed tabs and/or windows. 8857 - * 8858 - * @param filter Optional. 8859 - */ 8860 - getRecentlyClosed(filter?: Filter): Promise<Session[]>; 8861 - /** 8862 - * Reopens a $(ref:windows.Window) or $(ref:tabs.Tab), with an optional callback to run when the entry has been restored. 8863 - * 8864 - * @param sessionId Optional. The $(ref:windows.Window.sessionId), or $(ref:tabs.Tab.sessionId) to restore. 8865 - * If this parameter is not specified, the most recently closed session is restored. 8866 - */ 8867 - restore(sessionId?: string): Promise<Session>; 8868 - /** 8869 - * Set a key/value pair on a given tab. 8870 - * 8871 - * @param tabId The id of the tab that the key/value pair is being set on. 8872 - * @param key The key which corresponds to the value being set. 8873 - * @param value The value being set. 8874 - */ 8875 - setTabValue(tabId: number, key: string, value: unknown): Promise<void>; 8876 - /** 8877 - * Retrieve a value that was set for a given key on a given tab. 8878 - * 8879 - * @param tabId The id of the tab whose value is being retrieved from. 8880 - * @param key The key which corresponds to the value. 8881 - */ 8882 - getTabValue(tabId: number, key: string): Promise<unknown>; 8883 - /** 8884 - * Remove a key/value pair that was set on a given tab. 8885 - * 8886 - * @param tabId The id of the tab whose key/value pair is being removed. 8887 - * @param key The key which corresponds to the value. 8888 - */ 8889 - removeTabValue(tabId: number, key: string): Promise<void>; 8890 - /** 8891 - * Set a key/value pair on a given window. 8892 - * 8893 - * @param windowId The id of the window that the key/value pair is being set on. 8894 - * @param key The key which corresponds to the value being set. 8895 - * @param value The value being set. 8896 - */ 8897 - setWindowValue(windowId: number, key: string, value: unknown): Promise<void>; 8898 - /** 8899 - * Retrieve a value that was set for a given key on a given window. 8900 - * 8901 - * @param windowId The id of the window whose value is being retrieved from. 8902 - * @param key The key which corresponds to the value. 8903 - */ 8904 - getWindowValue(windowId: number, key: string): Promise<unknown>; 8905 - /** 8906 - * Remove a key/value pair that was set on a given window. 8907 - * 8908 - * @param windowId The id of the window whose key/value pair is being removed. 8909 - * @param key The key which corresponds to the value. 8910 - */ 8911 - removeWindowValue(windowId: number, key: string): Promise<void>; 8912 - /** 8913 - * Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes. 8914 - */ 8915 - onChanged: Events.Event<() => void>; 8916 - /** 8917 - * The maximum number of $(ref:sessions.Session) that will be included in a requested list. 8918 - */ 8919 - MAX_SESSION_RESULTS: 25; 8920 - } 8921 - } 8922 - /** 8923 - * Namespace: browser.sidebarAction 8924 - */ 8925 - namespace SidebarAction { 8926 - /** 8927 - * Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element). 8928 - */ 8929 - interface ImageDataType extends ImageData { 8930 - [s: string]: unknown; 8931 - } 8932 - interface SetTitleDetailsType { 8933 - /** 8934 - * The string the sidebar action should display when moused over. 8935 - */ 8936 - title: string | null; 8937 - /** 8938 - * Sets the sidebar title for the tab specified by tabId. Automatically resets when the tab is closed. 8939 - * Optional. 8940 - */ 8941 - tabId?: number; 8942 - /** 8943 - * Sets the sidebar title for the window specified by windowId. 8944 - * Optional. 8945 - */ 8946 - windowId?: number; 8947 - } 8948 - interface GetTitleDetailsType { 8949 - /** 8950 - * Specify the tab to get the title from. If no tab nor window is specified, the global title is returned. 8951 - * Optional. 8952 - */ 8953 - tabId?: number; 8954 - /** 8955 - * Specify the window to get the title from. If no tab nor window is specified, the global title is returned. 8956 - * Optional. 8957 - */ 8958 - windowId?: number; 8959 - } 8960 - interface SetIconDetailsType { 8961 - /** 8962 - * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. 8963 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 8964 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 8965 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 8966 - * At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details. 8967 - * imageData = {'19': foo}' 8968 - * Optional. 8969 - */ 8970 - imageData?: ImageDataType | Record<string, ImageDataType>; 8971 - /** 8972 - * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. 8973 - * If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. 8974 - * If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code> 8975 - * scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. 8976 - * At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' 8977 - * Optional. 8978 - */ 8979 - path?: string | SetIconDetailsTypePathC2Type; 8980 - /** 8981 - * Sets the sidebar icon for the tab specified by tabId. Automatically resets when the tab is closed. 8982 - * Optional. 8983 - */ 8984 - tabId?: number; 8985 - /** 8986 - * Sets the sidebar icon for the window specified by windowId. 8987 - * Optional. 8988 - */ 8989 - windowId?: number; 8990 - } 8991 - interface SetPanelDetailsType { 8992 - /** 8993 - * Sets the sidebar url for the tab specified by tabId. Automatically resets when the tab is closed. 8994 - * Optional. 8995 - */ 8996 - tabId?: number; 8997 - /** 8998 - * Sets the sidebar url for the window specified by windowId. 8999 - * Optional. 9000 - */ 9001 - windowId?: number; 9002 - /** 9003 - * The url to the html file to show in a sidebar. If set to the empty string (''), no sidebar is shown. 9004 - */ 9005 - panel: string | null; 9006 - } 9007 - interface GetPanelDetailsType { 9008 - /** 9009 - * Specify the tab to get the panel from. If no tab nor window is specified, the global panel is returned. 9010 - * Optional. 9011 - */ 9012 - tabId?: number; 9013 - /** 9014 - * Specify the window to get the panel from. If no tab nor window is specified, the global panel is returned. 9015 - * Optional. 9016 - */ 9017 - windowId?: number; 9018 - } 9019 - interface IsOpenDetailsType { 9020 - /** 9021 - * Specify the window to get the openness from. 9022 - * Optional. 9023 - */ 9024 - windowId?: number; 9025 - } 9026 - interface SetIconDetailsTypePathC2Type { 9027 - [s: string]: unknown; 9028 - } 9029 - interface Static { 9030 - /** 9031 - * Sets the title of the sidebar action. This shows up in the tooltip. 9032 - */ 9033 - setTitle(details: SetTitleDetailsType): Promise<void>; 9034 - /** 9035 - * Gets the title of the sidebar action. 9036 - */ 9037 - getTitle(details: GetTitleDetailsType): Promise<string>; 9038 - /** 9039 - * Sets the icon for the sidebar action. The icon can be specified either as the path to an image file or as the pixel data 9040 - * from a canvas element, or as dictionary of either one of those. Either the <strong>path</strong> or the <strong> 9041 - * imageData</strong> property must be specified. 9042 - */ 9043 - setIcon(details: SetIconDetailsType): Promise<void>; 9044 - /** 9045 - * Sets the url to the html document to be opened in the sidebar when the user clicks on the sidebar action's icon. 9046 - */ 9047 - setPanel(details: SetPanelDetailsType): Promise<void>; 9048 - /** 9049 - * Gets the url to the html document set as the panel for this sidebar action. 9050 - */ 9051 - getPanel(details: GetPanelDetailsType): Promise<string>; 9052 - /** 9053 - * Opens the extension sidebar in the active window. 9054 - */ 9055 - open(): Promise<void>; 9056 - /** 9057 - * Closes the extension sidebar in the active window if the sidebar belongs to the extension. 9058 - */ 9059 - close(): Promise<void>; 9060 - /** 9061 - * Toggles the extension sidebar in the active window. 9062 - */ 9063 - toggle(): Promise<void>; 9064 - /** 9065 - * Checks whether the sidebar action is open. 9066 - */ 9067 - isOpen(details: IsOpenDetailsType): Promise<boolean>; 9068 - } 9069 - } 9070 - /** 9071 - * Namespace: browser.storage 9072 - */ 9073 - namespace Storage { 9074 - interface StorageChange { 9075 - /** 9076 - * The old value of the item, if there was an old value. 9077 - * Optional. 9078 - */ 9079 - oldValue?: unknown; 9080 - /** 9081 - * The new value of the item, if there is a new value. 9082 - * Optional. 9083 - */ 9084 - newValue?: unknown; 9085 - } 9086 - interface StorageArea { 9087 - /** 9088 - * Gets one or more items from storage. 9089 - * 9090 - * @param keys Optional. A single key to get, list of keys to get, or a dictionary specifying default values (see 9091 - * description of the object). An empty list or object will return an empty result object. Pass in <code>null</code> 9092 - * to get the entire contents of storage. 9093 - * @returns Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set). 9094 - */ 9095 - get(keys?: null | string | string[] | Record<string, unknown>): Promise<Record<string, unknown>>; 9096 - /** 9097 - * Sets multiple items. 9098 - * 9099 - * @param items <p>An object which gives each key/value pair to update storage with. Any other key/value pairs in storage 9100 - * will not be affected.</p><p>Primitive values such as numbers will serialize as expected. Values with a <code> 9101 - * typeof</code> <code>"object"</code> and <code>"function"</code> will typically serialize to <code>{}</code>, 9102 - * with the exception of <code>Array</code> (serializes as expected), <code>Date</code>, and <code>Regex</code> 9103 - * (serialize using their <code>String</code> representation).</p> 9104 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9105 - */ 9106 - set(items: Record<string, unknown>): Promise<void>; 9107 - /** 9108 - * Removes one or more items from storage. 9109 - * 9110 - * @param keys A single key or a list of keys for items to remove. 9111 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9112 - */ 9113 - remove(keys: string | string[]): Promise<void>; 9114 - /** 9115 - * Removes all items from storage. 9116 - * 9117 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9118 - */ 9119 - clear(): Promise<void>; 9120 - /** 9121 - * Fired when one or more items change. 9122 - * 9123 - * @param changes Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item. 9124 - */ 9125 - onChanged: Events.Event<(changes: StorageAreaOnChangedChangesType) => void>; 9126 - } 9127 - interface StorageAreaWithUsage { 9128 - /** 9129 - * Gets one or more items from storage. 9130 - * 9131 - * @param keys Optional. A single key to get, list of keys to get, or a dictionary specifying default values (see 9132 - * description of the object). An empty list or object will return an empty result object. Pass in <code>null</code> 9133 - * to get the entire contents of storage. 9134 - * @returns Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set). 9135 - */ 9136 - get(keys?: null | string | string[] | Record<string, unknown>): Promise<Record<string, unknown>>; 9137 - /** 9138 - * Gets the amount of space (in bytes) being used by one or more items. 9139 - * 9140 - * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. 9141 - * Pass in <code>null</code> to get the total usage of all of storage. 9142 - * @returns Callback with the amount of space being used by storage, or on failure (in which case $(ref:runtime.lastError) 9143 - * will be set). 9144 - */ 9145 - getBytesInUse(keys?: null | string | string[]): Promise<number>; 9146 - /** 9147 - * Sets multiple items. 9148 - * 9149 - * @param items <p>An object which gives each key/value pair to update storage with. Any other key/value pairs in storage 9150 - * will not be affected.</p><p>Primitive values such as numbers will serialize as expected. Values with a <code> 9151 - * typeof</code> <code>"object"</code> and <code>"function"</code> will typically serialize to <code>{}</code>, 9152 - * with the exception of <code>Array</code> (serializes as expected), <code>Date</code>, and <code>Regex</code> 9153 - * (serialize using their <code>String</code> representation).</p> 9154 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9155 - */ 9156 - set(items: Record<string, unknown>): Promise<void>; 9157 - /** 9158 - * Removes one or more items from storage. 9159 - * 9160 - * @param keys A single key or a list of keys for items to remove. 9161 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9162 - */ 9163 - remove(keys: string | string[]): Promise<void>; 9164 - /** 9165 - * Removes all items from storage. 9166 - * 9167 - * @returns Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set). 9168 - */ 9169 - clear(): Promise<void>; 9170 - /** 9171 - * Fired when one or more items change. 9172 - * 9173 - * @param changes Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item. 9174 - */ 9175 - onChanged: Events.Event<(changes: StorageAreaWithUsageOnChangedChangesType) => void>; 9176 - } 9177 - /** 9178 - * Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item. 9179 - */ 9180 - interface StorageAreaOnChangedChangesType { 9181 - [s: string]: StorageChange; 9182 - } 9183 - /** 9184 - * Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item. 9185 - */ 9186 - interface StorageAreaWithUsageOnChangedChangesType { 9187 - [s: string]: StorageChange; 9188 - } 9189 - interface Static { 9190 - /** 9191 - * Fired when one or more items change. 9192 - * 9193 - * @param changes Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item. 9194 - * @param areaName The name of the storage area (<code>"sync"</code>, <code>"local"</code> or <code>"managed"</code>) 9195 - * the changes are for. 9196 - */ 9197 - onChanged: Events.Event<(changes: Record<string, StorageChange>, areaName: string) => void>; 9198 - /** 9199 - * Items in the <code>sync</code> storage area are synced by the browser. 9200 - */ 9201 - sync: StorageAreaWithUsage; 9202 - /** 9203 - * Items in the <code>local</code> storage area are local to each machine. 9204 - */ 9205 - local: StorageArea; 9206 - /** 9207 - * Items in the <code>managed</code> storage area are set by administrators or native applications, 9208 - * and are read-only for the extension; trying to modify this namespace results in an error. 9209 - */ 9210 - managed: StorageArea; 9211 - /** 9212 - * Items in the <code>session</code> storage area are kept in memory, and only until the either browser or extension is 9213 - * closed or reloaded. 9214 - */ 9215 - session: StorageAreaWithUsage; 9216 - } 9217 - } 9218 - /** 9219 - * Namespace: browser.tabGroups 9220 - */ 9221 - namespace TabGroups { 9222 - /** 9223 - * The group's color, using 'grey' spelling for compatibility with Chromium. 9224 - */ 9225 - type Color = "blue" | "cyan" | "grey" | "green" | "orange" | "pink" | "purple" | "red" | "yellow"; 9226 - /** 9227 - * State of a tab group inside of an open window. 9228 - */ 9229 - interface TabGroup { 9230 - /** 9231 - * Whether the tab group is collapsed or expanded in the tab strip. 9232 - */ 9233 - collapsed: boolean; 9234 - /** 9235 - * User-selected color name for the tab group's label/icons. 9236 - */ 9237 - color: Color; 9238 - /** 9239 - * Unique ID of the tab group. 9240 - */ 9241 - id: number; 9242 - /** 9243 - * User-defined name of the tab group. 9244 - * Optional. 9245 - */ 9246 - title?: string; 9247 - /** 9248 - * Window that the tab group is in. 9249 - */ 9250 - windowId: number; 9251 - } 9252 - interface MoveMovePropertiesType { 9253 - index: number; 9254 - /** 9255 - * Optional. 9256 - */ 9257 - windowId?: number; 9258 - } 9259 - interface QueryQueryInfoType { 9260 - /** 9261 - * Optional. 9262 - */ 9263 - collapsed?: boolean; 9264 - /** 9265 - * Optional. 9266 - */ 9267 - color?: Color; 9268 - /** 9269 - * Optional. 9270 - */ 9271 - title?: string; 9272 - /** 9273 - * Optional. 9274 - */ 9275 - windowId?: number; 9276 - } 9277 - interface UpdateUpdatePropertiesType { 9278 - /** 9279 - * Optional. 9280 - */ 9281 - collapsed?: boolean; 9282 - /** 9283 - * Optional. 9284 - */ 9285 - color?: Color; 9286 - /** 9287 - * Optional. 9288 - */ 9289 - title?: string; 9290 - } 9291 - interface OnRemovedRemoveInfoType { 9292 - /** 9293 - * True when the tab group is being closed because its window is being closed. 9294 - */ 9295 - isWindowClosing: boolean; 9296 - } 9297 - interface Static { 9298 - /** 9299 - * Retrieves details about the specified group. 9300 - */ 9301 - get(groupId: number): Promise<TabGroup>; 9302 - /** 9303 - * Move a group within, or to another window. 9304 - */ 9305 - move(groupId: number, moveProperties: MoveMovePropertiesType): Promise<TabGroup>; 9306 - /** 9307 - * Return all grups, or find groups with specified properties. 9308 - */ 9309 - query(queryInfo: QueryQueryInfoType): Promise<TabGroup[]>; 9310 - /** 9311 - * Modifies state of a specified group. 9312 - */ 9313 - update(groupId: number, updateProperties: UpdateUpdatePropertiesType): Promise<TabGroup>; 9314 - /** 9315 - * Fired when a tab group is created. 9316 - */ 9317 - onCreated: Events.Event<(group: TabGroup) => void>; 9318 - /** 9319 - * Fired when a tab group is moved, within a window or to another window. 9320 - */ 9321 - onMoved: Events.Event<(group: TabGroup) => void>; 9322 - /** 9323 - * Fired when a tab group is removed. 9324 - */ 9325 - onRemoved: Events.Event<(group: TabGroup, removeInfo: OnRemovedRemoveInfoType) => void>; 9326 - /** 9327 - * Fired when a tab group is updated. 9328 - */ 9329 - onUpdated: Events.Event<(group: TabGroup) => void>; 9330 - /** 9331 - * An ID that represents the absence of a group. 9332 - */ 9333 - TAB_GROUP_ID_NONE: -1; 9334 - } 9335 - } 9336 - /** 9337 - * Namespace: browser.tabs 9338 - */ 9339 - namespace Tabs { 9340 - /** 9341 - * An event that caused a muted state change. 9342 - * 9343 - * "user": A user input action has set/overridden the muted state. 9344 - * "capture": Tab capture started, forcing a muted state change. 9345 - * "extension": An extension, identified by the extensionId field, set the muted state. 9346 - */ 9347 - type MutedInfoReason = "user" | "capture" | "extension"; 9348 - /** 9349 - * Tab muted state and the reason for the last state change. 9350 - */ 9351 - interface MutedInfo { 9352 - /** 9353 - * Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). 9354 - * Equivalent to whether the muted audio indicator is showing. 9355 - */ 9356 - muted: boolean; 9357 - /** 9358 - * The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed. 9359 - * Optional. 9360 - */ 9361 - reason?: MutedInfoReason; 9362 - /** 9363 - * The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last 9364 - * changed. 9365 - * Optional. 9366 - */ 9367 - extensionId?: string; 9368 - } 9369 - /** 9370 - * Tab sharing state for screen, microphone and camera. 9371 - */ 9372 - interface SharingState { 9373 - /** 9374 - * If the tab is sharing the screen the value will be one of "Screen", "Window", or "Application", 9375 - * or undefined if not screen sharing. 9376 - * Optional. 9377 - */ 9378 - screen?: string; 9379 - /** 9380 - * True if the tab is using the camera. 9381 - */ 9382 - camera: boolean; 9383 - /** 9384 - * True if the tab is using the microphone. 9385 - */ 9386 - microphone: boolean; 9387 - } 9388 - interface Tab { 9389 - /** 9390 - * The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, 9391 - * for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present. 9392 - * Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows. 9393 - * Optional. 9394 - */ 9395 - id?: number; 9396 - /** 9397 - * The zero-based index of the tab within its window. 9398 - */ 9399 - index: number; 9400 - /** 9401 - * The ID of the window the tab is contained within. 9402 - * Optional. 9403 - */ 9404 - windowId?: number; 9405 - /** 9406 - * The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists. 9407 - * Optional. 9408 - */ 9409 - openerTabId?: number; 9410 - /** 9411 - * Whether the tab is highlighted. Works as an alias of active 9412 - */ 9413 - highlighted: boolean; 9414 - /** 9415 - * Whether the tab is active in its window. (Does not necessarily mean the window is focused.) 9416 - */ 9417 - active: boolean; 9418 - /** 9419 - * Whether the tab is pinned. 9420 - */ 9421 - pinned: boolean; 9422 - /** 9423 - * The last time the tab was accessed as the number of milliseconds since epoch. 9424 - * Optional. 9425 - */ 9426 - lastAccessed?: number; 9427 - /** 9428 - * Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). 9429 - * Equivalent to whether the speaker audio indicator is showing. 9430 - * Optional. 9431 - */ 9432 - audible?: boolean; 9433 - /** 9434 - * Whether the tab can be discarded automatically by the browser when resources are low. 9435 - * Optional. 9436 - */ 9437 - autoDiscardable?: boolean; 9438 - /** 9439 - * Current tab muted state and the reason for the last state change. 9440 - * Optional. 9441 - */ 9442 - mutedInfo?: MutedInfo; 9443 - /** 9444 - * The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>"tabs"</code> 9445 - * permission. 9446 - * Optional. 9447 - */ 9448 - url?: string; 9449 - /** 9450 - * The title of the tab. This property is only present if the extension's manifest includes the <code>"tabs"</code> 9451 - * permission. 9452 - * Optional. 9453 - */ 9454 - title?: string; 9455 - /** 9456 - * The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>"tabs"</code> 9457 - * permission. It may also be an empty string if the tab is loading. 9458 - * Optional. 9459 - */ 9460 - favIconUrl?: string; 9461 - /** 9462 - * Either <em>loading</em> or <em>complete</em>. 9463 - * Optional. 9464 - */ 9465 - status?: string; 9466 - /** 9467 - * True while the tab is not loaded with content. 9468 - * Optional. 9469 - */ 9470 - discarded?: boolean; 9471 - /** 9472 - * Whether the tab is in an incognito window. 9473 - */ 9474 - incognito: boolean; 9475 - /** 9476 - * The width of the tab in pixels. 9477 - * Optional. 9478 - */ 9479 - width?: number; 9480 - /** 9481 - * The height of the tab in pixels. 9482 - * Optional. 9483 - */ 9484 - height?: number; 9485 - /** 9486 - * True if the tab is hidden. 9487 - * Optional. 9488 - */ 9489 - hidden?: boolean; 9490 - /** 9491 - * The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API. 9492 - * Optional. 9493 - */ 9494 - sessionId?: string; 9495 - /** 9496 - * The CookieStoreId used for the tab. 9497 - * Optional. 9498 - */ 9499 - cookieStoreId?: string; 9500 - /** 9501 - * Whether the document in the tab can be rendered in reader mode. 9502 - * Optional. 9503 - */ 9504 - isArticle?: boolean; 9505 - /** 9506 - * Whether the document in the tab is being rendered in reader mode. 9507 - * Optional. 9508 - */ 9509 - isInReaderMode?: boolean; 9510 - /** 9511 - * Current tab sharing state for screen, microphone and camera. 9512 - * Optional. 9513 - */ 9514 - sharingState?: SharingState; 9515 - /** 9516 - * Whether the tab is drawing attention. 9517 - * Optional. 9518 - */ 9519 - attention?: boolean; 9520 - /** 9521 - * The ID of this tab's successor, if any; $(ref:tabs.TAB_ID_NONE) otherwise. 9522 - * Optional. 9523 - */ 9524 - successorTabId?: number; 9525 - /** 9526 - * The ID of the group that the tab belongs to. 9527 - * Optional. 9528 - */ 9529 - groupId?: number; 9530 - /** 9531 - * The URL the tab is navigating to, before it has committed. This property is only present if the extension's manifest 9532 - * includes the "tabs" permission and there is a pending navigation. 9533 - * Optional. 9534 - */ 9535 - pendingUrl?: string; 9536 - } 9537 - /** 9538 - * Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to 9539 - * <code>automatic</code>. 9540 - * 9541 - * "automatic": Zoom changes are handled automatically by the browser. 9542 - * "manual": Overrides the automatic handling of zoom changes. The <code>onZoomChange</code> event will still be dispatched, 9543 - * and it is the responsibility of the extension to listen for this event and manually scale the page. 9544 - * This mode does not support <code>per-origin</code> zooming, and will thus ignore the <code>scope</code> 9545 - * zoom setting and assume <code>per-tab</code>. 9546 - * "disabled": Disables all zooming in the tab. The tab will revert to the default zoom level, 9547 - * and all attempted zoom changes will be ignored. 9548 - */ 9549 - type ZoomSettingsMode = "automatic" | "manual" | "disabled"; 9550 - /** 9551 - * Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code> 9552 - * per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise. 9553 - * 9554 - * "per-origin": Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin 9555 - * will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin, 9556 - * meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. 9557 - * The <code>per-origin</code> scope is only available in the <code>automatic</code> mode. 9558 - * "per-tab": Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this 9559 - * tab. Also, <code>per-tab</code> zoom changes are reset on navigation; navigating a tab will always load pages with their 9560 - * <code>per-origin</code> zoom factors. 9561 - */ 9562 - type ZoomSettingsScope = "per-origin" | "per-tab"; 9563 - /** 9564 - * Defines how zoom changes in a tab are handled and at what scope. 9565 - */ 9566 - interface ZoomSettings { 9567 - /** 9568 - * Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to 9569 - * <code>automatic</code>. 9570 - * Optional. 9571 - */ 9572 - mode?: ZoomSettingsMode; 9573 - /** 9574 - * Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code> 9575 - * per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise. 9576 - * Optional. 9577 - */ 9578 - scope?: ZoomSettingsScope; 9579 - /** 9580 - * Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings. 9581 - * Optional. 9582 - */ 9583 - defaultZoomFactor?: number; 9584 - } 9585 - /** 9586 - * Defines the page settings to be used when saving a page as a pdf file. 9587 - */ 9588 - interface PageSettings { 9589 - /** 9590 - * The name of the file. May include optional .pdf extension. 9591 - * Optional. 9592 - */ 9593 - toFileName?: string; 9594 - /** 9595 - * The page size unit: 0 = inches, 1 = millimeters. Default: 0. 9596 - * Optional. 9597 - */ 9598 - paperSizeUnit?: number; 9599 - /** 9600 - * The paper width in paper size units. Default: 8.5. 9601 - * Optional. 9602 - */ 9603 - paperWidth?: number; 9604 - /** 9605 - * The paper height in paper size units. Default: 11.0. 9606 - * Optional. 9607 - */ 9608 - paperHeight?: number; 9609 - /** 9610 - * The page content orientation: 0 = portrait, 1 = landscape. Default: 0. 9611 - * Optional. 9612 - */ 9613 - orientation?: number; 9614 - /** 9615 - * The page content scaling factor: 1.0 = 100% = normal size. Default: 1.0. 9616 - * Optional. 9617 - */ 9618 - scaling?: number; 9619 - /** 9620 - * Whether the page content should shrink to fit the page width (overrides scaling). Default: true. 9621 - * Optional. 9622 - */ 9623 - shrinkToFit?: boolean; 9624 - /** 9625 - * Whether the page background colors should be shown. Default: false. 9626 - * Optional. 9627 - */ 9628 - showBackgroundColors?: boolean; 9629 - /** 9630 - * Whether the page background images should be shown. Default: false. 9631 - * Optional. 9632 - */ 9633 - showBackgroundImages?: boolean; 9634 - /** 9635 - * The spacing between the left header/footer and the left edge of the paper (inches). Default: 0. 9636 - * Optional. 9637 - */ 9638 - edgeLeft?: number; 9639 - /** 9640 - * The spacing between the right header/footer and the right edge of the paper (inches). Default: 0. 9641 - * Optional. 9642 - */ 9643 - edgeRight?: number; 9644 - /** 9645 - * The spacing between the top of the headers and the top edge of the paper (inches). Default: 0 9646 - * Optional. 9647 - */ 9648 - edgeTop?: number; 9649 - /** 9650 - * The spacing between the bottom of the footers and the bottom edge of the paper (inches). Default: 0. 9651 - * Optional. 9652 - */ 9653 - edgeBottom?: number; 9654 - /** 9655 - * The margin between the page content and the left edge of the paper (inches). Default: 0.5. 9656 - * Optional. 9657 - */ 9658 - marginLeft?: number; 9659 - /** 9660 - * The margin between the page content and the right edge of the paper (inches). Default: 0.5. 9661 - * Optional. 9662 - */ 9663 - marginRight?: number; 9664 - /** 9665 - * The margin between the page content and the top edge of the paper (inches). Default: 0.5. 9666 - * Optional. 9667 - */ 9668 - marginTop?: number; 9669 - /** 9670 - * The margin between the page content and the bottom edge of the paper (inches). Default: 0.5. 9671 - * Optional. 9672 - */ 9673 - marginBottom?: number; 9674 - /** 9675 - * The text for the page's left header. Default: '&T'. 9676 - * Optional. 9677 - */ 9678 - headerLeft?: string; 9679 - /** 9680 - * The text for the page's center header. Default: ''. 9681 - * Optional. 9682 - */ 9683 - headerCenter?: string; 9684 - /** 9685 - * The text for the page's right header. Default: '&U'. 9686 - * Optional. 9687 - */ 9688 - headerRight?: string; 9689 - /** 9690 - * The text for the page's left footer. Default: '&PT'. 9691 - * Optional. 9692 - */ 9693 - footerLeft?: string; 9694 - /** 9695 - * The text for the page's center footer. Default: ''. 9696 - * Optional. 9697 - */ 9698 - footerCenter?: string; 9699 - /** 9700 - * The text for the page's right footer. Default: '&D'. 9701 - * Optional. 9702 - */ 9703 - footerRight?: string; 9704 - } 9705 - /** 9706 - * Whether the tabs have completed loading. 9707 - */ 9708 - type TabStatus = "loading" | "complete"; 9709 - /** 9710 - * The type of window. 9711 - */ 9712 - type WindowType = "normal" | "popup" | "panel" | "app" | "devtools"; 9713 - /** 9714 - * Event names supported in onUpdated. 9715 - */ 9716 - type UpdatePropertyName = "attention" | "audible" | "autoDiscardable" | "discarded" | "favIconUrl" | "groupId" | "hidden" | "isArticle" | "mutedInfo" | "pinned" | "sharingState" | "status" | "title" | "url"; 9717 - /** 9718 - * An object describing filters to apply to tabs.onUpdated events. 9719 - */ 9720 - interface UpdateFilter { 9721 - /** 9722 - * A list of URLs or URL patterns. Events that cannot match any of the URLs will be filtered out. 9723 - * Filtering with urls requires the <code>"tabs"</code> or <code>"activeTab"</code> permission. 9724 - * Optional. 9725 - */ 9726 - urls?: string[]; 9727 - /** 9728 - * A list of property names. Events that do not match any of the names will be filtered out. 9729 - * Optional. 9730 - */ 9731 - properties?: UpdatePropertyName[]; 9732 - /** 9733 - * Optional. 9734 - */ 9735 - tabId?: number; 9736 - /** 9737 - * Optional. 9738 - */ 9739 - windowId?: number; 9740 - } 9741 - interface ConnectConnectInfoType { 9742 - /** 9743 - * Will be passed into onConnect for content scripts that are listening for the connection event. 9744 - * Optional. 9745 - */ 9746 - name?: string; 9747 - /** 9748 - * Open a port to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab. 9749 - * Optional. 9750 - */ 9751 - frameId?: number; 9752 - } 9753 - interface SendMessageOptionsType { 9754 - /** 9755 - * Send a message to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> 9756 - * instead of all frames in the tab. 9757 - * Optional. 9758 - */ 9759 - frameId?: number; 9760 - } 9761 - interface CreateCreatePropertiesType { 9762 - /** 9763 - * The window to create the new tab in. Defaults to the $(topic:current-window)[current window]. 9764 - * Optional. 9765 - */ 9766 - windowId?: number; 9767 - /** 9768 - * The position the tab should take in the window. The provided value will be clamped to between zero and the number of 9769 - * tabs in the window. 9770 - * Optional. 9771 - */ 9772 - index?: number; 9773 - /** 9774 - * The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', 9775 - * not 'www.google.com'). Relative URLs will be relative to the current page within the extension. 9776 - * Defaults to the New Tab Page. 9777 - * Optional. 9778 - */ 9779 - url?: string; 9780 - /** 9781 - * Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see 9782 - * $(ref:windows.update)). Defaults to <var>true</var>. 9783 - * Optional. 9784 - */ 9785 - active?: boolean; 9786 - /** 9787 - * Whether the tab should be pinned. Defaults to <var>false</var> 9788 - * Optional. 9789 - */ 9790 - pinned?: boolean; 9791 - /** 9792 - * 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. 9793 - * Optional. 9794 - */ 9795 - openerTabId?: number; 9796 - /** 9797 - * The CookieStoreId for the tab that opened this tab. 9798 - * Optional. 9799 - */ 9800 - cookieStoreId?: string; 9801 - /** 9802 - * Whether the document in the tab should be opened in reader mode. 9803 - * Optional. 9804 - */ 9805 - openInReaderMode?: boolean; 9806 - /** 9807 - * Whether the tab is marked as 'discarded' when created. 9808 - * Optional. 9809 - */ 9810 - discarded?: boolean; 9811 - /** 9812 - * The title used for display if the tab is created in discarded mode. 9813 - * Optional. 9814 - */ 9815 - title?: string; 9816 - /** 9817 - * Whether the tab should be muted when created. 9818 - * Optional. 9819 - */ 9820 - muted?: boolean; 9821 - } 9822 - interface DuplicateDuplicatePropertiesType { 9823 - /** 9824 - * The position the new tab should take in the window. The provided value will be clamped to between zero and the number of 9825 - * tabs in the window. 9826 - * Optional. 9827 - */ 9828 - index?: number; 9829 - /** 9830 - * Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see 9831 - * $(ref:windows.update)). Defaults to <var>true</var>. 9832 - * Optional. 9833 - */ 9834 - active?: boolean; 9835 - } 9836 - interface QueryQueryInfoType { 9837 - /** 9838 - * Whether the tabs are active in their windows. 9839 - * Optional. 9840 - */ 9841 - active?: boolean; 9842 - /** 9843 - * Whether the tabs are drawing attention. 9844 - * Optional. 9845 - */ 9846 - attention?: boolean; 9847 - /** 9848 - * Whether the tabs are pinned. 9849 - * Optional. 9850 - */ 9851 - pinned?: boolean; 9852 - /** 9853 - * Whether the tabs are audible. 9854 - * Optional. 9855 - */ 9856 - audible?: boolean; 9857 - /** 9858 - * Whether the tabs can be discarded automatically by the browser when resources are low. 9859 - * Optional. 9860 - */ 9861 - autoDiscardable?: boolean; 9862 - /** 9863 - * Whether the tabs are muted. 9864 - * Optional. 9865 - */ 9866 - muted?: boolean; 9867 - /** 9868 - * Whether the tabs are highlighted. Works as an alias of active. 9869 - * Optional. 9870 - */ 9871 - highlighted?: boolean; 9872 - /** 9873 - * Whether the tabs are in the $(topic:current-window)[current window]. 9874 - * Optional. 9875 - */ 9876 - currentWindow?: boolean; 9877 - /** 9878 - * Whether the tabs are in the last focused window. 9879 - * Optional. 9880 - */ 9881 - lastFocusedWindow?: boolean; 9882 - /** 9883 - * Whether the tabs have completed loading. 9884 - * Optional. 9885 - */ 9886 - status?: TabStatus; 9887 - /** 9888 - * True while the tabs are not loaded with content. 9889 - * Optional. 9890 - */ 9891 - discarded?: boolean; 9892 - /** 9893 - * True while the tabs are hidden. 9894 - * Optional. 9895 - */ 9896 - hidden?: boolean; 9897 - /** 9898 - * Match page titles against a pattern. 9899 - * Optional. 9900 - */ 9901 - title?: string; 9902 - /** 9903 - * Match tabs against one or more $(topic:match_patterns)[URL patterns]. Note that fragment identifiers are not matched. 9904 - * Optional. 9905 - */ 9906 - url?: string | string[]; 9907 - /** 9908 - * The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the $(topic:current-window)[current window]. 9909 - * Optional. 9910 - */ 9911 - windowId?: number; 9912 - /** 9913 - * The type of window the tabs are in. 9914 - * Optional. 9915 - */ 9916 - windowType?: WindowType; 9917 - /** 9918 - * The position of the tabs within their windows. 9919 - * Optional. 9920 - */ 9921 - index?: number; 9922 - /** 9923 - * The CookieStoreId used for the tab. 9924 - * Optional. 9925 - */ 9926 - cookieStoreId?: string[] | string; 9927 - /** 9928 - * The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. 9929 - * Optional. 9930 - */ 9931 - openerTabId?: number; 9932 - /** 9933 - * The ID of the group that the tabs are in, or $(ref:tabGroups.TAB_GROUP_ID_NONE) (-1) for ungrouped tabs. 9934 - * Optional. 9935 - */ 9936 - groupId?: number; 9937 - /** 9938 - * True for any screen sharing, or a string to specify type of screen sharing. 9939 - * Optional. 9940 - */ 9941 - screen?: "Screen" | "Window" | "Application" | boolean; 9942 - /** 9943 - * True if the tab is using the camera. 9944 - * Optional. 9945 - */ 9946 - camera?: boolean; 9947 - /** 9948 - * True if the tab is using the microphone. 9949 - * Optional. 9950 - */ 9951 - microphone?: boolean; 9952 - } 9953 - interface HighlightHighlightInfoType { 9954 - /** 9955 - * The window that contains the tabs. 9956 - * Optional. 9957 - */ 9958 - windowId?: number; 9959 - /** 9960 - * If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs. 9961 - * Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code> 9962 - * favIconUrl</code> properties if the extension's manifest file includes the <code>"tabs"</code> permission. If false, 9963 - * the $(ref:windows.Window) won't have the <var>tabs</var> property. 9964 - * Optional. 9965 - */ 9966 - populate?: boolean; 9967 - /** 9968 - * One or more tab indices to highlight. 9969 - */ 9970 - tabs: number[] | number; 9971 - } 9972 - interface UpdateUpdatePropertiesType { 9973 - /** 9974 - * A URL to navigate the tab to. 9975 - * Optional. 9976 - */ 9977 - url?: string; 9978 - /** 9979 - * Whether the tab should be active. Does not affect whether the window is focused (see $(ref:windows.update)). 9980 - * Optional. 9981 - */ 9982 - active?: boolean; 9983 - /** 9984 - * Whether the tab should be discarded automatically by the browser when resources are low. 9985 - * Optional. 9986 - */ 9987 - autoDiscardable?: boolean; 9988 - /** 9989 - * Adds or removes the tab from the current selection. 9990 - * Optional. 9991 - */ 9992 - highlighted?: boolean; 9993 - /** 9994 - * Whether the tab should be pinned. 9995 - * Optional. 9996 - */ 9997 - pinned?: boolean; 9998 - /** 9999 - * Whether the tab should be muted. 10000 - * Optional. 10001 - */ 10002 - muted?: boolean; 10003 - /** 10004 - * The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. 10005 - * Optional. 10006 - */ 10007 - openerTabId?: number; 10008 - /** 10009 - * Whether the load should replace the current history entry for the tab. 10010 - * Optional. 10011 - */ 10012 - loadReplace?: boolean; 10013 - /** 10014 - * The ID of this tab's successor. If specified, the successor tab must be in the same window as this tab. 10015 - * Optional. 10016 - */ 10017 - successorTabId?: number; 10018 - } 10019 - interface MoveMovePropertiesType { 10020 - /** 10021 - * Defaults to the window the tab is currently in. 10022 - * Optional. 10023 - */ 10024 - windowId?: number; 10025 - /** 10026 - * The position to move the window to. -1 will place the tab at the end of the window. 10027 - */ 10028 - index: number; 10029 - } 10030 - interface ReloadReloadPropertiesType { 10031 - /** 10032 - * Whether using any local cache. Default is false. 10033 - * Optional. 10034 - */ 10035 - bypassCache?: boolean; 10036 - } 10037 - interface MoveInSuccessionOptionsType { 10038 - /** 10039 - * Whether to move the tabs before (false) or after (true) tabId in the succession. Defaults to false. 10040 - * Optional. 10041 - */ 10042 - append?: boolean; 10043 - /** 10044 - * Whether to link up the current predecessors or successor (depending on options.append) 10045 - * of tabId to the other side of the chain after it is prepended or appended. If true, 10046 - * one of the following happens: if options.append is false, the first tab in the array is set as the successor of any 10047 - * current predecessors of tabId; if options.append is true, the current successor of tabId is set as the successor of the 10048 - * last tab in the array. Defaults to false. 10049 - * Optional. 10050 - */ 10051 - insert?: boolean; 10052 - } 10053 - interface GroupOptionsType { 10054 - /** 10055 - * The tab ID or list of tab IDs to add to the specified group. 10056 - */ 10057 - tabIds: number | number[]; 10058 - /** 10059 - * The ID of the group to add the tabs to. If not specified, a new group will be created. 10060 - * Optional. 10061 - */ 10062 - groupId?: number; 10063 - /** 10064 - * Configurations for creating a group. Cannot be used if groupId is already specified. 10065 - * Optional. 10066 - */ 10067 - createProperties?: GroupOptionsTypeCreatePropertiesType; 10068 - } 10069 - /** 10070 - * Lists the changes to the state of the tab that was updated. 10071 - */ 10072 - interface OnUpdatedChangeInfoType { 10073 - /** 10074 - * The tab's new attention state. 10075 - * Optional. 10076 - */ 10077 - attention?: boolean; 10078 - /** 10079 - * The tab's new audible state. 10080 - * Optional. 10081 - */ 10082 - audible?: boolean; 10083 - /** 10084 - * The tab's new autoDiscardable state. 10085 - * Optional. 10086 - */ 10087 - autoDiscardable?: boolean; 10088 - /** 10089 - * True while the tab is not loaded with content. 10090 - * Optional. 10091 - */ 10092 - discarded?: boolean; 10093 - /** 10094 - * The tab's new favicon URL. This property is only present if the extension's manifest includes the <code>"tabs"</code> 10095 - * permission. 10096 - * Optional. 10097 - */ 10098 - favIconUrl?: string; 10099 - /** 10100 - * The tab's new hidden state. 10101 - * Optional. 10102 - */ 10103 - hidden?: boolean; 10104 - /** 10105 - * Whether the document in the tab can be rendered in reader mode. 10106 - * Optional. 10107 - */ 10108 - isArticle?: boolean; 10109 - /** 10110 - * The tab's new muted state and the reason for the change. 10111 - * Optional. 10112 - */ 10113 - mutedInfo?: MutedInfo; 10114 - /** 10115 - * The tab's new pinned state. 10116 - * Optional. 10117 - */ 10118 - pinned?: boolean; 10119 - /** 10120 - * The tab's new sharing state for screen, microphone and camera. 10121 - * Optional. 10122 - */ 10123 - sharingState?: SharingState; 10124 - /** 10125 - * The status of the tab. Can be either <em>loading</em> or <em>complete</em>. 10126 - * Optional. 10127 - */ 10128 - status?: string; 10129 - /** 10130 - * The title of the tab if it has changed. This property is only present if the extension's manifest includes the <code> 10131 - * "tabs"</code> permission. 10132 - * Optional. 10133 - */ 10134 - title?: string; 10135 - /** 10136 - * The tab's URL if it has changed. This property is only present if the extension's manifest includes the <code> 10137 - * "tabs"</code> permission. 10138 - * Optional. 10139 - */ 10140 - url?: string; 10141 - } 10142 - interface OnMovedMoveInfoType { 10143 - windowId: number; 10144 - fromIndex: number; 10145 - toIndex: number; 10146 - } 10147 - interface OnActivatedActiveInfoType { 10148 - /** 10149 - * The ID of the tab that has become active. 10150 - */ 10151 - tabId: number; 10152 - /** 10153 - * The ID of the tab that was previously active, if that tab is still open. 10154 - * Optional. 10155 - */ 10156 - previousTabId?: number; 10157 - /** 10158 - * The ID of the window the active tab changed inside of. 10159 - */ 10160 - windowId: number; 10161 - } 10162 - interface OnHighlightedHighlightInfoType { 10163 - /** 10164 - * The window whose tabs changed. 10165 - */ 10166 - windowId: number; 10167 - /** 10168 - * All highlighted tabs in the window. 10169 - */ 10170 - tabIds: number[]; 10171 - } 10172 - interface OnDetachedDetachInfoType { 10173 - oldWindowId: number; 10174 - oldPosition: number; 10175 - } 10176 - interface OnAttachedAttachInfoType { 10177 - newWindowId: number; 10178 - newPosition: number; 10179 - } 10180 - interface OnRemovedRemoveInfoType { 10181 - /** 10182 - * The window whose tab is closed. 10183 - */ 10184 - windowId: number; 10185 - /** 10186 - * True when the tab is being closed because its window is being closed. 10187 - */ 10188 - isWindowClosing: boolean; 10189 - } 10190 - interface OnZoomChangeZoomChangeInfoType { 10191 - tabId: number; 10192 - oldZoomFactor: number; 10193 - newZoomFactor: number; 10194 - zoomSettings: ZoomSettings; 10195 - } 10196 - /** 10197 - * Configurations for creating a group. Cannot be used if groupId is already specified. 10198 - */ 10199 - interface GroupOptionsTypeCreatePropertiesType { 10200 - /** 10201 - * The window of the new group. Defaults to the current window. 10202 - * Optional. 10203 - */ 10204 - windowId?: number; 10205 - } 10206 - /** 10207 - * Fired when a tab is updated. 10208 - */ 10209 - interface OnUpdatedEvent extends Events.Event<(tabId: number, changeInfo: OnUpdatedChangeInfoType, tab: Tab) => void> { 10210 - /** 10211 - * Registers an event listener <em>callback</em> to an event. 10212 - * 10213 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 10214 - * @param filter Optional. A set of filters that restricts the events that will be sent to this listener. 10215 - */ 10216 - addListener(callback: (tabId: number, changeInfo: OnUpdatedChangeInfoType, tab: Tab) => void, filter?: UpdateFilter): void; 10217 - } 10218 - interface Static { 10219 - /** 10220 - * Retrieves details about the specified tab. 10221 - */ 10222 - get(tabId: number): Promise<Tab>; 10223 - /** 10224 - * Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a 10225 - * background page or popup view). 10226 - */ 10227 - getCurrent(): Promise<Tab>; 10228 - /** 10229 - * Connects to the content script(s) in the specified tab. The $(ref:runtime.onConnect) 10230 - * event is fired in each content script running in the specified tab for the current extension. For more details, 10231 - * see $(topic:messaging)[Content Script Messaging]. 10232 - * 10233 - * @param connectInfo Optional. 10234 - * @returns A port that can be used to communicate with the content scripts running in the specified tab. 10235 - * The port's $(ref:runtime.Port) event is fired if the tab closes or does not exist. 10236 - */ 10237 - connect(tabId: number, connectInfo?: ConnectConnectInfoType): Browser.Runtime.Port; 10238 - /** 10239 - * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response 10240 - * is sent back. The $(ref:runtime.onMessage) event is fired in each content script running in the specified tab for the 10241 - * current extension. 10242 - * 10243 - * @param options Optional. 10244 - */ 10245 - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics 10246 - sendMessage<TMessage = unknown, TResponse = unknown>(tabId: number, message: TMessage, options?: SendMessageOptionsType): Promise<TResponse>; 10247 - /** 10248 - * Creates a new tab. 10249 - */ 10250 - create(createProperties: CreateCreatePropertiesType): Promise<Tab>; 10251 - /** 10252 - * Duplicates a tab. 10253 - * 10254 - * @param tabId The ID of the tab which is to be duplicated. 10255 - * @param duplicateProperties Optional. 10256 - */ 10257 - duplicate(tabId: number, duplicateProperties?: DuplicateDuplicatePropertiesType): Promise<Tab>; 10258 - /** 10259 - * Gets all tabs that have the specified properties, or all tabs if no properties are specified. 10260 - */ 10261 - query(queryInfo: QueryQueryInfoType): Promise<Tab[]>; 10262 - /** 10263 - * Highlights the given tabs. 10264 - */ 10265 - highlight(highlightInfo: HighlightHighlightInfoType): Promise<Browser.Windows.Window>; 10266 - /** 10267 - * Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified. 10268 - * 10269 - * @param tabId Optional. Defaults to the selected tab of the $(topic:current-window)[current window]. 10270 - */ 10271 - update(tabId: number | undefined, updateProperties: UpdateUpdatePropertiesType): Promise<Tab>; 10272 - /** 10273 - * Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified. 10274 - */ 10275 - update(updateProperties: UpdateUpdatePropertiesType): Promise<Tab>; 10276 - /** 10277 - * 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 10278 - * from normal (window.type === "normal") windows. 10279 - * 10280 - * @param tabIds The tab or list of tabs to move. 10281 - */ 10282 - move(tabIds: number | number[], moveProperties: MoveMovePropertiesType): Promise<Tab | Tab[]>; 10283 - /** 10284 - * Reload a tab. 10285 - * 10286 - * @param tabId Optional. The ID of the tab to reload; defaults to the selected tab of the current window. 10287 - * @param reloadProperties Optional. 10288 - */ 10289 - reload(tabId?: number, reloadProperties?: ReloadReloadPropertiesType): Promise<void>; 10290 - /** 10291 - * Warm up a tab 10292 - * 10293 - * @param tabId The ID of the tab to warm up. 10294 - */ 10295 - warmup(tabId: number): Promise<void>; 10296 - /** 10297 - * Closes one or more tabs. 10298 - * 10299 - * @param tabIds The tab or list of tabs to close. 10300 - */ 10301 - remove(tabIds: number | number[]): Promise<void>; 10302 - /** 10303 - * discards one or more tabs. 10304 - * 10305 - * @param tabIds The tab or list of tabs to discard. 10306 - */ 10307 - discard(tabIds: number | number[]): Promise<void>; 10308 - /** 10309 - * Detects the primary language of the content in a tab. 10310 - * 10311 - * @param tabId Optional. Defaults to the active tab of the $(topic:current-window)[current window]. 10312 - */ 10313 - detectLanguage(tabId?: number): Promise<string>; 10314 - /** 10315 - * Toggles reader mode for the document in the tab. 10316 - * 10317 - * @param tabId Optional. Defaults to the active tab of the $(topic:current-window)[current window]. 10318 - */ 10319 - toggleReaderMode(tabId?: number): Promise<void>; 10320 - /** 10321 - * Captures an area of a specified tab. You must have $(topic:declare_permissions)[&lt;all_urls&gt;] 10322 - * permission to use this method. 10323 - * 10324 - * @param tabId Optional. The tab to capture. Defaults to the active tab of the current window. 10325 - * @param options Optional. 10326 - */ 10327 - captureTab(tabId?: number, options?: Browser.ExtensionTypes.ImageDetails): Promise<string>; 10328 - /** 10329 - * Captures an area of the currently active tab in the specified window. You must have &lt;all_urls&gt; or activeTab 10330 - * permission to use this method. 10331 - * 10332 - * @param windowId Optional. The target window. Defaults to the $(topic:current-window)[current window]. 10333 - * @param options Optional. 10334 - */ 10335 - captureVisibleTab(windowId?: number, options?: Browser.ExtensionTypes.ImageDetails): Promise<string>; 10336 - /** 10337 - * Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection] 10338 - * section of the content scripts doc. 10339 - * 10340 - * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window. 10341 - * @param details Details of the script to run. 10342 - * @returns Called after all the JavaScript has been executed. 10343 - */ 10344 - executeScript(tabId: number | undefined, details: Browser.ExtensionTypes.InjectDetails): Promise<unknown[]>; 10345 - /** 10346 - * Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection] 10347 - * section of the content scripts doc. 10348 - * 10349 - * @param details Details of the script to run. 10350 - * @returns Called after all the JavaScript has been executed. 10351 - */ 10352 - executeScript(details: Browser.ExtensionTypes.InjectDetails): Promise<unknown[]>; 10353 - /** 10354 - * Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection] 10355 - * section of the content scripts doc. 10356 - * 10357 - * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. 10358 - * @param details Details of the CSS text to insert. 10359 - * @returns Called when all the CSS has been inserted. 10360 - */ 10361 - insertCSS(tabId: number | undefined, details: Browser.ExtensionTypes.InjectDetails): Promise<void>; 10362 - /** 10363 - * Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection] 10364 - * section of the content scripts doc. 10365 - * 10366 - * @param details Details of the CSS text to insert. 10367 - * @returns Called when all the CSS has been inserted. 10368 - */ 10369 - insertCSS(details: Browser.ExtensionTypes.InjectDetails): Promise<void>; 10370 - /** 10371 - * Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection] 10372 - * section of the content scripts doc. 10373 - * 10374 - * @param tabId Optional. The ID of the tab from which to remove the injected CSS; defaults to the active tab of the 10375 - * current window. 10376 - * @param details Details of the CSS text to remove. 10377 - * @returns Called when all the CSS has been removed. 10378 - */ 10379 - removeCSS(tabId: number | undefined, details: Browser.ExtensionTypes.InjectDetails): Promise<void>; 10380 - /** 10381 - * Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection] 10382 - * section of the content scripts doc. 10383 - * 10384 - * @param details Details of the CSS text to remove. 10385 - * @returns Called when all the CSS has been removed. 10386 - */ 10387 - removeCSS(details: Browser.ExtensionTypes.InjectDetails): Promise<void>; 10388 - /** 10389 - * Zooms a specified tab. 10390 - * 10391 - * @param tabId Optional. The ID of the tab to zoom; defaults to the active tab of the current window. 10392 - * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. 10393 - * Values greater than zero specify a (possibly non-default) zoom factor for the tab. 10394 - * @returns Called after the zoom factor has been changed. 10395 - */ 10396 - setZoom(tabId: number | undefined, zoomFactor: number): Promise<void>; 10397 - /** 10398 - * Zooms a specified tab. 10399 - * 10400 - * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. 10401 - * Values greater than zero specify a (possibly non-default) zoom factor for the tab. 10402 - * @returns Called after the zoom factor has been changed. 10403 - */ 10404 - setZoom(zoomFactor: number): Promise<void>; 10405 - /** 10406 - * Gets the current zoom factor of a specified tab. 10407 - * 10408 - * @param tabId Optional. The ID of the tab to get the current zoom factor from; defaults to the active tab of the current 10409 - * window. 10410 - * @returns Called with the tab's current zoom factor after it has been fetched. 10411 - */ 10412 - getZoom(tabId?: number): Promise<number>; 10413 - /** 10414 - * Sets the zoom settings for a specified tab, which define how zoom changes are handled. 10415 - * These settings are reset to defaults upon navigating the tab. 10416 - * 10417 - * @param tabId Optional. The ID of the tab to change the zoom settings for; defaults to the active tab of the current 10418 - * window. 10419 - * @param zoomSettings Defines how zoom changes are handled and at what scope. 10420 - * @returns Called after the zoom settings have been changed. 10421 - */ 10422 - setZoomSettings(tabId: number | undefined, zoomSettings: ZoomSettings): Promise<void>; 10423 - /** 10424 - * Sets the zoom settings for a specified tab, which define how zoom changes are handled. 10425 - * These settings are reset to defaults upon navigating the tab. 10426 - * 10427 - * @param zoomSettings Defines how zoom changes are handled and at what scope. 10428 - * @returns Called after the zoom settings have been changed. 10429 - */ 10430 - setZoomSettings(zoomSettings: ZoomSettings): Promise<void>; 10431 - /** 10432 - * Gets the current zoom settings of a specified tab. 10433 - * 10434 - * @param tabId Optional. The ID of the tab to get the current zoom settings from; defaults to the active tab of the 10435 - * current window. 10436 - * @returns Called with the tab's current zoom settings. 10437 - */ 10438 - getZoomSettings(tabId?: number): Promise<ZoomSettings>; 10439 - /** 10440 - * Prints page in active tab. 10441 - */ 10442 - print(): void; 10443 - /** 10444 - * Shows print preview for page in active tab. 10445 - * 10446 - * @returns Called after print preview entered. 10447 - */ 10448 - printPreview(): Promise<void>; 10449 - /** 10450 - * Saves page in active tab as a PDF file. 10451 - * 10452 - * @param pageSettings The page settings used to save the PDF file. 10453 - * @returns Called after save as dialog closed. 10454 - */ 10455 - saveAsPDF(pageSettings: PageSettings): Promise<string>; 10456 - /** 10457 - * Shows one or more tabs. 10458 - * 10459 - * @param tabIds The TAB ID or list of TAB IDs to show. 10460 - */ 10461 - show(tabIds: number | number[]): Promise<void>; 10462 - /** 10463 - * Hides one or more tabs. The <code>"tabHide"</code> permission is required to hide tabs. Not all tabs are hidable. 10464 - * Returns an array of hidden tabs. 10465 - * 10466 - * @param tabIds The TAB ID or list of TAB IDs to hide. 10467 - */ 10468 - hide(tabIds: number | number[]): Promise<number[]>; 10469 - /** 10470 - * Removes an array of tabs from their lines of succession and prepends or appends them in a chain to another tab. 10471 - * 10472 - * @param tabIds An array of tab IDs to move in the line of succession. For each tab in the array, 10473 - * the tab's current predecessors will have their successor set to the tab's current successor, 10474 - * and each tab will then be set to be the successor of the previous tab in the array. 10475 - * Any tabs not in the same window as the tab indicated by the second argument (or the first tab in the array, 10476 - * if no second argument) will be skipped. 10477 - * @param tabId Optional. The ID of a tab to set as the successor of the last tab in the array, or $(ref:tabs.TAB_ID_NONE) 10478 - * to leave the last tab without a successor. If options.append is true, then this tab is made the predecessor of the 10479 - * first tab in the array instead. 10480 - * @param options Optional. 10481 - */ 10482 - moveInSuccession(tabIds: number[], tabId?: number, options?: MoveInSuccessionOptionsType): void; 10483 - /** 10484 - * Navigate to next page in tab's history, if available 10485 - * 10486 - * @param tabId Optional. The ID of the tab to navigate forward. 10487 - */ 10488 - goForward(tabId?: number): Promise<void>; 10489 - /** 10490 - * Navigate to previous page in tab's history, if available. 10491 - * 10492 - * @param tabId Optional. The ID of the tab to navigate backward. 10493 - */ 10494 - goBack(tabId?: number): Promise<void>; 10495 - /** 10496 - * Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group. 10497 - */ 10498 - group(options: GroupOptionsType): Promise<number>; 10499 - /** 10500 - * Removes one or more tabs from their respective groups. If any groups become empty, they are deleted. 10501 - * 10502 - * @param tabIds The tab ID or list of tab IDs to remove from their respective groups. 10503 - */ 10504 - ungroup(tabIds: number | number[]): void; 10505 - /** 10506 - * Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, 10507 - * but you can listen to onUpdated events to be notified when a URL is set. 10508 - * 10509 - * @param tab Details of the tab that was created. 10510 - */ 10511 - onCreated: Events.Event<(tab: Tab) => void>; 10512 - /** 10513 - * Fired when a tab is updated. 10514 - */ 10515 - onUpdated: OnUpdatedEvent; 10516 - /** 10517 - * Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. 10518 - * Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved 10519 - * between windows. For that, see $(ref:tabs.onDetached). 10520 - */ 10521 - onMoved: Events.Event<(tabId: number, moveInfo: OnMovedMoveInfoType) => void>; 10522 - /** 10523 - * 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, 10524 - * but you can listen to onUpdated events to be notified when a URL is set. 10525 - */ 10526 - onActivated: Events.Event<(activeInfo: OnActivatedActiveInfoType) => void>; 10527 - /** 10528 - * Fired when the highlighted or selected tabs in a window changes. 10529 - */ 10530 - onHighlighted: Events.Event<(highlightInfo: OnHighlightedHighlightInfoType) => void>; 10531 - /** 10532 - * Fired when a tab is detached from a window, for example because it is being moved between windows. 10533 - */ 10534 - onDetached: Events.Event<(tabId: number, detachInfo: OnDetachedDetachInfoType) => void>; 10535 - /** 10536 - * Fired when a tab is attached to a window, for example because it was moved between windows. 10537 - */ 10538 - onAttached: Events.Event<(tabId: number, attachInfo: OnAttachedAttachInfoType) => void>; 10539 - /** 10540 - * Fired when a tab is closed. 10541 - */ 10542 - onRemoved: Events.Event<(tabId: number, removeInfo: OnRemovedRemoveInfoType) => void>; 10543 - /** 10544 - * Fired when a tab is replaced with another tab due to prerendering or instant. 10545 - */ 10546 - onReplaced: Events.Event<(addedTabId: number, removedTabId: number) => void>; 10547 - /** 10548 - * Fired when a tab is zoomed. 10549 - */ 10550 - onZoomChange: Events.Event<(ZoomChangeInfo: OnZoomChangeZoomChangeInfoType) => void>; 10551 - /** 10552 - * An ID which represents the absence of a browser tab. 10553 - */ 10554 - TAB_ID_NONE: -1; 10555 - } 10556 - } 10557 - /** 10558 - * Namespace: browser.theme 10559 - */ 10560 - namespace Theme { 10561 - /** 10562 - * Info provided in the onUpdated listener. 10563 - */ 10564 - interface ThemeUpdateInfo { 10565 - /** 10566 - * The new theme after update 10567 - */ 10568 - theme: ThemeUpdateInfoThemeType; 10569 - /** 10570 - * The id of the window the theme has been applied to 10571 - * Optional. 10572 - */ 10573 - windowId?: number; 10574 - } 10575 - /** 10576 - * The new theme after update 10577 - */ 10578 - interface ThemeUpdateInfoThemeType { 10579 - [s: string]: unknown; 10580 - } 10581 - interface Static { 10582 - /** 10583 - * Returns the current theme for the specified window or the last focused window. 10584 - * 10585 - * @param windowId Optional. The window for which we want the theme. 10586 - */ 10587 - getCurrent(windowId?: number): Promise<Manifest.ThemeType>; 10588 - /** 10589 - * Make complete updates to the theme. Resolves when the update has completed. 10590 - * 10591 - * @param windowId Optional. The id of the window to update. No id updates all windows. 10592 - * @param details The properties of the theme to update. 10593 - */ 10594 - update(windowId: number | undefined, details: Browser.Manifest.ThemeType): Promise<void>; 10595 - /** 10596 - * Make complete updates to the theme. Resolves when the update has completed. 10597 - * 10598 - * @param details The properties of the theme to update. 10599 - */ 10600 - update(details: Browser.Manifest.ThemeType): Promise<void>; 10601 - /** 10602 - * Removes the updates made to the theme. 10603 - * 10604 - * @param windowId Optional. The id of the window to reset. No id resets all windows. 10605 - */ 10606 - reset(windowId?: number): Promise<void>; 10607 - /** 10608 - * Fired when a new theme has been applied 10609 - * 10610 - * @param updateInfo Details of the theme update 10611 - */ 10612 - onUpdated: Events.Event<(updateInfo: ThemeUpdateInfo) => void>; 10613 - } 10614 - } 10615 - /** 10616 - * Namespace: browser.topSites 10617 - */ 10618 - namespace TopSites { 10619 - /** 10620 - * An object encapsulating a most visited URL, such as the URLs on the new tab page. 10621 - */ 10622 - interface MostVisitedURL { 10623 - /** 10624 - * The most visited URL. 10625 - */ 10626 - url: string; 10627 - /** 10628 - * The title of the page. 10629 - * Optional. 10630 - */ 10631 - title?: string; 10632 - /** 10633 - * Data URL for the favicon, if available. 10634 - * Optional. 10635 - */ 10636 - favicon?: string; 10637 - /** 10638 - * The entry type, either <code>url</code> for a normal page link, or <code>search</code> for a search shortcut. 10639 - * Optional. 10640 - */ 10641 - type?: MostVisitedURLTypeEnum; 10642 - } 10643 - interface GetOptionsType { 10644 - /** 10645 - * The number of top sites to return, defaults to the value used by Firefox 10646 - * Optional. 10647 - */ 10648 - limit?: number; 10649 - /** 10650 - * Limit the result to a single top site link per domain 10651 - * Optional. 10652 - */ 10653 - onePerDomain?: boolean; 10654 - /** 10655 - * Include sites that the user has blocked from appearing on the Firefox new tab. 10656 - * Optional. 10657 - */ 10658 - includeBlocked?: boolean; 10659 - /** 10660 - * Include sites favicon if available. 10661 - * Optional. 10662 - */ 10663 - includeFavicon?: boolean; 10664 - /** 10665 - * Include sites that the user has pinned on the Firefox new tab. 10666 - * Optional. 10667 - */ 10668 - includePinned?: boolean; 10669 - /** 10670 - * Include search shortcuts appearing on the Firefox new tab. 10671 - * Optional. 10672 - */ 10673 - includeSearchShortcuts?: boolean; 10674 - /** 10675 - * Return the sites that exactly appear on the user's new-tab page. When true, all other options are ignored except limit 10676 - * and includeFavicon. If the user disabled newtab Top Sites, the newtab parameter will be ignored. 10677 - * Optional. 10678 - */ 10679 - newtab?: boolean; 10680 - } 10681 - /** 10682 - * The entry type, either <code>url</code> for a normal page link, or <code>search</code> for a search shortcut. 10683 - */ 10684 - type MostVisitedURLTypeEnum = "url" | "search"; 10685 - interface Static { 10686 - /** 10687 - * Gets a list of top sites. 10688 - * 10689 - * @param options Optional. 10690 - */ 10691 - get(options?: GetOptionsType): Promise<MostVisitedURL[]>; 10692 - } 10693 - } 10694 - /** 10695 - * Namespace: browser.trial 10696 - */ 10697 - namespace Trial { 10698 - interface Static { 10699 - ml: Ml.Static; 10700 - } 10701 - } 10702 - /** 10703 - * Namespace: browser.types 10704 - */ 10705 - namespace Types { 10706 - /** 10707 - * The scope of the Setting. One of<ul><li><var>regular</var>: setting for the regular profile (which is inherited by the 10708 - * incognito profile if not overridden elsewhere),</li><li><var>regular_only</var>: setting for the regular profile only 10709 - * (not inherited by the incognito profile),</li><li><var>incognito_persistent</var>: setting for the incognito profile 10710 - * that survives browser restarts (overrides regular preferences),</li><li><var>incognito_session_only</var> 10711 - * : setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito 10712 - * session ends (overrides regular and incognito_persistent preferences).</li></ul> Only <var>regular</var> 10713 - * is supported by Firefox at this time. 10714 - */ 10715 - type SettingScope = "regular" | "regular_only" | "incognito_persistent" | "incognito_session_only"; 10716 - /** 10717 - * One of<ul><li><var>not_controllable</var>: cannot be controlled by any extension</li><li><var> 10718 - * controlled_by_other_extensions</var>: controlled by extensions with higher precedence</li><li><var> 10719 - * controllable_by_this_extension</var>: can be controlled by this extension</li><li><var>controlled_by_this_extension</var> 10720 - * : controlled by this extension</li></ul> 10721 - */ 10722 - type LevelOfControl = "not_controllable" | "controlled_by_other_extensions" | "controllable_by_this_extension" | "controlled_by_this_extension"; 10723 - interface Setting { 10724 - /** 10725 - * Gets the value of a setting. 10726 - * 10727 - * @param details Which setting to consider. 10728 - */ 10729 - get(details: SettingGetDetailsType): Promise<SettingGetCallbackDetailsType>; 10730 - /** 10731 - * Sets the value of a setting. 10732 - * 10733 - * @param details Which setting to change. 10734 - * @returns Called at the completion of the set operation. 10735 - */ 10736 - set(details: SettingSetDetailsType): Promise<void>; 10737 - /** 10738 - * Clears the setting, restoring any default value. 10739 - * 10740 - * @param details Which setting to clear. 10741 - * @returns Called at the completion of the clear operation. 10742 - */ 10743 - clear(details: SettingClearDetailsType): Promise<void>; 10744 - /** 10745 - * Fired after the setting changes. 10746 - */ 10747 - onChange: Events.Event<(details: SettingOnChangeDetailsType) => void>; 10748 - } 10749 - interface SettingOnChangeDetailsType { 10750 - /** 10751 - * The value of the setting after the change. 10752 - */ 10753 - value: unknown; 10754 - /** 10755 - * The level of control of the setting. 10756 - */ 10757 - levelOfControl: Browser.Types.LevelOfControl; 10758 - /** 10759 - * Whether the value that has changed is specific to the incognito session.<br/>This property will <em>only</em> 10760 - * be present if the user has enabled the extension in incognito mode. 10761 - * Optional. 10762 - */ 10763 - incognitoSpecific?: boolean; 10764 - } 10765 - /** 10766 - * Which setting to consider. 10767 - */ 10768 - interface SettingGetDetailsType { 10769 - /** 10770 - * Whether to return the value that applies to the incognito session (default false). 10771 - * Optional. 10772 - */ 10773 - incognito?: boolean; 10774 - } 10775 - /** 10776 - * Details of the currently effective value. 10777 - */ 10778 - interface SettingGetCallbackDetailsType { 10779 - /** 10780 - * The value of the setting. 10781 - */ 10782 - value: unknown; 10783 - /** 10784 - * The level of control of the setting. 10785 - */ 10786 - levelOfControl: Browser.Types.LevelOfControl; 10787 - /** 10788 - * Whether the effective value is specific to the incognito session.<br/>This property will <em>only</em> 10789 - * be present if the <var>incognito</var> property in the <var>details</var> parameter of <code>get()</code> was true. 10790 - * Optional. 10791 - */ 10792 - incognitoSpecific?: boolean; 10793 - } 10794 - /** 10795 - * Which setting to change. 10796 - */ 10797 - interface SettingSetDetailsType { 10798 - /** 10799 - * The value of the setting. <br/>Note that every setting has a specific value type, which is described together with the 10800 - * setting. An extension should <em>not</em> set a value of a different type. 10801 - */ 10802 - value: unknown; 10803 - /** 10804 - * Where to set the setting (default: regular). 10805 - * Optional. 10806 - */ 10807 - scope?: Browser.Types.SettingScope; 10808 - } 10809 - /** 10810 - * Which setting to clear. 10811 - */ 10812 - interface SettingClearDetailsType { 10813 - /** 10814 - * Where to clear the setting (default: regular). 10815 - * Optional. 10816 - */ 10817 - scope?: Browser.Types.SettingScope; 10818 - } 10819 - interface Static { 10820 - [s: string]: unknown; 10821 - } 10822 - } 10823 - /** 10824 - * Namespace: browser.userScripts 10825 - */ 10826 - namespace UserScripts { 10827 - /** 10828 - * Details of a user script 10829 - */ 10830 - interface UserScriptOptions { 10831 - /** 10832 - * The list of JS files to inject 10833 - */ 10834 - js: Browser.ExtensionTypes.ExtensionFileOrCode[]; 10835 - /** 10836 - * An opaque user script metadata value 10837 - * Optional. 10838 - */ 10839 - scriptMetadata?: Browser.ExtensionTypes.PlainJSONValue; 10840 - matches: Browser.Manifest.MatchPattern[]; 10841 - /** 10842 - * Optional. 10843 - */ 10844 - excludeMatches?: Browser.Manifest.MatchPattern[]; 10845 - /** 10846 - * Optional. 10847 - */ 10848 - includeGlobs?: string[]; 10849 - /** 10850 - * Optional. 10851 - */ 10852 - excludeGlobs?: string[]; 10853 - /** 10854 - * If allFrames is <code>true</code>, implies that the JavaScript should be injected into all frames of current page. 10855 - * By default, it's <code>false</code> and is only injected into the top frame. 10856 - * Optional. 10857 - */ 10858 - allFrames?: boolean; 10859 - /** 10860 - * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has 10861 - * access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>. 10862 - * Optional. 10863 - */ 10864 - matchAboutBlank?: boolean; 10865 - /** 10866 - * The soonest that the JavaScript will be injected into the tab. Defaults to "document_idle". 10867 - * Optional. 10868 - */ 10869 - runAt?: Browser.ExtensionTypes.RunAt; 10870 - /** 10871 - * limit the set of matched tabs to those that belong to the given cookie store id 10872 - * Optional. 10873 - */ 10874 - cookieStoreId?: string[] | string; 10875 - } 10876 - /** 10877 - * An object that represents a user script registered programmatically 10878 - */ 10879 - interface RegisteredUserScript { 10880 - /** 10881 - * The ID of the user script specified in the API call. This property must not start with a '_' as it's reserved as a 10882 - * prefix for generated script IDs. 10883 - */ 10884 - id: string; 10885 - /** 10886 - * If allFrames is <code>true</code>, implies that the JavaScript should be injected into all frames of current page. 10887 - * By default, it's <code>false</code> and is only injected into the top frame. 10888 - * Optional. 10889 - */ 10890 - allFrames?: boolean; 10891 - /** 10892 - * The list of ScriptSource objects defining sources of scripts to be injected into matching pages. 10893 - */ 10894 - js: ScriptSource[]; 10895 - /** 10896 - * At least one of matches or includeGlobs should be non-empty. The script runs in documents whose URL match either pattern. 10897 - * Optional. 10898 - */ 10899 - matches?: Browser.Manifest.MatchPattern[]; 10900 - /** 10901 - * Optional. 10902 - */ 10903 - excludeMatches?: Browser.Manifest.MatchPattern[]; 10904 - /** 10905 - * At least one of matches or includeGlobs should be non-empty. The script runs in documents whose URL match either pattern. 10906 - * Optional. 10907 - */ 10908 - includeGlobs?: string[]; 10909 - /** 10910 - * Optional. 10911 - */ 10912 - excludeGlobs?: string[]; 10913 - /** 10914 - * The soonest that the JavaScript will be injected into the tab. Defaults to "document_idle". 10915 - * Optional. 10916 - */ 10917 - runAt?: Browser.ExtensionTypes.RunAt; 10918 - /** 10919 - * The JavaScript script for a script to execute within. Defaults to "USER_SCRIPT". 10920 - * Optional. 10921 - */ 10922 - world?: ExecutionWorld; 10923 - /** 10924 - * If specified, specifies a specific user script world ID to execute in. Only valid if `world` is omitted or is 10925 - * `USER_SCRIPT`. If `worldId` is omitted, the script will execute in the default user script world (""). 10926 - * Values with leading underscores (`_`) are reserved. The maximum length is 256. 10927 - * Optional. 10928 - */ 10929 - worldId?: string; 10930 - } 10931 - /** 10932 - * The JavaScript world for a script to execute within. <code>USER_SCRIPT</code> is the default execution environment of 10933 - * user scripts, <code>MAIN</code> is the web page's execution environment. 10934 - */ 10935 - type ExecutionWorld = "MAIN" | "USER_SCRIPT"; 10936 - /** 10937 - * Optional filter to use with getScripts() and unregister(). 10938 - */ 10939 - interface UserScriptFilter { 10940 - /** 10941 - * Optional. 10942 - */ 10943 - ids?: string[]; 10944 - } 10945 - /** 10946 - * Object with file xor code property. Equivalent to the ExtensionFileOrCode, except the file remains a relative URL. 10947 - */ 10948 - type ScriptSource = ScriptSourceC1Type | ScriptSourceC2Type; 10949 - /** 10950 - * The configuration of a USER_SCRIPT world. 10951 - */ 10952 - interface WorldProperties { 10953 - /** 10954 - * The identifier of the world. Values with leading underscores (`_`) are reserved. The maximum length is 256. 10955 - * Defaults to the default USER_SCRIPT world (""). 10956 - * Optional. 10957 - */ 10958 - worldId?: string; 10959 - /** 10960 - * The world's Content Security Policy. Defaults to the CSP of regular content scripts, 10961 - * which prohibits dynamic code execution such as eval. 10962 - * Optional. 10963 - */ 10964 - csp?: string; 10965 - /** 10966 - * Whether the runtime.sendMessage and runtime.connect methods are exposed. Defaults to not exposing these messaging APIs. 10967 - * Optional. 10968 - */ 10969 - messaging?: boolean; 10970 - } 10971 - /** 10972 - * An object that represents a user script registered programmatically 10973 - */ 10974 - interface RegisterCallbackLegacyRegisteredUserScriptType { 10975 - /** 10976 - * Unregister a user script registered programmatically 10977 - */ 10978 - unregister(): Promise<void>; 10979 - } 10980 - interface UpdateScriptsItemType extends Omit<RegisteredUserScript, "js"> { 10981 - /** 10982 - * Optional. 10983 - */ 10984 - js?: ScriptSource[]; 10985 - } 10986 - interface ScriptSourceC1Type { 10987 - /** 10988 - * The path of the JavaScript file to inject relative to the extension's root directory. 10989 - */ 10990 - file: string; 10991 - } 10992 - interface ScriptSourceC2Type { 10993 - code: string; 10994 - } 10995 - interface Static { 10996 - /** 10997 - * Register a user script programmatically given its $(ref:userScripts.UserScriptOptions), 10998 - * and resolves to an object with the unregister() function 10999 - */ 11000 - register(userScriptOptions: UserScriptOptions): Promise<RegisterCallbackLegacyRegisteredUserScriptType>; 11001 - /** 11002 - * Registers one or more user scripts for this extension. 11003 - * 11004 - * @param scripts List of user scripts to be registered. 11005 - */ 11006 - register(scripts: RegisteredUserScript[]): void; 11007 - /** 11008 - * Updates one or more user scripts for this extension. 11009 - * 11010 - * @param scripts List of user scripts to be updated. 11011 - */ 11012 - update(scripts: UpdateScriptsItemType[]): void; 11013 - /** 11014 - * Unregisters all dynamically-registered user scripts for this extension. 11015 - * 11016 - * @param filter Optional. If specified, this method unregisters only the user scripts that match it. 11017 - */ 11018 - unregister(filter?: UserScriptFilter): void; 11019 - /** 11020 - * Returns all dynamically-registered user scripts for this extension. 11021 - * 11022 - * @param filter Optional. If specified, this method returns only the user scripts that match it. 11023 - */ 11024 - getScripts(filter?: UserScriptFilter): Promise<RegisteredUserScript[]>; 11025 - /** 11026 - * Configures the environment for scripts running in a USER_SCRIPT world. 11027 - * 11028 - * @param properties The desired configuration for a USER_SCRIPT world. 11029 - */ 11030 - configureWorld(properties: WorldProperties): void; 11031 - /** 11032 - * Resets the configuration for a given world. That world will fall back to the default world's configuration. 11033 - * 11034 - * @param worldId Optional. The ID of the USER_SCRIPT world to reset. If omitted or empty, 11035 - * resets the default world's configuration. 11036 - */ 11037 - resetWorldConfiguration(worldId?: string): void; 11038 - /** 11039 - * Returns all registered USER_SCRIPT world configurations. 11040 - */ 11041 - getWorldConfigurations(): Promise<WorldProperties[]>; 11042 - } 11043 - } 11044 - /** 11045 - * Namespace: browser.webNavigation 11046 - */ 11047 - namespace WebNavigation { 11048 - /** 11049 - * Cause of the navigation. The same transition types as defined in the history API are used. 11050 - * These are the same transition types as defined in the $(topic:transition_types)[history API] except with <code> 11051 - * "start_page"</code> in place of <code>"auto_toplevel"</code> (for backwards compatibility). 11052 - */ 11053 - type TransitionType = "link" | "typed" | "auto_bookmark" | "auto_subframe" | "manual_subframe" | "generated" | "start_page" | "form_submit" | "reload" | "keyword" | "keyword_generated"; 11054 - type TransitionQualifier = "client_redirect" | "server_redirect" | "forward_back" | "from_address_bar"; 11055 - interface EventUrlFilters { 11056 - url: Browser.Events.UrlFilter[]; 11057 - } 11058 - /** 11059 - * Information about the frame to retrieve information about. 11060 - */ 11061 - interface GetFrameDetailsType { 11062 - /** 11063 - * The ID of the tab in which the frame is. 11064 - */ 11065 - tabId: number; 11066 - /** 11067 - * The ID of the process runs the renderer for this tab. 11068 - * Optional. 11069 - */ 11070 - processId?: number; 11071 - /** 11072 - * The ID of the frame in the given tab. 11073 - */ 11074 - frameId: number; 11075 - } 11076 - /** 11077 - * Information about the requested frame, null if the specified frame ID and/or tab ID are invalid. 11078 - */ 11079 - interface GetFrameCallbackDetailsType { 11080 - /** 11081 - * True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. 11082 - * Optional. 11083 - */ 11084 - errorOccurred?: boolean; 11085 - /** 11086 - * The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given 11087 - * tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. 11088 - */ 11089 - url: string; 11090 - /** 11091 - * The ID of the tab in which the frame is. 11092 - */ 11093 - tabId: number; 11094 - /** 11095 - * The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. 11096 - */ 11097 - frameId: number; 11098 - /** 11099 - * ID of frame that wraps the frame. Set to -1 of no parent frame exists. 11100 - */ 11101 - parentFrameId: number; 11102 - } 11103 - /** 11104 - * Information about the tab to retrieve all frames from. 11105 - */ 11106 - interface GetAllFramesDetailsType { 11107 - /** 11108 - * The ID of the tab. 11109 - */ 11110 - tabId: number; 11111 - } 11112 - interface GetAllFramesCallbackDetailsItemType { 11113 - /** 11114 - * True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. 11115 - * Optional. 11116 - */ 11117 - errorOccurred?: boolean; 11118 - /** 11119 - * The ID of the tab in which the frame is. 11120 - */ 11121 - tabId: number; 11122 - /** 11123 - * The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. 11124 - */ 11125 - frameId: number; 11126 - /** 11127 - * ID of frame that wraps the frame. Set to -1 of no parent frame exists. 11128 - */ 11129 - parentFrameId: number; 11130 - /** 11131 - * The URL currently associated with this frame. 11132 - */ 11133 - url: string; 11134 - } 11135 - interface OnBeforeNavigateDetailsType { 11136 - /** 11137 - * The ID of the tab in which the navigation is about to occur. 11138 - */ 11139 - tabId: number; 11140 - url: string; 11141 - /** 11142 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11143 - * Frame IDs are unique for a given tab and process. 11144 - */ 11145 - frameId: number; 11146 - /** 11147 - * ID of frame that wraps the frame. Set to -1 of no parent frame exists. 11148 - */ 11149 - parentFrameId: number; 11150 - /** 11151 - * The time when the browser was about to start the navigation, in milliseconds since the epoch. 11152 - */ 11153 - timeStamp: number; 11154 - } 11155 - interface OnCommittedDetailsType { 11156 - /** 11157 - * The ID of the tab in which the navigation occurs. 11158 - */ 11159 - tabId: number; 11160 - url: string; 11161 - /** 11162 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11163 - * Frame IDs are unique within a tab. 11164 - */ 11165 - frameId: number; 11166 - /** 11167 - * Cause of the navigation. 11168 - */ 11169 - transitionType: TransitionType; 11170 - /** 11171 - * A list of transition qualifiers. 11172 - */ 11173 - transitionQualifiers: TransitionQualifier[]; 11174 - /** 11175 - * The time when the navigation was committed, in milliseconds since the epoch. 11176 - */ 11177 - timeStamp: number; 11178 - } 11179 - interface OnDOMContentLoadedDetailsType { 11180 - /** 11181 - * The ID of the tab in which the navigation occurs. 11182 - */ 11183 - tabId: number; 11184 - url: string; 11185 - /** 11186 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11187 - * Frame IDs are unique within a tab. 11188 - */ 11189 - frameId: number; 11190 - /** 11191 - * The time when the page's DOM was fully constructed, in milliseconds since the epoch. 11192 - */ 11193 - timeStamp: number; 11194 - } 11195 - interface OnCompletedDetailsType { 11196 - /** 11197 - * The ID of the tab in which the navigation occurs. 11198 - */ 11199 - tabId: number; 11200 - url: string; 11201 - /** 11202 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11203 - * Frame IDs are unique within a tab. 11204 - */ 11205 - frameId: number; 11206 - /** 11207 - * The time when the document finished loading, in milliseconds since the epoch. 11208 - */ 11209 - timeStamp: number; 11210 - } 11211 - interface OnErrorOccurredDetailsType { 11212 - /** 11213 - * The ID of the tab in which the navigation occurs. 11214 - */ 11215 - tabId: number; 11216 - url: string; 11217 - /** 11218 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11219 - * Frame IDs are unique within a tab. 11220 - */ 11221 - frameId: number; 11222 - /** 11223 - * The time when the error occurred, in milliseconds since the epoch. 11224 - */ 11225 - timeStamp: number; 11226 - } 11227 - interface OnCreatedNavigationTargetDetailsType { 11228 - /** 11229 - * The ID of the tab in which the navigation is triggered. 11230 - */ 11231 - sourceTabId: number; 11232 - /** 11233 - * The ID of the process runs the renderer for the source tab. 11234 - */ 11235 - sourceProcessId: number; 11236 - /** 11237 - * The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame. 11238 - */ 11239 - sourceFrameId: number; 11240 - /** 11241 - * The URL to be opened in the new window. 11242 - */ 11243 - url: string; 11244 - /** 11245 - * The ID of the tab in which the url is opened 11246 - */ 11247 - tabId: number; 11248 - /** 11249 - * The time when the browser was about to create a new view, in milliseconds since the epoch. 11250 - */ 11251 - timeStamp: number; 11252 - } 11253 - interface OnReferenceFragmentUpdatedDetailsType { 11254 - /** 11255 - * The ID of the tab in which the navigation occurs. 11256 - */ 11257 - tabId: number; 11258 - url: string; 11259 - /** 11260 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11261 - * Frame IDs are unique within a tab. 11262 - */ 11263 - frameId: number; 11264 - /** 11265 - * Cause of the navigation. 11266 - */ 11267 - transitionType: TransitionType; 11268 - /** 11269 - * A list of transition qualifiers. 11270 - */ 11271 - transitionQualifiers: TransitionQualifier[]; 11272 - /** 11273 - * The time when the navigation was committed, in milliseconds since the epoch. 11274 - */ 11275 - timeStamp: number; 11276 - } 11277 - interface OnTabReplacedDetailsType { 11278 - /** 11279 - * The ID of the tab that was replaced. 11280 - */ 11281 - replacedTabId: number; 11282 - /** 11283 - * The ID of the tab that replaced the old tab. 11284 - */ 11285 - tabId: number; 11286 - /** 11287 - * The time when the replacement happened, in milliseconds since the epoch. 11288 - */ 11289 - timeStamp: number; 11290 - } 11291 - interface OnHistoryStateUpdatedDetailsType { 11292 - /** 11293 - * The ID of the tab in which the navigation occurs. 11294 - */ 11295 - tabId: number; 11296 - url: string; 11297 - /** 11298 - * 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. 11299 - * Frame IDs are unique within a tab. 11300 - */ 11301 - frameId: number; 11302 - /** 11303 - * Cause of the navigation. 11304 - */ 11305 - transitionType: TransitionType; 11306 - /** 11307 - * A list of transition qualifiers. 11308 - */ 11309 - transitionQualifiers: TransitionQualifier[]; 11310 - /** 11311 - * The time when the navigation was committed, in milliseconds since the epoch. 11312 - */ 11313 - timeStamp: number; 11314 - } 11315 - /** 11316 - * Fired when a navigation is about to occur. 11317 - */ 11318 - interface OnBeforeNavigateEvent extends Events.Event<(details: OnBeforeNavigateDetailsType) => void> { 11319 - /** 11320 - * Registers an event listener <em>callback</em> to an event. 11321 - * 11322 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11323 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11324 - * UrlFilter are ignored for this event. 11325 - */ 11326 - addListener(callback: (details: OnBeforeNavigateDetailsType) => void, filters?: EventUrlFilters): void; 11327 - } 11328 - /** 11329 - * Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes) 11330 - * might still be downloading, but at least part of the document has been received from the server and the browser has 11331 - * decided to switch to the new document. 11332 - */ 11333 - interface OnCommittedEvent extends Events.Event<(details: OnCommittedDetailsType) => void> { 11334 - /** 11335 - * Registers an event listener <em>callback</em> to an event. 11336 - * 11337 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11338 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11339 - * UrlFilter are ignored for this event. 11340 - */ 11341 - addListener(callback: (details: OnCommittedDetailsType) => void, filters?: EventUrlFilters): void; 11342 - } 11343 - /** 11344 - * Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading. 11345 - */ 11346 - interface OnDOMContentLoadedEvent extends Events.Event<(details: OnDOMContentLoadedDetailsType) => void> { 11347 - /** 11348 - * Registers an event listener <em>callback</em> to an event. 11349 - * 11350 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11351 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11352 - * UrlFilter are ignored for this event. 11353 - */ 11354 - addListener(callback: (details: OnDOMContentLoadedDetailsType) => void, filters?: EventUrlFilters): void; 11355 - } 11356 - /** 11357 - * Fired when a document, including the resources it refers to, is completely loaded and initialized. 11358 - */ 11359 - interface OnCompletedEvent extends Events.Event<(details: OnCompletedDetailsType) => void> { 11360 - /** 11361 - * Registers an event listener <em>callback</em> to an event. 11362 - * 11363 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11364 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11365 - * UrlFilter are ignored for this event. 11366 - */ 11367 - addListener(callback: (details: OnCompletedDetailsType) => void, filters?: EventUrlFilters): void; 11368 - } 11369 - /** 11370 - * Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred, 11371 - * or the user aborted the navigation. 11372 - */ 11373 - interface OnErrorOccurredEvent extends Events.Event<(details: OnErrorOccurredDetailsType) => void> { 11374 - /** 11375 - * Registers an event listener <em>callback</em> to an event. 11376 - * 11377 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11378 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11379 - * UrlFilter are ignored for this event. 11380 - */ 11381 - addListener(callback: (details: OnErrorOccurredDetailsType) => void, filters?: EventUrlFilters): void; 11382 - } 11383 - /** 11384 - * Fired when a new window, or a new tab in an existing window, is created to host a navigation. 11385 - */ 11386 - interface OnCreatedNavigationTargetEvent extends Events.Event<(details: OnCreatedNavigationTargetDetailsType) => void> { 11387 - /** 11388 - * Registers an event listener <em>callback</em> to an event. 11389 - * 11390 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11391 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11392 - * UrlFilter are ignored for this event. 11393 - */ 11394 - addListener(callback: (details: OnCreatedNavigationTargetDetailsType) => void, filters?: EventUrlFilters): void; 11395 - } 11396 - /** 11397 - * Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL. 11398 - */ 11399 - interface OnReferenceFragmentUpdatedEvent extends Events.Event<(details: OnReferenceFragmentUpdatedDetailsType) => void> { 11400 - /** 11401 - * Registers an event listener <em>callback</em> to an event. 11402 - * 11403 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11404 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11405 - * UrlFilter are ignored for this event. 11406 - */ 11407 - addListener(callback: (details: OnReferenceFragmentUpdatedDetailsType) => void, filters?: EventUrlFilters): void; 11408 - } 11409 - /** 11410 - * Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. 11411 - */ 11412 - interface OnHistoryStateUpdatedEvent extends Events.Event<(details: OnHistoryStateUpdatedDetailsType) => void> { 11413 - /** 11414 - * Registers an event listener <em>callback</em> to an event. 11415 - * 11416 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 11417 - * @param filters Optional. Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of 11418 - * UrlFilter are ignored for this event. 11419 - */ 11420 - addListener(callback: (details: OnHistoryStateUpdatedDetailsType) => void, filters?: EventUrlFilters): void; 11421 - } 11422 - interface Static { 11423 - /** 11424 - * Retrieves information about the given frame. A frame refers to an &lt;iframe&gt; or a &lt;frame&gt; of a web page and is 11425 - * identified by a tab ID and a frame ID. 11426 - * 11427 - * @param details Information about the frame to retrieve information about. 11428 - */ 11429 - getFrame(details: GetFrameDetailsType): Promise<GetFrameCallbackDetailsType | null>; 11430 - /** 11431 - * Retrieves information about all frames of a given tab. 11432 - * 11433 - * @param details Information about the tab to retrieve all frames from. 11434 - */ 11435 - getAllFrames(details: GetAllFramesDetailsType): Promise<GetAllFramesCallbackDetailsItemType[] | null>; 11436 - /** 11437 - * Fired when a navigation is about to occur. 11438 - */ 11439 - onBeforeNavigate: OnBeforeNavigateEvent; 11440 - /** 11441 - * Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes) 11442 - * might still be downloading, but at least part of the document has been received from the server and the browser has 11443 - * decided to switch to the new document. 11444 - */ 11445 - onCommitted: OnCommittedEvent; 11446 - /** 11447 - * Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading. 11448 - */ 11449 - onDOMContentLoaded: OnDOMContentLoadedEvent; 11450 - /** 11451 - * Fired when a document, including the resources it refers to, is completely loaded and initialized. 11452 - */ 11453 - onCompleted: OnCompletedEvent; 11454 - /** 11455 - * Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred, 11456 - * or the user aborted the navigation. 11457 - */ 11458 - onErrorOccurred: OnErrorOccurredEvent; 11459 - /** 11460 - * Fired when a new window, or a new tab in an existing window, is created to host a navigation. 11461 - */ 11462 - onCreatedNavigationTarget: OnCreatedNavigationTargetEvent; 11463 - /** 11464 - * Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL. 11465 - */ 11466 - onReferenceFragmentUpdated: OnReferenceFragmentUpdatedEvent; 11467 - /** 11468 - * Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab. 11469 - */ 11470 - onTabReplaced: Events.Event<(details: OnTabReplacedDetailsType) => void>; 11471 - /** 11472 - * Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. 11473 - */ 11474 - onHistoryStateUpdated: OnHistoryStateUpdatedEvent; 11475 - } 11476 - } 11477 - /** 11478 - * Namespace: browser.webRequest 11479 - */ 11480 - namespace WebRequest { 11481 - type ResourceType = "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "object" | "xmlhttprequest" | "xslt" | "ping" | "beacon" | "xml_dtd" | "font" | "media" | "websocket" | "csp_report" | "imageset" | "web_manifest" | "speculative" | "json" | "other"; 11482 - type OnBeforeRequestOptions = "blocking" | "requestBody" | "extraHeaders"; 11483 - type OnBeforeSendHeadersOptions = "requestHeaders" | "blocking" | "extraHeaders"; 11484 - type OnSendHeadersOptions = "requestHeaders" | "extraHeaders"; 11485 - type OnHeadersReceivedOptions = "blocking" | "responseHeaders" | "extraHeaders"; 11486 - type OnAuthRequiredOptions = "responseHeaders" | "blocking" | "asyncBlocking" | "extraHeaders"; 11487 - type OnResponseStartedOptions = "responseHeaders" | "extraHeaders"; 11488 - type OnBeforeRedirectOptions = "responseHeaders" | "extraHeaders"; 11489 - type OnCompletedOptions = "responseHeaders" | "extraHeaders"; 11490 - /** 11491 - * An object describing filters to apply to webRequest events. 11492 - */ 11493 - interface RequestFilter { 11494 - /** 11495 - * A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out. 11496 - */ 11497 - urls: string[]; 11498 - /** 11499 - * A list of request types. Requests that cannot match any of the types will be filtered out. 11500 - * Optional. 11501 - */ 11502 - types?: ResourceType[]; 11503 - /** 11504 - * Optional. 11505 - */ 11506 - tabId?: number; 11507 - /** 11508 - * Optional. 11509 - */ 11510 - windowId?: number; 11511 - /** 11512 - * If provided, requests that do not match the incognito state will be filtered out. 11513 - * Optional. 11514 - */ 11515 - incognito?: boolean; 11516 - } 11517 - /** 11518 - * An array of HTTP headers. Each header is represented as a dictionary containing the keys <code>name</code> 11519 - * and either <code>value</code> or <code>binaryValue</code>. 11520 - */ 11521 - type HttpHeaders = HttpHeadersItemType[]; 11522 - /** 11523 - * Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify 11524 - * network requests. 11525 - */ 11526 - interface BlockingResponse { 11527 - /** 11528 - * If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent. 11529 - * Optional. 11530 - */ 11531 - cancel?: boolean; 11532 - /** 11533 - * Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, 11534 - * the original request is prevented from being sent/completed and is instead redirected to the given URL. 11535 - * Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original 11536 - * request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, 11537 - * then the redirect will be issued using the GET method. 11538 - * Optional. 11539 - */ 11540 - redirectUrl?: string; 11541 - /** 11542 - * Only used as a response to the onBeforeRequest event. If set, the original request is prevented from being 11543 - * sent/completed and is instead upgraded to a secure request. If any extension returns <code>redirectUrl</code> 11544 - * during onBeforeRequest, <code>upgradeToSecure</code> will have no affect. 11545 - * Optional. 11546 - */ 11547 - upgradeToSecure?: boolean; 11548 - /** 11549 - * Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead. 11550 - * Optional. 11551 - */ 11552 - requestHeaders?: HttpHeaders; 11553 - /** 11554 - * Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these 11555 - * response headers instead. Only return <code>responseHeaders</code> if you really want to modify the headers in order to 11556 - * limit the number of conflicts (only one extension may modify <code>responseHeaders</code> for each request). 11557 - * Optional. 11558 - */ 11559 - responseHeaders?: HttpHeaders; 11560 - /** 11561 - * Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. 11562 - * Optional. 11563 - */ 11564 - authCredentials?: BlockingResponseAuthCredentialsType; 11565 - } 11566 - /** 11567 - * Contains the certificate properties of the request if it is a secure request. 11568 - */ 11569 - interface CertificateInfo { 11570 - subject: string; 11571 - issuer: string; 11572 - /** 11573 - * Contains start and end timestamps. 11574 - */ 11575 - validity: CertificateInfoValidityType; 11576 - fingerprint: CertificateInfoFingerprintType; 11577 - serialNumber: string; 11578 - isBuiltInRoot: boolean; 11579 - subjectPublicKeyInfoDigest: CertificateInfoSubjectPublicKeyInfoDigestType; 11580 - /** 11581 - * Optional. 11582 - */ 11583 - rawDER?: number[]; 11584 - } 11585 - type CertificateTransparencyStatus = "not_applicable" | "policy_compliant" | "policy_not_enough_scts" | "policy_not_diverse_scts"; 11586 - type TransportWeaknessReasons = "cipher"; 11587 - /** 11588 - * Contains the security properties of the request (ie. SSL/TLS information). 11589 - */ 11590 - interface SecurityInfo { 11591 - state: SecurityInfoStateEnum; 11592 - /** 11593 - * Error message if state is "broken" 11594 - * Optional. 11595 - */ 11596 - errorMessage?: string; 11597 - /** 11598 - * Protocol version if state is "secure" 11599 - * Optional. 11600 - */ 11601 - protocolVersion?: SecurityInfoProtocolVersionEnum; 11602 - /** 11603 - * The cipher suite used in this request if state is "secure". 11604 - * Optional. 11605 - */ 11606 - cipherSuite?: string; 11607 - /** 11608 - * The key exchange algorithm used in this request if state is "secure". 11609 - * Optional. 11610 - */ 11611 - keaGroupName?: string; 11612 - /** 11613 - * The length (in bits) of the secret key. 11614 - * Optional. 11615 - */ 11616 - secretKeyLength?: number; 11617 - /** 11618 - * The signature scheme used in this request if state is "secure". 11619 - * Optional. 11620 - */ 11621 - signatureSchemeName?: string; 11622 - /** 11623 - * Certificate data if state is "secure". Will only contain one entry unless <code>certificateChain</code> 11624 - * is passed as an option. 11625 - */ 11626 - certificates: CertificateInfo[]; 11627 - /** 11628 - * The type of certificate error that was overridden for this connection, if any. 11629 - * Optional. 11630 - */ 11631 - overridableErrorCategory?: SecurityInfoOverridableErrorCategoryEnum; 11632 - /** 11633 - * Optional. 11634 - */ 11635 - isExtendedValidation?: boolean; 11636 - /** 11637 - * Certificate transparency compliance per RFC 6962. See <code>https://www.certificate-transparency.org/what-is-ct</code> 11638 - * for more information. 11639 - * Optional. 11640 - */ 11641 - certificateTransparencyStatus?: CertificateTransparencyStatus; 11642 - /** 11643 - * True if host uses Strict Transport Security and state is "secure". 11644 - * Optional. 11645 - */ 11646 - hsts?: boolean; 11647 - /** 11648 - * True if host uses Public Key Pinning and state is "secure". 11649 - * Optional. 11650 - */ 11651 - hpkp?: string; 11652 - /** 11653 - * list of reasons that cause the request to be considered weak, if state is "weak" 11654 - * Optional. 11655 - */ 11656 - weaknessReasons?: TransportWeaknessReasons[]; 11657 - /** 11658 - * True if the TLS connection used Encrypted Client Hello. 11659 - * Optional. 11660 - */ 11661 - usedEch?: boolean; 11662 - /** 11663 - * True if the TLS connection used Delegated Credentials. 11664 - * Optional. 11665 - */ 11666 - usedDelegatedCredentials?: boolean; 11667 - /** 11668 - * True if the TLS connection made OCSP requests. 11669 - * Optional. 11670 - */ 11671 - usedOcsp?: boolean; 11672 - /** 11673 - * True if the TLS connection used a privacy-preserving DNS transport like DNS-over-HTTPS. 11674 - * Optional. 11675 - */ 11676 - usedPrivateDns?: boolean; 11677 - } 11678 - /** 11679 - * Contains data uploaded in a URL request. 11680 - */ 11681 - interface UploadData { 11682 - /** 11683 - * An ArrayBuffer with a copy of the data. 11684 - * Optional. 11685 - */ 11686 - bytes?: unknown; 11687 - /** 11688 - * A string with the file's path and name. 11689 - * Optional. 11690 - */ 11691 - file?: string; 11692 - } 11693 - /** 11694 - * Tracking flags that match our internal tracking classification 11695 - */ 11696 - type UrlClassificationFlags = "fingerprinting" | "fingerprinting_content" | "cryptomining" | "cryptomining_content" | "emailtracking" | "emailtracking_content" | "consentmanager" | "tracking" | "tracking_ad" | "tracking_analytics" | "tracking_social" | "tracking_content" | "any_basic_tracking" | "any_strict_tracking" | "any_social_tracking"; 11697 - /** 11698 - * If the request has been classified this is an array of $(ref:UrlClassificationFlags). 11699 - */ 11700 - type UrlClassificationParty = UrlClassificationFlags[]; 11701 - interface UrlClassification { 11702 - /** 11703 - * Classification flags if the request has been classified and it is first party. 11704 - */ 11705 - firstParty: UrlClassificationParty; 11706 - /** 11707 - * Classification flags if the request has been classified and it or its window hierarchy is third party. 11708 - */ 11709 - thirdParty: UrlClassificationParty; 11710 - } 11711 - type OnErrorOccurredOptions = "extraHeaders"; 11712 - /** 11713 - * A BlockingResponse or a Promise<BlockingResponse> 11714 - */ 11715 - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type 11716 - type BlockingResponseOrPromiseOrVoid = BlockingResponse | Promise<BlockingResponse> | void; 11717 - /** 11718 - * "uninitialized": The StreamFilter is not fully initialized. No methods may be called until a "start" event has been 11719 - * received. 11720 - * "transferringdata": The underlying channel is currently transferring data, which will be dispatched via "data" events. 11721 - * "finishedtransferringdata": The underlying channel has finished transferring data. Data may still be written via write() 11722 - * calls at this point. 11723 - * "suspended": Data transfer is currently suspended. It may be resumed by a call to resume(). 11724 - * Data may still be written via write() calls in this state. 11725 - * "closed": The channel has been closed by a call to close(). No further data wlil be delivered via "data" events, 11726 - * and no further data may be written via write() calls. 11727 - * "disconnected": The channel has been disconnected by a call to disconnect(). All further data will be delivered directly, 11728 - * without passing through the filter. No further events will be dispatched, and no further data may be written by write() 11729 - * calls. 11730 - * "failed": An error has occurred and the channel is disconnected. The `error`, property contains the details of the error. 11731 - */ 11732 - type StreamFilterStatus = "uninitialized" | "transferringdata" | "finishedtransferringdata" | "suspended" | "closed" | "disconnected" | "failed"; 11733 - /** 11734 - * An interface which allows an extension to intercept, and optionally modify, response data from an HTTP request. 11735 - */ 11736 - interface StreamFilter { 11737 - /** 11738 - * Returns the current status of the stream. 11739 - */ 11740 - status: StreamFilterStatus; 11741 - /** 11742 - * After an "error" event has been dispatched, this contains a message describing the error. 11743 - */ 11744 - error: string; 11745 - /** 11746 - * Creates a stream filter for the given add-on and the given extension ID. 11747 - */ 11748 - create(requestId: number, addonId: string): void; 11749 - /** 11750 - * Suspends processing of the request. After this is called, no further data will be delivered until the request is resumed. 11751 - */ 11752 - suspend(): void; 11753 - /** 11754 - * Resumes delivery of data for a suspended request. 11755 - */ 11756 - resume(): void; 11757 - /** 11758 - * Closes the request. After this is called, no more data may be written to the stream, 11759 - * and no further data will be delivered. This *must* be called after the consumer is finished writing data, 11760 - * unless disconnect() has already been called. 11761 - */ 11762 - close(): void; 11763 - /** 11764 - * Disconnects the stream filter from the request. After this is called, no further data will be delivered to the filter, 11765 - * and any unprocessed data will be written directly to the output stream. 11766 - */ 11767 - disconnect(): void; 11768 - /** 11769 - * Writes a chunk of data to the output stream. This may not be called before the "start" event has been received. 11770 - */ 11771 - write(data: ArrayBuffer | Uint8Array): void; 11772 - /** 11773 - * Dispatched with a StreamFilterDataEvent whenever incoming data is available on the stream. 11774 - * This data will not be delivered to the output stream unless it is explicitly written via a write() call. 11775 - */ 11776 - ondata?: (data: StreamFilterEventData) => void; 11777 - /** 11778 - * Dispatched when the stream is opened, and is about to begin delivering data. 11779 - */ 11780 - onstart?: (data: StreamFilterEventData) => void; 11781 - /** 11782 - * Dispatched when the stream has closed, and has no more data to deliver. The output stream remains open and writable 11783 - * until close() is called. 11784 - */ 11785 - onstop?: (data: StreamFilterEventData) => void; 11786 - /** 11787 - * Dispatched when an error has occurred. No further data may be read or written after this point. 11788 - */ 11789 - onerror?: (data: StreamFilterEventData) => void; 11790 - } 11791 - interface StreamFilterEventData { 11792 - /** 11793 - * Contains a chunk of data read from the input stream. 11794 - */ 11795 - data: ArrayBuffer; 11796 - } 11797 - interface GetSecurityInfoOptionsType { 11798 - /** 11799 - * Include the entire certificate chain. 11800 - * Optional. 11801 - */ 11802 - certificateChain?: boolean; 11803 - /** 11804 - * Include raw certificate data for processing by the extension. 11805 - * Optional. 11806 - */ 11807 - rawDER?: boolean; 11808 - } 11809 - interface OnBeforeRequestDetailsType { 11810 - /** 11811 - * The ID of the request. Request IDs are unique within a browser session. As a result, 11812 - * they could be used to relate different events of the same request. 11813 - */ 11814 - requestId: string; 11815 - url: string; 11816 - /** 11817 - * Standard HTTP method. 11818 - */ 11819 - method: string; 11820 - /** 11821 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 11822 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 11823 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 11824 - * Frame IDs are unique within a tab. 11825 - */ 11826 - frameId: number; 11827 - /** 11828 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 11829 - */ 11830 - parentFrameId: number; 11831 - /** 11832 - * True for private browsing requests. 11833 - * Optional. 11834 - */ 11835 - incognito?: boolean; 11836 - /** 11837 - * The cookie store ID of the contextual identity. 11838 - * Optional. 11839 - */ 11840 - cookieStoreId?: string; 11841 - /** 11842 - * URL of the resource that triggered this request. 11843 - * Optional. 11844 - */ 11845 - originUrl?: string; 11846 - /** 11847 - * URL of the page into which the requested resource will be loaded. 11848 - * Optional. 11849 - */ 11850 - documentUrl?: string; 11851 - /** 11852 - * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. 11853 - * Optional. 11854 - */ 11855 - requestBody?: OnBeforeRequestDetailsTypeRequestBodyType; 11856 - /** 11857 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 11858 - */ 11859 - tabId: number; 11860 - /** 11861 - * How the requested resource will be used. 11862 - */ 11863 - type: ResourceType; 11864 - /** 11865 - * The time when this signal is triggered, in milliseconds since the epoch. 11866 - */ 11867 - timeStamp: number; 11868 - /** 11869 - * Tracking classification if the request has been classified. 11870 - * Optional. 11871 - */ 11872 - urlClassification?: UrlClassification; 11873 - /** 11874 - * Indicates if this request and its content window hierarchy is third party. 11875 - */ 11876 - thirdParty: boolean; 11877 - /** 11878 - * URL of the resource that triggered this request (on chrome). 11879 - * Optional. 11880 - */ 11881 - initiator?: string; 11882 - } 11883 - interface OnBeforeSendHeadersDetailsType { 11884 - /** 11885 - * The ID of the request. Request IDs are unique within a browser session. As a result, 11886 - * they could be used to relate different events of the same request. 11887 - */ 11888 - requestId: string; 11889 - url: string; 11890 - /** 11891 - * Standard HTTP method. 11892 - */ 11893 - method: string; 11894 - /** 11895 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 11896 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 11897 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 11898 - * Frame IDs are unique within a tab. 11899 - */ 11900 - frameId: number; 11901 - /** 11902 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 11903 - */ 11904 - parentFrameId: number; 11905 - /** 11906 - * True for private browsing requests. 11907 - * Optional. 11908 - */ 11909 - incognito?: boolean; 11910 - /** 11911 - * The cookie store ID of the contextual identity. 11912 - * Optional. 11913 - */ 11914 - cookieStoreId?: string; 11915 - /** 11916 - * URL of the resource that triggered this request. 11917 - * Optional. 11918 - */ 11919 - originUrl?: string; 11920 - /** 11921 - * URL of the page into which the requested resource will be loaded. 11922 - * Optional. 11923 - */ 11924 - documentUrl?: string; 11925 - /** 11926 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 11927 - */ 11928 - tabId: number; 11929 - /** 11930 - * How the requested resource will be used. 11931 - */ 11932 - type: ResourceType; 11933 - /** 11934 - * The time when this signal is triggered, in milliseconds since the epoch. 11935 - */ 11936 - timeStamp: number; 11937 - /** 11938 - * The HTTP request headers that are going to be sent out with this request. 11939 - * Optional. 11940 - */ 11941 - requestHeaders?: HttpHeaders; 11942 - /** 11943 - * Tracking classification if the request has been classified. 11944 - * Optional. 11945 - */ 11946 - urlClassification?: UrlClassification; 11947 - /** 11948 - * Indicates if this request and its content window hierarchy is third party. 11949 - */ 11950 - thirdParty: boolean; 11951 - /** 11952 - * URL of the resource that triggered this request (on chrome). 11953 - * Optional. 11954 - */ 11955 - initiator?: string; 11956 - } 11957 - interface OnSendHeadersDetailsType { 11958 - /** 11959 - * The ID of the request. Request IDs are unique within a browser session. As a result, 11960 - * they could be used to relate different events of the same request. 11961 - */ 11962 - requestId: string; 11963 - url: string; 11964 - /** 11965 - * Standard HTTP method. 11966 - */ 11967 - method: string; 11968 - /** 11969 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 11970 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 11971 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 11972 - * Frame IDs are unique within a tab. 11973 - */ 11974 - frameId: number; 11975 - /** 11976 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 11977 - */ 11978 - parentFrameId: number; 11979 - /** 11980 - * True for private browsing requests. 11981 - * Optional. 11982 - */ 11983 - incognito?: boolean; 11984 - /** 11985 - * The cookie store ID of the contextual identity. 11986 - * Optional. 11987 - */ 11988 - cookieStoreId?: string; 11989 - /** 11990 - * URL of the resource that triggered this request. 11991 - * Optional. 11992 - */ 11993 - originUrl?: string; 11994 - /** 11995 - * URL of the page into which the requested resource will be loaded. 11996 - * Optional. 11997 - */ 11998 - documentUrl?: string; 11999 - /** 12000 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12001 - */ 12002 - tabId: number; 12003 - /** 12004 - * How the requested resource will be used. 12005 - */ 12006 - type: ResourceType; 12007 - /** 12008 - * The time when this signal is triggered, in milliseconds since the epoch. 12009 - */ 12010 - timeStamp: number; 12011 - /** 12012 - * The HTTP request headers that have been sent out with this request. 12013 - * Optional. 12014 - */ 12015 - requestHeaders?: HttpHeaders; 12016 - /** 12017 - * Tracking classification if the request has been classified. 12018 - * Optional. 12019 - */ 12020 - urlClassification?: UrlClassification; 12021 - /** 12022 - * Indicates if this request and its content window hierarchy is third party. 12023 - */ 12024 - thirdParty: boolean; 12025 - /** 12026 - * URL of the resource that triggered this request (on chrome). 12027 - * Optional. 12028 - */ 12029 - initiator?: string; 12030 - } 12031 - interface OnHeadersReceivedDetailsType { 12032 - /** 12033 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12034 - * they could be used to relate different events of the same request. 12035 - */ 12036 - requestId: string; 12037 - url: string; 12038 - /** 12039 - * Standard HTTP method. 12040 - */ 12041 - method: string; 12042 - /** 12043 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12044 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12045 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12046 - * Frame IDs are unique within a tab. 12047 - */ 12048 - frameId: number; 12049 - /** 12050 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12051 - */ 12052 - parentFrameId: number; 12053 - /** 12054 - * True for private browsing requests. 12055 - * Optional. 12056 - */ 12057 - incognito?: boolean; 12058 - /** 12059 - * The cookie store ID of the contextual identity. 12060 - * Optional. 12061 - */ 12062 - cookieStoreId?: string; 12063 - /** 12064 - * URL of the resource that triggered this request. 12065 - * Optional. 12066 - */ 12067 - originUrl?: string; 12068 - /** 12069 - * URL of the page into which the requested resource will be loaded. 12070 - * Optional. 12071 - */ 12072 - documentUrl?: string; 12073 - /** 12074 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12075 - */ 12076 - tabId: number; 12077 - /** 12078 - * How the requested resource will be used. 12079 - */ 12080 - type: ResourceType; 12081 - /** 12082 - * The time when this signal is triggered, in milliseconds since the epoch. 12083 - */ 12084 - timeStamp: number; 12085 - /** 12086 - * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., 12087 - * responses that lack a status line). 12088 - */ 12089 - statusLine: string; 12090 - /** 12091 - * The HTTP response headers that have been received with this response. 12092 - * Optional. 12093 - */ 12094 - responseHeaders?: HttpHeaders; 12095 - /** 12096 - * Standard HTTP status code returned by the server. 12097 - */ 12098 - statusCode: number; 12099 - /** 12100 - * Tracking classification if the request has been classified. 12101 - * Optional. 12102 - */ 12103 - urlClassification?: UrlClassification; 12104 - /** 12105 - * Indicates if this request and its content window hierarchy is third party. 12106 - */ 12107 - thirdParty: boolean; 12108 - /** 12109 - * URL of the resource that triggered this request (on chrome). 12110 - * Optional. 12111 - */ 12112 - initiator?: string; 12113 - } 12114 - interface OnAuthRequiredDetailsType { 12115 - /** 12116 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12117 - * they could be used to relate different events of the same request. 12118 - */ 12119 - requestId: string; 12120 - url: string; 12121 - /** 12122 - * Standard HTTP method. 12123 - */ 12124 - method: string; 12125 - /** 12126 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12127 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12128 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12129 - * Frame IDs are unique within a tab. 12130 - */ 12131 - frameId: number; 12132 - /** 12133 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12134 - */ 12135 - parentFrameId: number; 12136 - /** 12137 - * True for private browsing requests. 12138 - * Optional. 12139 - */ 12140 - incognito?: boolean; 12141 - /** 12142 - * The cookie store ID of the contextual identity. 12143 - * Optional. 12144 - */ 12145 - cookieStoreId?: string; 12146 - /** 12147 - * URL of the resource that triggered this request. 12148 - * Optional. 12149 - */ 12150 - originUrl?: string; 12151 - /** 12152 - * URL of the page into which the requested resource will be loaded. 12153 - * Optional. 12154 - */ 12155 - documentUrl?: string; 12156 - /** 12157 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12158 - */ 12159 - tabId: number; 12160 - /** 12161 - * How the requested resource will be used. 12162 - */ 12163 - type: ResourceType; 12164 - /** 12165 - * The time when this signal is triggered, in milliseconds since the epoch. 12166 - */ 12167 - timeStamp: number; 12168 - /** 12169 - * The authentication scheme, e.g. Basic or Digest. 12170 - */ 12171 - scheme: string; 12172 - /** 12173 - * The authentication realm provided by the server, if there is one. 12174 - * Optional. 12175 - */ 12176 - realm?: string; 12177 - /** 12178 - * The server requesting authentication. 12179 - */ 12180 - challenger: OnAuthRequiredDetailsTypeChallengerType; 12181 - /** 12182 - * True for Proxy-Authenticate, false for WWW-Authenticate. 12183 - */ 12184 - isProxy: boolean; 12185 - /** 12186 - * The HTTP response headers that were received along with this response. 12187 - * Optional. 12188 - */ 12189 - responseHeaders?: HttpHeaders; 12190 - /** 12191 - * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., 12192 - * responses that lack a status line) or an empty string if there are no headers. 12193 - */ 12194 - statusLine: string; 12195 - /** 12196 - * Standard HTTP status code returned by the server. 12197 - */ 12198 - statusCode: number; 12199 - /** 12200 - * Tracking classification if the request has been classified. 12201 - * Optional. 12202 - */ 12203 - urlClassification?: UrlClassification; 12204 - /** 12205 - * Indicates if this request and its content window hierarchy is third party. 12206 - */ 12207 - thirdParty: boolean; 12208 - /** 12209 - * URL of the resource that triggered this request (on chrome). 12210 - * Optional. 12211 - */ 12212 - initiator?: string; 12213 - } 12214 - interface OnResponseStartedDetailsType { 12215 - /** 12216 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12217 - * they could be used to relate different events of the same request. 12218 - */ 12219 - requestId: string; 12220 - url: string; 12221 - /** 12222 - * Standard HTTP method. 12223 - */ 12224 - method: string; 12225 - /** 12226 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12227 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12228 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12229 - * Frame IDs are unique within a tab. 12230 - */ 12231 - frameId: number; 12232 - /** 12233 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12234 - */ 12235 - parentFrameId: number; 12236 - /** 12237 - * True for private browsing requests. 12238 - * Optional. 12239 - */ 12240 - incognito?: boolean; 12241 - /** 12242 - * The cookie store ID of the contextual identity. 12243 - * Optional. 12244 - */ 12245 - cookieStoreId?: string; 12246 - /** 12247 - * URL of the resource that triggered this request. 12248 - * Optional. 12249 - */ 12250 - originUrl?: string; 12251 - /** 12252 - * URL of the page into which the requested resource will be loaded. 12253 - * Optional. 12254 - */ 12255 - documentUrl?: string; 12256 - /** 12257 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12258 - */ 12259 - tabId: number; 12260 - /** 12261 - * How the requested resource will be used. 12262 - */ 12263 - type: ResourceType; 12264 - /** 12265 - * The time when this signal is triggered, in milliseconds since the epoch. 12266 - */ 12267 - timeStamp: number; 12268 - /** 12269 - * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. 12270 - * Optional. 12271 - */ 12272 - ip?: string; 12273 - /** 12274 - * Indicates if this response was fetched from disk cache. 12275 - */ 12276 - fromCache: boolean; 12277 - /** 12278 - * Standard HTTP status code returned by the server. 12279 - */ 12280 - statusCode: number; 12281 - /** 12282 - * The HTTP response headers that were received along with this response. 12283 - * Optional. 12284 - */ 12285 - responseHeaders?: HttpHeaders; 12286 - /** 12287 - * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., 12288 - * responses that lack a status line) or an empty string if there are no headers. 12289 - */ 12290 - statusLine: string; 12291 - /** 12292 - * Tracking classification if the request has been classified. 12293 - * Optional. 12294 - */ 12295 - urlClassification?: UrlClassification; 12296 - /** 12297 - * Indicates if this request and its content window hierarchy is third party. 12298 - */ 12299 - thirdParty: boolean; 12300 - /** 12301 - * URL of the resource that triggered this request (on chrome). 12302 - * Optional. 12303 - */ 12304 - initiator?: string; 12305 - } 12306 - interface OnBeforeRedirectDetailsType { 12307 - /** 12308 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12309 - * they could be used to relate different events of the same request. 12310 - */ 12311 - requestId: string; 12312 - url: string; 12313 - /** 12314 - * Standard HTTP method. 12315 - */ 12316 - method: string; 12317 - /** 12318 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12319 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12320 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12321 - * Frame IDs are unique within a tab. 12322 - */ 12323 - frameId: number; 12324 - /** 12325 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12326 - */ 12327 - parentFrameId: number; 12328 - /** 12329 - * True for private browsing requests. 12330 - * Optional. 12331 - */ 12332 - incognito?: boolean; 12333 - /** 12334 - * The cookie store ID of the contextual identity. 12335 - * Optional. 12336 - */ 12337 - cookieStoreId?: string; 12338 - /** 12339 - * URL of the resource that triggered this request. 12340 - * Optional. 12341 - */ 12342 - originUrl?: string; 12343 - /** 12344 - * URL of the page into which the requested resource will be loaded. 12345 - * Optional. 12346 - */ 12347 - documentUrl?: string; 12348 - /** 12349 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12350 - */ 12351 - tabId: number; 12352 - /** 12353 - * How the requested resource will be used. 12354 - */ 12355 - type: ResourceType; 12356 - /** 12357 - * The time when this signal is triggered, in milliseconds since the epoch. 12358 - */ 12359 - timeStamp: number; 12360 - /** 12361 - * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. 12362 - * Optional. 12363 - */ 12364 - ip?: string; 12365 - /** 12366 - * Indicates if this response was fetched from disk cache. 12367 - */ 12368 - fromCache: boolean; 12369 - /** 12370 - * Standard HTTP status code returned by the server. 12371 - */ 12372 - statusCode: number; 12373 - /** 12374 - * The new URL. 12375 - */ 12376 - redirectUrl: string; 12377 - /** 12378 - * The HTTP response headers that were received along with this redirect. 12379 - * Optional. 12380 - */ 12381 - responseHeaders?: HttpHeaders; 12382 - /** 12383 - * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., 12384 - * responses that lack a status line) or an empty string if there are no headers. 12385 - */ 12386 - statusLine: string; 12387 - /** 12388 - * Tracking classification if the request has been classified. 12389 - * Optional. 12390 - */ 12391 - urlClassification?: UrlClassification; 12392 - /** 12393 - * Indicates if this request and its content window hierarchy is third party. 12394 - */ 12395 - thirdParty: boolean; 12396 - /** 12397 - * URL of the resource that triggered this request (on chrome). 12398 - * Optional. 12399 - */ 12400 - initiator?: string; 12401 - } 12402 - interface OnCompletedDetailsType { 12403 - /** 12404 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12405 - * they could be used to relate different events of the same request. 12406 - */ 12407 - requestId: string; 12408 - url: string; 12409 - /** 12410 - * Standard HTTP method. 12411 - */ 12412 - method: string; 12413 - /** 12414 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12415 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12416 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12417 - * Frame IDs are unique within a tab. 12418 - */ 12419 - frameId: number; 12420 - /** 12421 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12422 - */ 12423 - parentFrameId: number; 12424 - /** 12425 - * True for private browsing requests. 12426 - * Optional. 12427 - */ 12428 - incognito?: boolean; 12429 - /** 12430 - * The cookie store ID of the contextual identity. 12431 - * Optional. 12432 - */ 12433 - cookieStoreId?: string; 12434 - /** 12435 - * URL of the resource that triggered this request. 12436 - * Optional. 12437 - */ 12438 - originUrl?: string; 12439 - /** 12440 - * URL of the page into which the requested resource will be loaded. 12441 - * Optional. 12442 - */ 12443 - documentUrl?: string; 12444 - /** 12445 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12446 - */ 12447 - tabId: number; 12448 - /** 12449 - * How the requested resource will be used. 12450 - */ 12451 - type: ResourceType; 12452 - /** 12453 - * The time when this signal is triggered, in milliseconds since the epoch. 12454 - */ 12455 - timeStamp: number; 12456 - /** 12457 - * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. 12458 - * Optional. 12459 - */ 12460 - ip?: string; 12461 - /** 12462 - * Indicates if this response was fetched from disk cache. 12463 - */ 12464 - fromCache: boolean; 12465 - /** 12466 - * Standard HTTP status code returned by the server. 12467 - */ 12468 - statusCode: number; 12469 - /** 12470 - * The HTTP response headers that were received along with this response. 12471 - * Optional. 12472 - */ 12473 - responseHeaders?: HttpHeaders; 12474 - /** 12475 - * HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., 12476 - * responses that lack a status line) or an empty string if there are no headers. 12477 - */ 12478 - statusLine: string; 12479 - /** 12480 - * Tracking classification if the request has been classified. 12481 - */ 12482 - urlClassification: UrlClassification; 12483 - /** 12484 - * Indicates if this request and its content window hierarchy is third party. 12485 - */ 12486 - thirdParty: boolean; 12487 - /** 12488 - * For http requests, the bytes transferred in the request. Only available in onCompleted. 12489 - */ 12490 - requestSize: number; 12491 - /** 12492 - * For http requests, the bytes received in the request. Only available in onCompleted. 12493 - */ 12494 - responseSize: number; 12495 - /** 12496 - * URL of the resource that triggered this request (on chrome). 12497 - * Optional. 12498 - */ 12499 - initiator?: string; 12500 - } 12501 - interface OnErrorOccurredDetailsType { 12502 - /** 12503 - * The ID of the request. Request IDs are unique within a browser session. As a result, 12504 - * they could be used to relate different events of the same request. 12505 - */ 12506 - requestId: string; 12507 - url: string; 12508 - /** 12509 - * Standard HTTP method. 12510 - */ 12511 - method: string; 12512 - /** 12513 - * The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in 12514 - * which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> 12515 - * or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. 12516 - * Frame IDs are unique within a tab. 12517 - */ 12518 - frameId: number; 12519 - /** 12520 - * ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. 12521 - */ 12522 - parentFrameId: number; 12523 - /** 12524 - * True for private browsing requests. 12525 - * Optional. 12526 - */ 12527 - incognito?: boolean; 12528 - /** 12529 - * The cookie store ID of the contextual identity. 12530 - * Optional. 12531 - */ 12532 - cookieStoreId?: string; 12533 - /** 12534 - * URL of the resource that triggered this request. 12535 - * Optional. 12536 - */ 12537 - originUrl?: string; 12538 - /** 12539 - * URL of the page into which the requested resource will be loaded. 12540 - * Optional. 12541 - */ 12542 - documentUrl?: string; 12543 - /** 12544 - * The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. 12545 - */ 12546 - tabId: number; 12547 - /** 12548 - * How the requested resource will be used. 12549 - */ 12550 - type: ResourceType; 12551 - /** 12552 - * The time when this signal is triggered, in milliseconds since the epoch. 12553 - */ 12554 - timeStamp: number; 12555 - /** 12556 - * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. 12557 - * Optional. 12558 - */ 12559 - ip?: string; 12560 - /** 12561 - * Indicates if this response was fetched from disk cache. 12562 - */ 12563 - fromCache: boolean; 12564 - /** 12565 - * The error description. This string is <em>not</em> guaranteed to remain backwards compatible between releases. 12566 - * You must not parse and act based upon its content. 12567 - */ 12568 - error: string; 12569 - /** 12570 - * Tracking classification if the request has been classified. 12571 - * Optional. 12572 - */ 12573 - urlClassification?: UrlClassification; 12574 - /** 12575 - * Indicates if this request and its content window hierarchy is third party. 12576 - */ 12577 - thirdParty: boolean; 12578 - /** 12579 - * URL of the resource that triggered this request (on chrome). 12580 - * Optional. 12581 - */ 12582 - initiator?: string; 12583 - } 12584 - interface HttpHeadersItemType { 12585 - /** 12586 - * Name of the HTTP header. 12587 - */ 12588 - name: string; 12589 - /** 12590 - * Value of the HTTP header if it can be represented by UTF-8. 12591 - * Optional. 12592 - */ 12593 - value?: string; 12594 - /** 12595 - * Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255). 12596 - * Optional. 12597 - */ 12598 - binaryValue?: number[]; 12599 - } 12600 - /** 12601 - * Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. 12602 - */ 12603 - interface BlockingResponseAuthCredentialsType { 12604 - username: string; 12605 - password: string; 12606 - } 12607 - /** 12608 - * Contains start and end timestamps. 12609 - */ 12610 - interface CertificateInfoValidityType { 12611 - start: number; 12612 - end: number; 12613 - } 12614 - interface CertificateInfoFingerprintType { 12615 - sha1: string; 12616 - sha256: string; 12617 - } 12618 - interface CertificateInfoSubjectPublicKeyInfoDigestType { 12619 - sha256: string; 12620 - } 12621 - type SecurityInfoStateEnum = "insecure" | "weak" | "broken" | "secure"; 12622 - /** 12623 - * Protocol version if state is "secure" 12624 - */ 12625 - type SecurityInfoProtocolVersionEnum = "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; 12626 - /** 12627 - * The type of certificate error that was overridden for this connection, if any. 12628 - */ 12629 - type SecurityInfoOverridableErrorCategoryEnum = "trust_error" | "domain_mismatch" | "expired_or_not_yet_valid"; 12630 - /** 12631 - * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. 12632 - */ 12633 - interface OnBeforeRequestDetailsTypeRequestBodyType { 12634 - /** 12635 - * Errors when obtaining request body data. 12636 - * Optional. 12637 - */ 12638 - error?: string; 12639 - /** 12640 - * If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, 12641 - * encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each 12642 - * key contains the list of all values for that key. If the data is of another media type, or if it is malformed, 12643 - * the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}. 12644 - * Optional. 12645 - */ 12646 - formData?: Record<string, string>; 12647 - /** 12648 - * If the request method is PUT or POST, and the body is not already parsed in formData, 12649 - * then the unparsed request body elements are contained in this array. 12650 - * Optional. 12651 - */ 12652 - raw?: UploadData[]; 12653 - } 12654 - /** 12655 - * The server requesting authentication. 12656 - */ 12657 - interface OnAuthRequiredDetailsTypeChallengerType { 12658 - host: string; 12659 - port: number; 12660 - } 12661 - /** 12662 - * Fired when a request is about to occur. 12663 - */ 12664 - interface OnBeforeRequestEvent extends Events.Event<(details: OnBeforeRequestDetailsType) => BlockingResponseOrPromiseOrVoid> { 12665 - /** 12666 - * Registers an event listener <em>callback</em> to an event. 12667 - * 12668 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12669 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12670 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12671 - */ 12672 - addListener(callback: (details: OnBeforeRequestDetailsType) => BlockingResponseOrPromiseOrVoid, filter: RequestFilter, extraInfoSpec?: OnBeforeRequestOptions[]): void; 12673 - } 12674 - /** 12675 - * Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is 12676 - * made to the server, but before any HTTP data is sent. 12677 - */ 12678 - interface OnBeforeSendHeadersEvent extends Events.Event<(details: OnBeforeSendHeadersDetailsType) => BlockingResponseOrPromiseOrVoid> { 12679 - /** 12680 - * Registers an event listener <em>callback</em> to an event. 12681 - * 12682 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12683 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12684 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12685 - */ 12686 - addListener(callback: (details: OnBeforeSendHeadersDetailsType) => BlockingResponseOrPromiseOrVoid, filter: RequestFilter, extraInfoSpec?: OnBeforeSendHeadersOptions[]): void; 12687 - } 12688 - /** 12689 - * Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks 12690 - * are visible by the time onSendHeaders is fired). 12691 - */ 12692 - interface OnSendHeadersEvent extends Events.Event<(details: OnSendHeadersDetailsType) => void> { 12693 - /** 12694 - * Registers an event listener <em>callback</em> to an event. 12695 - * 12696 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12697 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12698 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12699 - */ 12700 - addListener(callback: (details: OnSendHeadersDetailsType) => void, filter: RequestFilter, extraInfoSpec?: OnSendHeadersOptions[]): void; 12701 - } 12702 - /** 12703 - * Fired when HTTP response headers of a request have been received. 12704 - */ 12705 - interface OnHeadersReceivedEvent extends Events.Event<(details: OnHeadersReceivedDetailsType) => BlockingResponseOrPromiseOrVoid> { 12706 - /** 12707 - * Registers an event listener <em>callback</em> to an event. 12708 - * 12709 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12710 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12711 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12712 - */ 12713 - addListener(callback: (details: OnHeadersReceivedDetailsType) => BlockingResponseOrPromiseOrVoid, filter: RequestFilter, extraInfoSpec?: OnHeadersReceivedOptions[]): void; 12714 - } 12715 - /** 12716 - * Fired when an authentication failure is received. The listener has three options: it can provide authentication 12717 - * credentials, it can cancel the request and display the error page, or it can take no action on the challenge. 12718 - * If bad user credentials are provided, this may be called multiple times for the same request. 12719 - */ 12720 - interface OnAuthRequiredEvent extends Events.Event<(details: OnAuthRequiredDetailsType) => BlockingResponseOrPromiseOrVoid> { 12721 - /** 12722 - * Registers an event listener <em>callback</em> to an event. 12723 - * 12724 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12725 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12726 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12727 - */ 12728 - addListener(callback: (details: OnAuthRequiredDetailsType) => BlockingResponseOrPromiseOrVoid, filter: RequestFilter, extraInfoSpec?: OnAuthRequiredOptions[]): void; 12729 - } 12730 - /** 12731 - * Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and 12732 - * response headers are available. 12733 - */ 12734 - interface OnResponseStartedEvent extends Events.Event<(details: OnResponseStartedDetailsType) => void> { 12735 - /** 12736 - * Registers an event listener <em>callback</em> to an event. 12737 - * 12738 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12739 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12740 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12741 - */ 12742 - addListener(callback: (details: OnResponseStartedDetailsType) => void, filter: RequestFilter, extraInfoSpec?: OnResponseStartedOptions[]): void; 12743 - } 12744 - /** 12745 - * Fired when a server-initiated redirect is about to occur. 12746 - */ 12747 - interface OnBeforeRedirectEvent extends Events.Event<(details: OnBeforeRedirectDetailsType) => void> { 12748 - /** 12749 - * Registers an event listener <em>callback</em> to an event. 12750 - * 12751 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12752 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12753 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12754 - */ 12755 - addListener(callback: (details: OnBeforeRedirectDetailsType) => void, filter: RequestFilter, extraInfoSpec?: OnBeforeRedirectOptions[]): void; 12756 - } 12757 - /** 12758 - * Fired when a request is completed. 12759 - */ 12760 - interface OnCompletedEvent extends Events.Event<(details: OnCompletedDetailsType) => void> { 12761 - /** 12762 - * Registers an event listener <em>callback</em> to an event. 12763 - * 12764 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12765 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12766 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12767 - */ 12768 - addListener(callback: (details: OnCompletedDetailsType) => void, filter: RequestFilter, extraInfoSpec?: OnCompletedOptions[]): void; 12769 - } 12770 - /** 12771 - * Fired when an error occurs. 12772 - */ 12773 - interface OnErrorOccurredEvent extends Events.Event<(details: OnErrorOccurredDetailsType) => void> { 12774 - /** 12775 - * Registers an event listener <em>callback</em> to an event. 12776 - * 12777 - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. 12778 - * @param filter A set of filters that restricts the events that will be sent to this listener. 12779 - * @param extraInfoSpec Optional. Array of extra information that should be passed to the listener function. 12780 - */ 12781 - addListener(callback: (details: OnErrorOccurredDetailsType) => void, filter: RequestFilter, extraInfoSpec?: OnErrorOccurredOptions[]): void; 12782 - } 12783 - interface Static { 12784 - /** 12785 - * Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. 12786 - * This function call is expensive. Don't call it often. 12787 - */ 12788 - handlerBehaviorChanged(): Promise<void>; 12789 - /** 12790 - * ... 12791 - */ 12792 - filterResponseData(requestId: string): StreamFilter; 12793 - /** 12794 - * Retrieves the security information for the request. Returns a promise that will resolve to a SecurityInfo object. 12795 - * 12796 - * @param options Optional. 12797 - */ 12798 - getSecurityInfo(requestId: string, options?: GetSecurityInfoOptionsType): Promise<SecurityInfo>; 12799 - /** 12800 - * Fired when a request is about to occur. 12801 - */ 12802 - onBeforeRequest: OnBeforeRequestEvent; 12803 - /** 12804 - * Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is 12805 - * made to the server, but before any HTTP data is sent. 12806 - */ 12807 - onBeforeSendHeaders: OnBeforeSendHeadersEvent; 12808 - /** 12809 - * Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks 12810 - * are visible by the time onSendHeaders is fired). 12811 - */ 12812 - onSendHeaders: OnSendHeadersEvent; 12813 - /** 12814 - * Fired when HTTP response headers of a request have been received. 12815 - */ 12816 - onHeadersReceived: OnHeadersReceivedEvent; 12817 - /** 12818 - * Fired when an authentication failure is received. The listener has three options: it can provide authentication 12819 - * credentials, it can cancel the request and display the error page, or it can take no action on the challenge. 12820 - * If bad user credentials are provided, this may be called multiple times for the same request. 12821 - */ 12822 - onAuthRequired: OnAuthRequiredEvent; 12823 - /** 12824 - * Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and 12825 - * response headers are available. 12826 - */ 12827 - onResponseStarted: OnResponseStartedEvent; 12828 - /** 12829 - * Fired when a server-initiated redirect is about to occur. 12830 - */ 12831 - onBeforeRedirect: OnBeforeRedirectEvent; 12832 - /** 12833 - * Fired when a request is completed. 12834 - */ 12835 - onCompleted: OnCompletedEvent; 12836 - /** 12837 - * Fired when an error occurs. 12838 - */ 12839 - onErrorOccurred: OnErrorOccurredEvent; 12840 - /** 12841 - * The maximum number of times that <code>handlerBehaviorChanged</code> can be called per 10 minute sustained interval. 12842 - * <code>handlerBehaviorChanged</code> is an expensive function call that shouldn't be called often. 12843 - */ 12844 - MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: 20; 12845 - } 12846 - } 12847 - /** 12848 - * Namespace: browser.windows 12849 - */ 12850 - namespace Windows { 12851 - /** 12852 - * The type of browser window this is. Under some circumstances a Window may not be assigned type property, 12853 - * for example when querying closed windows from the $(ref:sessions) API. 12854 - */ 12855 - type WindowType = "normal" | "popup" | "panel" | "app" | "devtools"; 12856 - /** 12857 - * The state of this browser window. Under some circumstances a Window may not be assigned state property, 12858 - * for example when querying closed windows from the $(ref:sessions) API. 12859 - */ 12860 - type WindowState = "normal" | "minimized" | "maximized" | "fullscreen" | "docked"; 12861 - interface Window { 12862 - /** 12863 - * The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be 12864 - * assigned an ID, for example when querying windows using the $(ref:sessions) API, in which case a session ID may be 12865 - * present. 12866 - * Optional. 12867 - */ 12868 - id?: number; 12869 - /** 12870 - * Whether the window is currently the focused window. 12871 - */ 12872 - focused: boolean; 12873 - /** 12874 - * The offset of the window from the top edge of the screen in pixels. Under some circumstances a Window may not be 12875 - * assigned top property, for example when querying closed windows from the $(ref:sessions) API. 12876 - * Optional. 12877 - */ 12878 - top?: number; 12879 - /** 12880 - * The offset of the window from the left edge of the screen in pixels. Under some circumstances a Window may not be 12881 - * assigned left property, for example when querying closed windows from the $(ref:sessions) API. 12882 - * Optional. 12883 - */ 12884 - left?: number; 12885 - /** 12886 - * The width of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned width 12887 - * property, for example when querying closed windows from the $(ref:sessions) API. 12888 - * Optional. 12889 - */ 12890 - width?: number; 12891 - /** 12892 - * The height of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned height 12893 - * property, for example when querying closed windows from the $(ref:sessions) API. 12894 - * Optional. 12895 - */ 12896 - height?: number; 12897 - /** 12898 - * Array of $(ref:tabs.Tab) objects representing the current tabs in the window. 12899 - * Optional. 12900 - */ 12901 - tabs?: Browser.Tabs.Tab[]; 12902 - /** 12903 - * Whether the window is incognito. 12904 - */ 12905 - incognito: boolean; 12906 - /** 12907 - * The type of browser window this is. 12908 - * Optional. 12909 - */ 12910 - type?: WindowType; 12911 - /** 12912 - * The state of this browser window. 12913 - * Optional. 12914 - */ 12915 - state?: WindowState; 12916 - /** 12917 - * Whether the window is set to be always on top. 12918 - */ 12919 - alwaysOnTop: boolean; 12920 - /** 12921 - * The session ID used to uniquely identify a Window obtained from the $(ref:sessions) API. 12922 - * Optional. 12923 - */ 12924 - sessionId?: string; 12925 - /** 12926 - * The title of the window. Read-only. 12927 - * Optional. 12928 - */ 12929 - title?: string; 12930 - } 12931 - /** 12932 - * Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the 12933 - * '--enable-panels' flag is set. 12934 - */ 12935 - type CreateType = "normal" | "popup" | "panel" | "detached_panel"; 12936 - /** 12937 - * Specifies whether the $(ref:windows.Window) returned should contain a list of the $(ref:tabs.Tab) objects. 12938 - */ 12939 - interface GetInfo { 12940 - /** 12941 - * If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs. 12942 - * Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code> 12943 - * favIconUrl</code> properties if the extension's manifest file includes the <code>"tabs"</code> permission. 12944 - * Optional. 12945 - */ 12946 - populate?: boolean; 12947 - } 12948 - /** 12949 - * Specifies properties used to filter the $(ref:windows.Window) returned and to determine whether they should contain a 12950 - * list of the $(ref:tabs.Tab) objects. 12951 - */ 12952 - interface GetAllGetInfoType extends GetInfo { 12953 - /** 12954 - * If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to 12955 - * <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> 12956 - * window types limited to the extension's own windows. 12957 - * Optional. 12958 - */ 12959 - windowTypes?: WindowType[]; 12960 - } 12961 - interface CreateCreateDataType { 12962 - /** 12963 - * A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www. 12964 - * google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. 12965 - * Defaults to the New Tab Page. 12966 - * Optional. 12967 - */ 12968 - url?: string | string[]; 12969 - /** 12970 - * The id of the tab for which you want to adopt to the new window. 12971 - * Optional. 12972 - */ 12973 - tabId?: number; 12974 - /** 12975 - * The number of pixels to position the new window from the left edge of the screen. If not specified, 12976 - * the new window is offset naturally from the last focused window. This value is ignored for panels. 12977 - * Optional. 12978 - */ 12979 - left?: number; 12980 - /** 12981 - * The number of pixels to position the new window from the top edge of the screen. If not specified, 12982 - * the new window is offset naturally from the last focused window. This value is ignored for panels. 12983 - * Optional. 12984 - */ 12985 - top?: number; 12986 - /** 12987 - * The width in pixels of the new window, including the frame. If not specified defaults to a natural width. 12988 - * Optional. 12989 - */ 12990 - width?: number; 12991 - /** 12992 - * The height in pixels of the new window, including the frame. If not specified defaults to a natural height. 12993 - * Optional. 12994 - */ 12995 - height?: number; 12996 - /** 12997 - * If true, the new window will be focused. If false, the new window will be opened in the background and the currently 12998 - * focused window will stay focused. Defaults to true. 12999 - * Optional. 13000 - */ 13001 - focused?: boolean; 13002 - /** 13003 - * Whether the new window should be an incognito window. 13004 - * Optional. 13005 - */ 13006 - incognito?: boolean; 13007 - /** 13008 - * Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the 13009 - * '--enable-panels' flag is set. 13010 - * Optional. 13011 - */ 13012 - type?: CreateType; 13013 - /** 13014 - * The initial state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 13015 - * 'top', 'width' or 'height'. 13016 - * Optional. 13017 - */ 13018 - state?: WindowState; 13019 - /** 13020 - * Allow scripts to close the window. 13021 - * Optional. 13022 - */ 13023 - allowScriptsToClose?: boolean; 13024 - /** 13025 - * The CookieStoreId to use for all tabs that were created when the window is opened. 13026 - * Optional. 13027 - */ 13028 - cookieStoreId?: string; 13029 - /** 13030 - * A string to add to the beginning of the window title. 13031 - * Optional. 13032 - */ 13033 - titlePreface?: string; 13034 - } 13035 - interface UpdateUpdateInfoType { 13036 - /** 13037 - * The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels. 13038 - * Optional. 13039 - */ 13040 - left?: number; 13041 - /** 13042 - * The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels. 13043 - * Optional. 13044 - */ 13045 - top?: number; 13046 - /** 13047 - * The width to resize the window to in pixels. This value is ignored for panels. 13048 - * Optional. 13049 - */ 13050 - width?: number; 13051 - /** 13052 - * The height to resize the window to in pixels. This value is ignored for panels. 13053 - * Optional. 13054 - */ 13055 - height?: number; 13056 - /** 13057 - * If true, brings the window to the front. If false, brings the next window in the z-order to the front. 13058 - * Optional. 13059 - */ 13060 - focused?: boolean; 13061 - /** 13062 - * If true, causes the window to be displayed in a manner that draws the user's attention to the window, 13063 - * without changing the focused window. The effect lasts until the user changes focus to the window. 13064 - * This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request. 13065 - * Optional. 13066 - */ 13067 - drawAttention?: boolean; 13068 - /** 13069 - * The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 13070 - * 'width' or 'height'. 13071 - * Optional. 13072 - */ 13073 - state?: WindowState; 13074 - /** 13075 - * A string to add to the beginning of the window title. 13076 - * Optional. 13077 - */ 13078 - titlePreface?: string; 13079 - } 13080 - interface Static { 13081 - /** 13082 - * Gets details about a window. 13083 - * 13084 - * @param getInfo Optional. 13085 - */ 13086 - get(windowId: number, getInfo?: GetInfo): Promise<Window>; 13087 - /** 13088 - * Gets the $(topic:current-window)[current window]. 13089 - * 13090 - * @param getInfo Optional. 13091 - */ 13092 - getCurrent(getInfo?: GetInfo): Promise<Window>; 13093 - /** 13094 - * Gets the window that was most recently focused &mdash; typically the window 'on top'. 13095 - * 13096 - * @param getInfo Optional. 13097 - */ 13098 - getLastFocused(getInfo?: GetInfo): Promise<Window>; 13099 - /** 13100 - * Gets all windows. 13101 - * 13102 - * @param getInfo Optional. Specifies properties used to filter the $(ref:windows.Window) 13103 - * returned and to determine whether they should contain a list of the $(ref:tabs.Tab) objects. 13104 - */ 13105 - getAll(getInfo?: GetAllGetInfoType): Promise<Window[]>; 13106 - /** 13107 - * Creates (opens) a new browser with any optional sizing, position or default URL provided. 13108 - * 13109 - * @param createData Optional. 13110 - */ 13111 - create(createData?: CreateCreateDataType): Promise<Window>; 13112 - /** 13113 - * Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be 13114 - * left unchanged. 13115 - */ 13116 - update(windowId: number, updateInfo: UpdateUpdateInfoType): Promise<Window>; 13117 - /** 13118 - * Removes (closes) a window, and all the tabs inside it. 13119 - */ 13120 - remove(windowId: number): Promise<void>; 13121 - /** 13122 - * Fired when a window is created. 13123 - * 13124 - * @param window Details of the window that was created. 13125 - */ 13126 - onCreated: Events.Event<(window: Window) => void>; 13127 - /** 13128 - * Fired when a window is removed (closed). 13129 - * 13130 - * @param windowId ID of the removed window. 13131 - */ 13132 - onRemoved: Events.Event<(windowId: number) => void>; 13133 - /** 13134 - * Fired when the currently focused window changes. Will be $(ref:windows.WINDOW_ID_NONE) 13135 - * if all browser windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent 13136 - * immediately preceding a switch from one browser window to another. 13137 - * 13138 - * @param windowId ID of the newly focused window. 13139 - */ 13140 - onFocusChanged: Events.Event<(windowId: number) => void>; 13141 - /** 13142 - * The windowId value that represents the absence of a browser window. 13143 - */ 13144 - WINDOW_ID_NONE: -1; 13145 - /** 13146 - * The windowId value that represents the $(topic:current-window)[current window]. 13147 - */ 13148 - WINDOW_ID_CURRENT: -2; 13149 - } 13150 - } 13151 - namespace BrowserSettings { 13152 - namespace ColorManagement { 13153 - interface Static { 13154 - /** 13155 - * This setting controls the mode used for color management and must be a string from $(ref:browserSettings. 13156 - * ColorManagementMode) 13157 - */ 13158 - mode: Browser.Types.Setting; 13159 - /** 13160 - * This boolean setting controls whether or not native sRGB color management is used. 13161 - */ 13162 - useNativeSRGB: Browser.Types.Setting; 13163 - /** 13164 - * This boolean setting controls whether or not the WebRender compositor is used. 13165 - */ 13166 - useWebRenderCompositor: Browser.Types.Setting; 13167 - } 13168 - } 13169 - } 13170 - namespace Devtools { 13171 - namespace InspectedWindow { 13172 - /** 13173 - * A resource within the inspected page, such as a document, a script, or an image. 13174 - */ 13175 - interface Resource { 13176 - /** 13177 - * The URL of the resource. 13178 - */ 13179 - url: string; 13180 - } 13181 - /** 13182 - * The options parameter can contain one or more options. 13183 - */ 13184 - interface EvalOptionsType { 13185 - [s: string]: unknown; 13186 - } 13187 - /** 13188 - * An object providing details if an exception occurred while evaluating the expression. 13189 - */ 13190 - interface EvalCallbackExceptionInfoType { 13191 - /** 13192 - * Set if the error occurred on the DevTools side before the expression is evaluated. 13193 - */ 13194 - isError: boolean; 13195 - /** 13196 - * Set if the error occurred on the DevTools side before the expression is evaluated. 13197 - */ 13198 - code: string; 13199 - /** 13200 - * Set if the error occurred on the DevTools side before the expression is evaluated. 13201 - */ 13202 - description: string; 13203 - /** 13204 - * Set if the error occurred on the DevTools side before the expression is evaluated, 13205 - * contains the array of the values that may be substituted into the description string to provide more information about 13206 - * the cause of the error. 13207 - */ 13208 - details: unknown[]; 13209 - /** 13210 - * Set if the evaluated code produces an unhandled exception. 13211 - */ 13212 - isException: boolean; 13213 - /** 13214 - * Set if the evaluated code produces an unhandled exception. 13215 - */ 13216 - value: string; 13217 - } 13218 - interface ReloadReloadOptionsType { 13219 - /** 13220 - * When true, the loader will bypass the cache for all inspected page resources loaded before the <code>load</code> 13221 - * event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools 13222 - * window. 13223 - * Optional. 13224 - */ 13225 - ignoreCache?: boolean; 13226 - /** 13227 - * If specified, the string will override the value of the <code>User-Agent</code> HTTP header that's sent while loading 13228 - * the resources of the inspected page. The string will also override the value of the <code>navigator.userAgent</code> 13229 - * property that's returned to any scripts that are running within the inspected page. 13230 - * Optional. 13231 - */ 13232 - userAgent?: string; 13233 - /** 13234 - * If specified, the script will be injected into every frame of the inspected page immediately upon load, 13235 - * before any of the frame's scripts. The script will not be injected after subsequent reloads&mdash;for example, 13236 - * if the user presses Ctrl+R. 13237 - * Optional. 13238 - */ 13239 - injectedScript?: string; 13240 - } 13241 - interface Static { 13242 - /** 13243 - * Evaluates a JavaScript expression in the context of the main frame of the inspected page. 13244 - * The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. 13245 - * The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. 13246 - * In either case, the <code>result</code> parameter of the callback is <code>undefined</code>. 13247 - * In the case of a DevTools-side error, the <code>isException</code> parameter is non-null and has <code>isError</code> 13248 - * set to true and <code>code</code> set to an error code. In the case of a JavaScript error, <code>isException</code> 13249 - * is set to true and <code>value</code> is set to the string value of thrown object. 13250 - * 13251 - * @param expression An expression to evaluate. 13252 - * @param options Optional. The options parameter can contain one or more options. 13253 - * @returns A function called when evaluation completes. 13254 - */ 13255 - eval(expression: string, options?: EvalOptionsType): Promise<[ 13256 - unknown, 13257 - EvalCallbackExceptionInfoType 13258 - ]>; 13259 - /** 13260 - * Reloads the inspected page. 13261 - * 13262 - * @param reloadOptions Optional. 13263 - */ 13264 - reload(reloadOptions?: ReloadReloadOptionsType): void; 13265 - /** 13266 - * The ID of the tab being inspected. This ID may be used with chrome.tabs.* API. 13267 - */ 13268 - tabId: number; 13269 - } 13270 - } 13271 - } 13272 - namespace Devtools { 13273 - namespace Network { 13274 - /** 13275 - * Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. 13276 - */ 13277 - interface Request { 13278 - /** 13279 - * Returns content of the response body. 13280 - * 13281 - * @returns A function that receives the response body when the request completes. 13282 - */ 13283 - getContent(): Promise<[ 13284 - string, 13285 - string 13286 - ]>; 13287 - } 13288 - /** 13289 - * A HAR log. See HAR specification for details. 13290 - */ 13291 - interface GetHARCallbackHarLogType { 13292 - [s: string]: unknown; 13293 - } 13294 - interface Static { 13295 - /** 13296 - * Returns HAR log that contains all known network requests. 13297 - * 13298 - * @returns A function that receives the HAR log when the request completes. 13299 - */ 13300 - getHAR(): Promise<GetHARCallbackHarLogType>; 13301 - /** 13302 - * Fired when a network request is finished and all request data are available. 13303 - * 13304 - * @param request Description of a network request in the form of a HAR entry. See HAR specification for details. 13305 - */ 13306 - onRequestFinished: Events.Event<(request: Request) => void>; 13307 - /** 13308 - * Fired when the inspected window navigates to a new page. 13309 - * 13310 - * @param url URL of the new page. 13311 - */ 13312 - onNavigated: Events.Event<(url: string) => void>; 13313 - } 13314 - } 13315 - } 13316 - namespace Devtools { 13317 - namespace Panels { 13318 - /** 13319 - * Represents the Elements panel. 13320 - */ 13321 - interface ElementsPanel { 13322 - /** 13323 - * Creates a pane within panel's sidebar. 13324 - * 13325 - * @param title Text that is displayed in sidebar caption. 13326 - * @returns A callback invoked when the sidebar is created. 13327 - */ 13328 - createSidebarPane(title: string): Promise<ExtensionSidebarPane>; 13329 - /** 13330 - * Fired when an object is selected in the panel. 13331 - */ 13332 - onSelectionChanged: Events.Event<() => void>; 13333 - } 13334 - /** 13335 - * Represents the Sources panel. 13336 - */ 13337 - interface SourcesPanel { 13338 - [s: string]: unknown; 13339 - } 13340 - /** 13341 - * Represents a panel created by extension. 13342 - */ 13343 - interface ExtensionPanel { 13344 - /** 13345 - * Fired when the user switches to the panel. 13346 - * 13347 - * @param window The JavaScript <code>window</code> object of panel's page. 13348 - */ 13349 - onShown: Events.Event<(window: Window) => void>; 13350 - /** 13351 - * Fired when the user switches away from the panel. 13352 - */ 13353 - onHidden: Events.Event<() => void>; 13354 - } 13355 - /** 13356 - * A sidebar created by the extension. 13357 - */ 13358 - interface ExtensionSidebarPane { 13359 - /** 13360 - * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. 13361 - * 13362 - * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are 13363 - * displayed in an expandable tree similar to the console/watch. 13364 - * @param rootTitle Optional. An optional title for the root of the expression tree. 13365 - * @returns A callback invoked after the sidebar pane is updated with the expression evaluation results. 13366 - */ 13367 - setExpression(expression: string, rootTitle?: string): Promise<void>; 13368 - /** 13369 - * Sets a JSON-compliant object to be displayed in the sidebar pane. 13370 - * 13371 - * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller 13372 - * (API client). 13373 - * @param rootTitle Optional. An optional title for the root of the expression tree. 13374 - * @returns A callback invoked after the sidebar is updated with the object. 13375 - */ 13376 - setObject(jsonObject: string | unknown[] | Record<string, unknown>, rootTitle?: string): Promise<void>; 13377 - /** 13378 - * Sets an HTML page to be displayed in the sidebar pane. 13379 - * 13380 - * @param path Relative path of an extension page to display within the sidebar. 13381 - */ 13382 - setPage(path: Browser.Manifest.ExtensionURL): Promise<void>; 13383 - /** 13384 - * Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it. 13385 - * 13386 - * @param window The JavaScript <code>window</code> object of the sidebar page, if one was set with the <code>setPage() 13387 - * </code> method. 13388 - */ 13389 - onShown: Events.Event<(window: Window) => void>; 13390 - /** 13391 - * Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar 13392 - * pane. 13393 - */ 13394 - onHidden: Events.Event<() => void>; 13395 - } 13396 - /** 13397 - * A button created by the extension. 13398 - */ 13399 - interface Button { 13400 - [s: string]: unknown; 13401 - } 13402 - interface Static { 13403 - /** 13404 - * Creates an extension panel. 13405 - * 13406 - * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar. 13407 - * @param iconPath Path of the panel's icon relative to the extension directory, or an empty string to use the default 13408 - * extension icon as the panel icon. 13409 - * @param pagePath Path of the panel's HTML page relative to the extension directory. 13410 - * @returns A function that is called when the panel is created. 13411 - */ 13412 - create(title: string, iconPath: "" | Browser.Manifest.ExtensionURL, pagePath: Browser.Manifest.ExtensionURL): Promise<ExtensionPanel>; 13413 - /** 13414 - * Fired when the devtools theme changes. 13415 - * 13416 - * @param themeName The name of the current devtools theme. 13417 - */ 13418 - onThemeChanged: Events.Event<(themeName: string) => void>; 13419 - /** 13420 - * Elements panel. 13421 - */ 13422 - elements: ElementsPanel; 13423 - /** 13424 - * Sources panel. 13425 - */ 13426 - sources: SourcesPanel; 13427 - /** 13428 - * The name of the current devtools theme. 13429 - */ 13430 - themeName: string; 13431 - } 13432 - } 13433 - } 13434 - namespace Privacy { 13435 - namespace Network { 13436 - /** 13437 - * The IP handling policy of WebRTC. 13438 - */ 13439 - type IPHandlingPolicy = "default" | "default_public_and_private_interfaces" | "default_public_interface_only" | "disable_non_proxied_udp" | "proxy_only"; 13440 - /** 13441 - * An object which describes TLS minimum and maximum versions. 13442 - */ 13443 - interface tlsVersionRestrictionConfig { 13444 - /** 13445 - * The minimum TLS version supported. 13446 - * Optional. 13447 - */ 13448 - minimum?: TlsVersionRestrictionConfigMinimumEnum; 13449 - /** 13450 - * The maximum TLS version supported. 13451 - * Optional. 13452 - */ 13453 - maximum?: TlsVersionRestrictionConfigMaximumEnum; 13454 - } 13455 - /** 13456 - * The mode for https-only mode. 13457 - */ 13458 - type HTTPSOnlyModeOption = "always" | "private_browsing" | "never"; 13459 - /** 13460 - * The minimum TLS version supported. 13461 - */ 13462 - type TlsVersionRestrictionConfigMinimumEnum = "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; 13463 - /** 13464 - * The maximum TLS version supported. 13465 - */ 13466 - type TlsVersionRestrictionConfigMaximumEnum = "TLSv1" | "TLSv1.1" | "TLSv1.2" | "TLSv1.3" | "unknown"; 13467 - interface Static { 13468 - /** 13469 - * If enabled, the browser attempts to speed up your web browsing experience by pre-resolving DNS entries, 13470 - * prerendering sites (<code>&lt;link rel='prefetch' ...&gt;</code>), and preemptively opening TCP and SSL connections to 13471 - * servers. This preference's value is a boolean, defaulting to <code>true</code>. 13472 - */ 13473 - networkPredictionEnabled: Browser.Types.Setting; 13474 - /** 13475 - * Allow users to enable and disable RTCPeerConnections (aka WebRTC). 13476 - */ 13477 - peerConnectionEnabled: Browser.Types.Setting; 13478 - /** 13479 - * Allow users to specify the media performance/privacy tradeoffs which impacts how WebRTC traffic will be routed and how 13480 - * much local address information is exposed. This preference's value is of type IPHandlingPolicy, defaulting to <code> 13481 - * default</code>. 13482 - */ 13483 - webRTCIPHandlingPolicy: Browser.Types.Setting; 13484 - /** 13485 - * This property controls the minimum and maximum TLS versions. This setting's value is an object of 13486 - * $(ref:tlsVersionRestrictionConfig). 13487 - */ 13488 - tlsVersionRestriction: Browser.Types.Setting; 13489 - /** 13490 - * Allow users to query the mode for 'HTTPS-Only Mode'. This setting's value is of type HTTPSOnlyModeOption, 13491 - * defaulting to <code>never</code>. 13492 - */ 13493 - httpsOnlyMode: Browser.Types.Setting; 13494 - /** 13495 - * Allow users to query the status of 'Global Privacy Control'. This setting's value is of type boolean, 13496 - * defaulting to <code>false</code>. 13497 - */ 13498 - globalPrivacyControl: Browser.Types.Setting; 13499 - } 13500 - } 13501 - } 13502 - namespace Privacy { 13503 - namespace Services { 13504 - interface Static { 13505 - /** 13506 - * If enabled, the password manager will ask if you want to save passwords. This preference's value is a boolean, 13507 - * defaulting to <code>true</code>. 13508 - */ 13509 - passwordSavingEnabled: Browser.Types.Setting; 13510 - } 13511 - } 13512 - } 13513 - namespace Privacy { 13514 - namespace Websites { 13515 - /** 13516 - * The mode for tracking protection. 13517 - */ 13518 - type TrackingProtectionModeOption = "always" | "never" | "private_browsing"; 13519 - /** 13520 - * The settings for cookies. 13521 - */ 13522 - interface CookieConfig { 13523 - /** 13524 - * The type of cookies to allow. 13525 - * Optional. 13526 - */ 13527 - behavior?: CookieConfigBehaviorEnum; 13528 - } 13529 - /** 13530 - * The type of cookies to allow. 13531 - */ 13532 - type CookieConfigBehaviorEnum = "allow_all" | "reject_all" | "reject_third_party" | "allow_visited" | "reject_trackers" | "reject_trackers_and_partition_foreign"; 13533 - interface Static { 13534 - /** 13535 - * If enabled, the browser sends auditing pings when requested by a website (<code>&lt;a ping&gt;</code>). 13536 - * The value of this preference is of type boolean, and the default value is <code>true</code>. 13537 - */ 13538 - hyperlinkAuditingEnabled: Browser.Types.Setting; 13539 - /** 13540 - * If enabled, the browser sends <code>referer</code> headers with your requests. Yes, 13541 - * the name of this preference doesn't match the misspelled header. No, we're not going to change it. 13542 - * The value of this preference is of type boolean, and the default value is <code>true</code>. 13543 - */ 13544 - referrersEnabled: Browser.Types.Setting; 13545 - /** 13546 - * If enabled, the browser attempts to appear similar to other users by reporting generic information to websites. 13547 - * This can prevent websites from uniquely identifying users. Examples of data that is spoofed include number of CPU cores, 13548 - * precision of JavaScript timers, the local timezone, and disabling features such as GamePad support, 13549 - * and the WebSpeech and Navigator APIs. The value of this preference is of type boolean, and the default value is <code> 13550 - * false</code>. 13551 - */ 13552 - resistFingerprinting: Browser.Types.Setting; 13553 - /** 13554 - * If enabled, the browser will associate all data (including cookies, HSTS data, cached images, and more) 13555 - * for any third party domains with the domain in the address bar. This prevents third party trackers from using directly 13556 - * stored information to identify you across different websites, but may break websites where you login with a third party 13557 - * account (such as a Facebook or Google login.) The value of this preference is of type boolean, 13558 - * and the default value is <code>false</code>. 13559 - */ 13560 - firstPartyIsolate: Browser.Types.Setting; 13561 - /** 13562 - * Allow users to specify the mode for tracking protection. This setting's value is of type TrackingProtectionModeOption, 13563 - * defaulting to <code>private_browsing_only</code>. 13564 - */ 13565 - trackingProtectionMode: Browser.Types.Setting; 13566 - /** 13567 - * Allow users to specify the default settings for allowing cookies, as well as whether all cookies should be created as 13568 - * non-persistent cookies. This setting's value is of type CookieConfig. 13569 - */ 13570 - cookieConfig: Browser.Types.Setting; 13571 - } 13572 - } 13573 - } 13574 - namespace Trial { 13575 - namespace Ml { 13576 - interface CreateEngineRequest { 13577 - [s: string]: unknown; 13578 - } 13579 - interface RunEngineRequest { 13580 - [s: string]: unknown; 13581 - } 13582 - /** 13583 - * Object containing the data, see https://firefox-source-docs.mozilla.org/toolkit/components/ml/notifications.html 13584 - */ 13585 - interface OnProgressProgressDataType { 13586 - [s: string]: unknown; 13587 - } 13588 - interface Static { 13589 - /** 13590 - * Prepare the inference engine 13591 - */ 13592 - createEngine(CreateEngineRequest: CreateEngineRequest): void; 13593 - /** 13594 - * Call the inference engine 13595 - */ 13596 - runEngine(RunEngineRequest: RunEngineRequest): void; 13597 - /** 13598 - * Delete the models the extension downloaded. 13599 - */ 13600 - deleteCachedModels(): void; 13601 - /** 13602 - * Events from the inference engine. 13603 - * 13604 - * @param progressData Object containing the data, see https://firefox-source-docs.mozilla. 13605 - * org/toolkit/components/ml/notifications.html 13606 - */ 13607 - onProgress: Events.Event<(progressData: OnProgressProgressDataType) => void>; 13608 - } 13609 - } 13610 - } 13611 - interface Browser { 13612 - /** 13613 - * Monitor extension activity 13614 - * 13615 - * Permissions: "activityLog" 13616 - */ 13617 - activityLog: ActivityLog.Static; 13618 - /** 13619 - * Permissions: "alarms" 13620 - */ 13621 - alarms: Alarms.Static; 13622 - /** 13623 - * Use the <code>browser.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. 13624 - * Also see $(topic:override)[Override Pages], which you can use to create a custom Bookmark Manager page. 13625 - * 13626 - * Permissions: "bookmarks" 13627 - */ 13628 - bookmarks: Bookmarks.Static; 13629 - /** 13630 - * Use browser actions to put icons in the main browser toolbar, to the right of the address bar. In addition to its icon, 13631 - * a browser action can also have a tooltip, a badge, and a popup. 13632 - * 13633 - * Permissions: "manifest:action", "manifest:browser_action" 13634 - */ 13635 - action: Action.Static; 13636 - /** 13637 - * Permissions: "manifest:action", "manifest:browser_action" 13638 - */ 13639 - browserAction: BrowserAction.Static; 13640 - /** 13641 - * Use the <code>browser.browserSettings</code> API to control global settings of the browser. 13642 - * 13643 - * Permissions: "browserSettings" 13644 - */ 13645 - browserSettings: BrowserSettings.Static; 13646 - /** 13647 - * Use the <code>chrome.browsingData</code> API to remove browsing data from a user's local profile. 13648 - * 13649 - * Permissions: "browsingData" 13650 - */ 13651 - browsingData: BrowsingData.Static; 13652 - /** 13653 - * This API provides the ability detect the captive portal state of the users connection. 13654 - * 13655 - * Permissions: "captivePortal" 13656 - */ 13657 - captivePortal: CaptivePortal.Static; 13658 - /** 13659 - * Offers the ability to write to the clipboard. Reading is not supported because the clipboard can already be read through 13660 - * the standard web platform APIs. 13661 - * 13662 - * Permissions: "clipboardWrite" 13663 - */ 13664 - clipboard: Clipboard.Static; 13665 - /** 13666 - * Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, 13667 - * an action to open the browser action or send a command to the xtension. 13668 - * 13669 - * Permissions: "manifest:commands" 13670 - */ 13671 - commands: Commands.Static; 13672 - contentScripts: ContentScripts.Static; 13673 - /** 13674 - * Use the <code>browser.contextualIdentities</code> API to query and modify contextual identity, also called as containers. 13675 - * 13676 - * Permissions: "contextualIdentities" 13677 - */ 13678 - contextualIdentities: ContextualIdentities.Static; 13679 - /** 13680 - * Use the <code>browser.cookies</code> API to query and modify cookies, and to be notified when they change. 13681 - * 13682 - * Permissions: "cookies" 13683 - */ 13684 - cookies: Cookies.Static; 13685 - /** 13686 - * Use the <code>chrome.declarativeContent</code> API to take actions depending on the content of a page, 13687 - * without requiring permission to read the page's content. 13688 - */ 13689 - declarativeContent: DeclarativeContent.Static; 13690 - /** 13691 - * Use the declarativeNetRequest API to block or modify network requests by specifying declarative rules. 13692 - * 13693 - * Permissions: "declarativeNetRequest", "declarativeNetRequestWithHostAccess" 13694 - */ 13695 - declarativeNetRequest: DeclarativeNetRequest.Static; 13696 - /** 13697 - * Permissions: "manifest:devtools_page" 13698 - */ 13699 - devtools: Devtools.Static; 13700 - /** 13701 - * Asynchronous DNS API 13702 - * 13703 - * Permissions: "dns" 13704 - */ 13705 - dns: Dns.Static; 13706 - /** 13707 - * Permissions: "downloads" 13708 - */ 13709 - downloads: Downloads.Static; 13710 - /** 13711 - * The <code>chrome.events</code> namespace contains common types used by APIs dispatching events to notify you when 13712 - * something interesting happens. 13713 - */ 13714 - events: Events.Static; 13715 - experiments: Experiments.Static; 13716 - /** 13717 - * The <code>browser.extensionTypes</code> API contains type declarations for WebExtensions. 13718 - */ 13719 - extensionTypes: ExtensionTypes.Static; 13720 - /** 13721 - * The <code>browser.extension</code> API has utilities that can be used by any extension page. 13722 - * It includes support for exchanging messages between an extension and its content scripts or between extensions, 13723 - * as described in detail in $(topic:messaging)[Message Passing]. 13724 - */ 13725 - extension: Extension.Static; 13726 - /** 13727 - * Use the <code>browser.find</code> API to interact with the browser's <code>Find</code> interface. 13728 - * 13729 - * Permissions: "find" 13730 - */ 13731 - find: Find.Static; 13732 - /** 13733 - * Exposes the browser's profiler. 13734 - * 13735 - * Permissions: "geckoProfiler" 13736 - */ 13737 - geckoProfiler: GeckoProfiler.Static; 13738 - /** 13739 - * Use the <code>browser.history</code> API to interact with the browser's record of visited pages. You can add, remove, 13740 - * and query for URLs in the browser's history. To override the history page with your own version, see $(topic:override) 13741 - * [Override Pages]. 13742 - * 13743 - * Permissions: "history" 13744 - */ 13745 - history: History.Static; 13746 - /** 13747 - * Use the <code>browser.i18n</code> infrastructure to implement internationalization across your whole app or extension. 13748 - */ 13749 - i18n: I18n.Static; 13750 - /** 13751 - * Use the chrome.identity API to get OAuth2 access tokens. 13752 - * 13753 - * Permissions: "identity" 13754 - */ 13755 - identity: Identity.Static; 13756 - /** 13757 - * Use the <code>browser.idle</code> API to detect when the machine's idle state changes. 13758 - * 13759 - * Permissions: "idle" 13760 - */ 13761 - idle: Idle.Static; 13762 - /** 13763 - * The <code>browser.management</code> API provides ways to manage the list of extensions that are installed and running. 13764 - */ 13765 - management: Management.Static; 13766 - /** 13767 - * Permissions: - 13768 - */ 13769 - manifest: Manifest.Static; 13770 - /** 13771 - * Use the browser.contextMenus API to add items to the browser's context menu. You can choose what types of objects your 13772 - * context menu additions apply to, such as images, hyperlinks, and pages. 13773 - * 13774 - * Permissions: "contextMenus" 13775 - */ 13776 - contextMenus: ContextMenus.Static; 13777 - /** 13778 - * Use the browser.menus API to add items to the browser's menus. You can choose what types of objects your context menu 13779 - * additions apply to, such as images, hyperlinks, and pages. 13780 - * 13781 - * Permissions: "menus" 13782 - */ 13783 - menus: Menus.Static; 13784 - /** 13785 - * This API provides the ability to determine the status of and detect changes in the network connection. 13786 - * This API can only be used in privileged extensions. 13787 - * 13788 - * Permissions: "networkStatus" 13789 - */ 13790 - networkStatus: NetworkStatus.Static; 13791 - /** 13792 - * Normandy Study API 13793 - * 13794 - * Permissions: "normandyAddonStudy" 13795 - */ 13796 - normandyAddonStudy: NormandyAddonStudy.Static; 13797 - /** 13798 - * Permissions: "notifications" 13799 - */ 13800 - notifications: Notifications.Static; 13801 - /** 13802 - * The omnibox API allows you to register a keyword with Firefox's address bar. 13803 - * 13804 - * Permissions: "manifest:omnibox" 13805 - */ 13806 - omnibox: Omnibox.Static; 13807 - /** 13808 - * Use the <code>browser.pageAction</code> API to put icons inside the address bar. Page actions represent actions that can 13809 - * be taken on the current page, but that aren't applicable to all pages. 13810 - * 13811 - * Permissions: "manifest:page_action" 13812 - */ 13813 - pageAction: PageAction.Static; 13814 - permissions: Permissions.Static; 13815 - /** 13816 - * PKCS#11 module management API 13817 - * 13818 - * Permissions: "pkcs11" 13819 - */ 13820 - pkcs11: Pkcs11.Static; 13821 - /** 13822 - * Permissions: "privacy" 13823 - */ 13824 - privacy: Privacy.Static; 13825 - /** 13826 - * Provides access to global proxy settings for Firefox and proxy event listeners to handle dynamic proxy implementations. 13827 - * 13828 - * Permissions: "proxy" 13829 - */ 13830 - proxy: Proxy.Static; 13831 - /** 13832 - * Use the <code>browser.runtime</code> API to retrieve the background page, return details about the manifest, 13833 - * and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the 13834 - * relative path of URLs to fully-qualified URLs. 13835 - */ 13836 - runtime: Runtime.Static; 13837 - /** 13838 - * Use the scripting API to execute script in different contexts. 13839 - * 13840 - * Permissions: "scripting" 13841 - */ 13842 - scripting: Scripting.Static; 13843 - /** 13844 - * Use browser.search to interact with search engines. 13845 - * 13846 - * Permissions: "search" 13847 - */ 13848 - search: Search.Static; 13849 - /** 13850 - * Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session. 13851 - * 13852 - * Permissions: "sessions" 13853 - */ 13854 - sessions: Sessions.Static; 13855 - /** 13856 - * Use sidebar actions to add a sidebar to Firefox. 13857 - * 13858 - * Permissions: "manifest:sidebar_action" 13859 - */ 13860 - sidebarAction: SidebarAction.Static; 13861 - /** 13862 - * Use the <code>browser.storage</code> API to store, retrieve, and track changes to user data. 13863 - * 13864 - * Permissions: "storage" 13865 - */ 13866 - storage: Storage.Static; 13867 - /** 13868 - * Use the browser.tabGroups API to interact with the browser's tab grouping system. You can use this API to modify, 13869 - * and rearrange tab groups. 13870 - * 13871 - * Permissions: "tabGroups" 13872 - */ 13873 - tabGroups: TabGroups.Static; 13874 - /** 13875 - * Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify, 13876 - * and rearrange tabs in the browser. 13877 - */ 13878 - tabs: Tabs.Static; 13879 - /** 13880 - * The theme API allows customizing of visual elements of the browser. 13881 - */ 13882 - theme: Theme.Static; 13883 - /** 13884 - * Use the chrome.topSites API to access the top sites that are displayed on the new tab page. 13885 - * 13886 - * Permissions: "topSites" 13887 - */ 13888 - topSites: TopSites.Static; 13889 - /** 13890 - * Permissions: "trialML" 13891 - */ 13892 - trial: Trial.Static; 13893 - /** 13894 - * Contains types used by other schemas. 13895 - */ 13896 - types: Types.Static; 13897 - /** 13898 - * Permissions: "manifest:user_scripts", "userScripts" 13899 - */ 13900 - userScripts: UserScripts.Static; 13901 - /** 13902 - * Use the <code>browser.webNavigation</code> API to receive notifications about the status of navigation requests 13903 - * in-flight. 13904 - * 13905 - * Permissions: "webNavigation" 13906 - */ 13907 - webNavigation: WebNavigation.Static; 13908 - /** 13909 - * Use the <code>browser.webRequest</code> API to observe and analyze traffic and to intercept, block, 13910 - * or modify requests in-flight. 13911 - * 13912 - * Permissions: "webRequest" 13913 - */ 13914 - webRequest: WebRequest.Static; 13915 - /** 13916 - * Use the <code>browser.windows</code> API to interact with browser windows. You can use this API to create, modify, 13917 - * and rearrange windows in the browser. 13918 - */ 13919 - windows: Windows.Static; 13920 - } 13921 - } 13922 - } 13923 - // This Source Code Form is subject to the terms of the Mozilla Public 13924 - // License, v. 2.0. If a copy of the MPL was not distributed with this 13925 - // file, You can obtain one at http://mozilla.org/MPL/2.0/. 13926 - declare global { 13927 - interface GlideModes { 13928 - hint: "hint"; 13929 - } 13930 - } 13931 - // This Source Code Form is subject to the terms of the Mozilla Public 13932 - // License, v. 2.0. If a copy of the MPL was not distributed with this 13933 - // file, You can obtain one at http://mozilla.org/MPL/2.0/. 13934 - declare global { 13935 - interface ExcmdRegistry { 13936 - jumplist_back: {}; 13937 - jumplist_forward: {}; 13938 - } 13939 - } 13940 - // This Source Code Form is subject to the terms of the Mozilla Public 13941 - // License, v. 2.0. If a copy of the MPL was not distributed with this 13942 - // file, You can obtain one at http://mozilla.org/MPL/2.0/. 13943 - declare global { 13944 - interface ExcmdRegistry { 13945 - whichkey: {}; 13946 - } 13947 - } 13948 - 13949 - export {};
-18
glide/glide.ts
··· 1 - // Config docs: 2 - // 3 - // https://glide-browser.app/config 4 - // 5 - // API reference: 6 - // 7 - // https://glide-browser.app/api 8 - // 9 - // Default config files can be found here: 10 - // 11 - // https://github.com/glide-browser/glide/tree/main/src/glide/browser/base/content/plugins 12 - // 13 - // Most default keymappings are defined here: 14 - // 15 - // https://github.com/glide-browser/glide/blob/main/src/glide/browser/base/content/plugins/keymaps.mts 16 - // 17 - // Try typing `glide.` and see what you can do! 18 - glide.o.hint_size = "14px";
-16
glide/package.json
··· 1 - { 2 - "name": "glide-config", 3 - "private": true, 4 - "version": "0.0.1", 5 - "description": "", 6 - "scripts": { 7 - "tsc": "tsc" 8 - }, 9 - "keywords": [], 10 - "author": "", 11 - "license": "", 12 - "dependencies": { 13 - "typescript": "^5.9.2" 14 - }, 15 - "devDependencies": {} 16 - }
-38
glide/tsconfig.json
··· 1 - { 2 - "$schema": "https://json.schemastore.org/tsconfig", 3 - "exclude": [ 4 - "node_modules" 5 - ], 6 - "compilerOptions": { 7 - "lib": ["DOM", "DOM.Iterable", "DOM.AsyncIterable", "ESNext"], 8 - "types": [ 9 - "./glide.d.ts" 10 - ], 11 - "target": "esnext", 12 - "module": "esnext", 13 - "moduleDetection": "force", 14 - "allowJs": true, 15 - "noEmit": true, 16 - /** 17 - * Recommended type checking rules. 18 - * 19 - * Feel free to modify these. 20 - */ 21 - "strict": true, 22 - "noImplicitAny": true, 23 - "strictNullChecks": true, 24 - "strictFunctionTypes": true, 25 - "strictBindCallApply": true, 26 - "strictPropertyInitialization": true, 27 - "noImplicitThis": true, 28 - "alwaysStrict": true, 29 - "noUncheckedIndexedAccess": true, 30 - "noImplicitOverride": true, 31 - "noPropertyAccessFromIndexSignature": true, 32 - "skipLibCheck": true, 33 - "noErrorTruncation": true, 34 - "erasableSyntaxOnly": true, 35 - "noUnusedLocals": true, 36 - "noUnusedParameters": true 37 - } 38 - }