File: runtime.json

package info (click to toggle)
chromium 145.0.7632.159-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,976,224 kB
  • sloc: cpp: 36,198,469; ansic: 7,634,080; javascript: 3,564,060; python: 1,649,622; xml: 838,470; asm: 717,087; pascal: 185,708; sh: 88,786; perl: 88,718; objc: 79,984; sql: 59,811; cs: 42,452; fortran: 24,101; makefile: 21,144; tcl: 15,277; php: 14,022; yacc: 9,066; ruby: 7,553; awk: 3,720; lisp: 3,233; lex: 1,328; ada: 727; jsp: 228; sed: 36
file content (818 lines) | stat: -rw-r--r-- 42,471 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Note: Many of these functions and events are implemented by hand and should
// not elicit any code generation from the schema compiler. These items are
// marked "nocompile."
[
  {
    "namespace": "runtime",
    "description": "Use the <code>chrome.runtime</code> API to retrieve the service worker, return details about the manifest, and listen for and respond to events in the extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.",
    "types": [
      {
        "id": "Port",
        "type": "object",
        "nocompile": true,
        "description": "An object which allows two way communication with other pages. See <a href=\"messaging#connect\">Long-lived connections</a> for more information.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the port, as specified in the call to $(ref:runtime.connect)."
          },
          "disconnect": {
            "type": "function",
            "description": "Immediately disconnect the port. Calling <code>disconnect()</code> on an already-disconnected port has no effect. When a port is disconnected, no new events will be dispatched to this port."
          },
          "postMessage": {
            "type": "function",
            "description": "Send a message to the other end of the port. If the port is disconnected, an error is thrown.",
            "parameters": [
              {"name": "message", "type": "any", "description": "The message to send. This object should be JSON-ifiable."}
            ]
          },
          "sender": {
            "$ref": "MessageSender",
            "optional": true,
            "description": "This property will <b>only</b> be present on ports passed to $(ref:runtime.onConnect onConnect) / $(ref:runtime.onConnectExternal onConnectExternal) / $(ref:runtime.onConnectExternal onConnectNative) listeners."
          }
        },
        "events": [
          {
            "name": "onDisconnect",
            "description": "Fired when the port is disconnected from the other end(s). $(ref:runtime.lastError) may be set if the port was disconnected by an error. If the port is closed via $(ref:Port.disconnect disconnect), then this event is <em>only</em> fired on the other end. This event is fired at most once (see also <a href=\"messaging#port-lifetime\">Port lifetime</a>).",
            "parameters": [
              {"name": "port", "$ref": "Port", "description": "The disconnected port."}
            ]
          },
          {
            "name": "onMessage",
            "description": "This event is fired when $(ref:Port.postMessage postMessage) is called by the other end of the port.",
            "parameters": [
              {"name": "message", "type": "any", "description": "The message received on the port."},
              {"name": "port", "$ref": "Port", "description": "The port that received the message."}
            ]
          }
        ],
        "additionalProperties": {"type": "any"}
      },
      {
        "id": "MessageSender",
        "type": "object",
        "nocompile": true,
        "description": "An object containing information about the script context that sent a message or request.",
        "properties": {
          "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $(ref:tabs.Tab) which opened the connection, if any. This property will <strong>only</strong> be present when the connection was opened from a tab (including content scripts), and <strong>only</strong> if the receiver is an extension, not an app.", "extension_types": ["extension", "legacy_packaged_app"]},
          "frameId": {"type": "integer", "optional": true, "description": "The <a href='webNavigation#frame_ids'>frame</a> that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when <code>tab</code> is set.", "extension_types": ["extension", "legacy_packaged_app"]},
          "guestProcessId": {"type": "integer", "optional": true, "nodoc": true, "description": "The guest process id of the requesting webview, if available. Only available for component extensions.", "extension_types": ["extension"]},
          "guestRenderFrameRoutingId": {"type": "integer", "optional": true, "nodoc": true, "description": "The guest render frame routing id of the requesting webview, if available. Only available for component extensions.", "extension_types": ["extension"]},
          "id": {"type": "string", "optional": true, "description": "The ID of the extension that opened the connection, if any."},
          "url": {"type": "string", "optional": true, "description": "The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it."},
          "nativeApplication": {"type": "string", "optional": true, "description": "The name of the native application that opened the connection, if any."},
          "tlsChannelId": {"type": "string", "optional": true, "description": "The TLS channel ID of the page or frame that opened the connection, if requested by the extension, and if available."},
          "origin": {"type": "string", "optional": true, "description": "The origin of the page or frame that opened the connection. It can vary from the url property (e.g., about:blank) or can be opaque (e.g., sandboxed iframes). This is useful for identifying if the origin can be trusted if we can't immediately tell from the URL."},
          "documentId": {"type": "string", "optional": true, "description": "A UUID of the document that opened the connection."},
          "documentLifecycle": {"type": "string", "optional": true, "description": "The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation."}
        }
      },
      {
        "id": "PlatformOs",
        "type": "string",
        "description": "The operating system Chrome is running on.",
        "enum": [
            {"name": "mac", "description": "Specifies the MacOS operating system."},
            {"name": "win", "description": "Specifies the Windows operating system."},
            {"name": "android", "description": "Specifies the Android operating system."},
            {"name": "cros", "description": "Specifies the Chrome operating system."},
            {"name": "linux", "description": "Specifies the Linux operating system."},
            {"name": "openbsd", "description": "Specifies the OpenBSD operating system."}
        ]
      },
      {
        "id": "PlatformArch",
        "type": "string",
        "enum": [
            {"name": "arm", "description": "Specifies the processer architecture as arm."},
            {"name": "arm64", "description": "Specifies the processer architecture as arm64."},
            {"name": "x86-32", "description": "Specifies the processer architecture as x86-32."},
            {"name": "x86-64", "description": "Specifies the processer architecture as x86-64."},
            {"name": "mips", "description": "Specifies the processer architecture as mips."},
            {"name": "mips64", "description": "Specifies the processer architecture as mips64."},
            {"name": "riscv64", "description": "Specifies the processer architecture as riscv64."},
            {"name": "ppc64", "description": "Specifies the processer architecture as ppc64."},
            {"name": "loongarch64", "description": "Specifies the processer architecture as loongarch64."}
         ],
        "description": "The machine's processor architecture."
      },
      {
        "id": "PlatformNaclArch",
        "description": "The native client architecture. This may be different from arch on some platforms.",
        "type": "string",
        "enum": [
          {"name": "arm", "description": "Specifies the native client architecture as arm."},
          {"name": "x86-32", "description": "Specifies the native client architecture as x86-32."},
          {"name": "x86-64", "description": "Specifies the native client architecture as x86-64."},
          {"name": "mips", "description": "Specifies the native client architecture as mips."},
          {"name": "mips64", "description": "Specifies the native client architecture as mips64."},
          {"name": "ppc64", "description": "Specifies the native client architecture as ppc64."},
          {"name": "loongarch64", "description": "Specifies the native client architecture as loongarch64."}
        ]
      },
      {
        "id": "PlatformInfo",
        "type": "object",
        "description": "An object containing information about the current platform.",
        "properties": {
          "os": {
            "$ref": "PlatformOs",
            "description": "The operating system Chrome is running on."
          },
          "arch": {
            "$ref": "PlatformArch",
            "description": "The machine's processor architecture."
          },
          "nacl_arch" : {
            "optional": true,
            "description": "The native client architecture. This may be different from arch on some platforms.",
            "$ref": "PlatformNaclArch"
          }
        }
      },
      {
        "id": "RequestUpdateCheckStatus",
        "type": "string",
        "enum": [
          {"name":  "throttled", "description": "Specifies that the status check has been throttled. This can occur after repeated checks within a short amount of time."},
          {"name": "no_update", "description": "Specifies that there are no available updates to install."},
          {"name": "update_available", "description": "Specifies that there is an available update to install."}
        ],
        "description": "Result of the update check."
      },
      {
        "id": "OnInstalledReason",
        "type": "string",
        "enum": [
          {"name": "install", "description": "Specifies the event reason as an installation."},
          {"name": "update", "description": "Specifies the event reason as an extension update."},
          {"name": "chrome_update", "description": "Specifies the event reason as a Chrome update."},
          {"name": "shared_module_update", "description": "Specifies the event reason as an update to a shared module."}
        ],
        "description": "The reason that this event is being dispatched."
      },
      {
        "id": "OnRestartRequiredReason",
        "type": "string",
        "description": "The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.",
        "enum": [
          {"name": "app_update", "description": "Specifies the event reason as an update to the app."},
          {"name": "os_update", "description": "Specifies the event reason as an update to the operating system."},
          {"name": "periodic", "description": "Specifies the event reason as a periodic restart of the app."}
        ]
      },
      {
        "id": "ContextType",
        "type": "string",
        "enum": [
          {"name": "TAB", "description": "Specifies the context type as a tab"},
          {"name": "POPUP", "description": "Specifies the context type as an extension popup window"},
          {"name": "BACKGROUND", "description": "Specifies the context type as a service worker."},
          {"name": "OFFSCREEN_DOCUMENT", "description": "Specifies the context type as an offscreen document."},
          {"name": "SIDE_PANEL", "description": "Specifies the context type as a side panel."},
          {"name": "DEVELOPER_TOOLS", "description": "Specifies the context type as developer tools."}
        ]
      },
      {
        "id": "ExtensionContext",
        "type": "object",
        "description": "A context hosting extension content.",
        "properties": {
          "contextType": {
            "$ref": "ContextType",
            "description": "The type of context this corresponds to."
          },
          "contextId": {
            "type": "string",
            "description": "A unique identifier for this context"
          },
          "tabId": {
            "type": "integer",
            "description": "The ID of the tab for this context, or -1 if this context is not hosted in a tab."
          },
          "windowId": {
            "type": "integer",
            "description": "The ID of the window for this context, or -1 if this context is not hosted in a window."
          },
          "documentId": {
            "type": "string",
            "optional": true,
            "description": "A UUID for the document associated with this context, or undefined if this context is hosted not in a document."
          },
          "frameId": {
            "type": "integer",
            "description": "The ID of the frame for this context, or -1 if this context is not hosted in a frame."
          },
          "documentUrl": {
            "type": "string",
            "optional": true,
            "description": "The URL of the document associated with this context, or undefined if the context is not hosted in a document."
          },
          "documentOrigin": {
            "type": "string",
            "optional": true,
            "description": "The origin of the document associated with this context, or undefined if the context is not hosted in a document."
          },
          "incognito": {
            "type": "boolean",
            "description": "Whether the context is associated with an incognito profile."
          }
        }
      },
      {
        "id": "ContextFilter",
        "type": "object",
        "description": "A filter to match against certain extension contexts. Matching contexts must match all specified filters; any filter that is not specified matches all available contexts. Thus, a filter of `{}` will match all available contexts.",
        "properties": {
          "contextTypes": {
            "type": "array",
            "items": { "$ref": "ContextType" },
            "optional": true
          },
          "contextIds": {
            "type": "array",
            "items": { "type": "string" },
            "optional": true
          },
          "tabIds": {
            "type": "array",
            "items": { "type": "integer" },
            "optional": true
          },
          "windowIds": {
            "type": "array",
            "items": { "type": "integer" },
            "optional": true
          },
          "documentIds": {
            "type": "array",
            "items": { "type": "string" },
            "optional": true
          },
          "frameIds": {
            "type": "array",
            "items": { "type": "integer" },
            "optional": true
          },
          "documentUrls": {
            "type": "array",
            "items": { "type": "string" },
            "optional": true
          },
          "documentOrigins": {
            "type": "array",
            "items": { "type": "string" },
            "optional": true
          },
          "incognito": {
            "type": "boolean",
            "optional": true
          }
        }
      }
    ],
    "properties": {
      "lastError": {
        "type": "object",
        "optional": true,
        "description": "Populated with an error message if calling an API function fails; otherwise undefined. This is only defined within the scope of that function's callback. If an error is produced, but <code>runtime.lastError</code> is not accessed within the callback, a message is logged to the console listing the API function that produced the error. API functions that return promises do not set this property.",
        "properties": {
          "message": {
            "optional": true,
            "type": "string",
            "description": "Details about the error which occurred."
          }
        }
      },
      "id": {
        "type": "string",
        "description": "The ID of the extension/app."
      }
    },
    "functions": [
      {
        "name": "getBackgroundPage",
        "type": "function",
        "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
        "parameters": [],
        "deprecated": "Background pages do not exist in MV3 extensions.",
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "backgroundPage",
              // Note: Only optional because we don't support validation
              // for custom callbacks.
              "optional": true,
              "type": "object",
              "isInstanceOf": "Window",
              "additionalProperties": { "type": "any" },
              "description": "The JavaScript 'window' object for the background page."
            }
          ]
        }
      },
      {
        "name": "openOptionsPage",
        "type": "function",
        "description": "<p>Open your Extension's options page, if possible.</p><p>The precise behavior may depend on your manifest's <a href=\"/docs/extensions/develop/ui/options-page#embedded_options\"><code>options_ui</code></a> or <a href=\"/docs/extensions/develop/ui/options-page#full_page\"><code>options_page</code></a> key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload.</p><p>If your Extension does not declare an options page, or Chrome failed to create one for some other reason, the callback will set $(ref:lastError).</p>",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [],
          "optional": true
        }
      },
      {
        "name": "getManifest",
        "description": "Returns details about the app or extension from the manifest. The object returned is a serialization of the full <a href=\"reference/manifest\">manifest file</a>.",
        "type": "function",
        "nocompile": true,
        "parameters": [],
        "returns": {
          "type": "object",
          "properties": {},
          "additionalProperties": { "type": "any" },
          "description": "The manifest details."
        }
      },
      {
        "name": "getVersion",
        "description": "Returns the extension's version as declared in the manifest.",
        "type": "function",
        "nocompile": true,
        "parameters": [],
        "returns": {
          "type": "string",
          "description": "The extension's version."
        }
      },
      {
        "name": "getURL",
        "type": "function",
        "nocompile": true,
        "description": "Converts a relative path within an app/extension install directory to a fully-qualified URL.",
        "parameters": [
          {
            "type": "string",
            "name": "path",
            "description": "A path to a resource within an app/extension expressed relative to its install directory."
          }
        ],
        "returns": {
          "type": "string",
          "description": "The fully-qualified URL to the resource."
        }
      },
      {
        "name": "setUninstallURL",
        "type": "function",
        "description": "Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 1023 characters.",
        "parameters": [
          {
            "type": "string",
            "name": "url",
            "maxLength": 1023,
            "description": "URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation."
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "description": "Promise that resolves when the uninstall URL is set. If the given URL is invalid, the promise will be rejected.",
          "parameters": []
        }
      },
      {
        "name": "reload",
        "description": "Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use chrome.runtime.restart() method.",
        "type": "function",
        "parameters": []
      },
      {
        "name": "requestUpdateCheck",
        "type": "function",
        "description": "<p>Requests an immediate update check be done for this app/extension.</p> <p><b>Important</b>: Most extensions/apps should <b>not</b> use this method, since Chrome already does automatic checks every few hours, and you can listen for the $(ref:runtime.onUpdateAvailable) event without needing to call requestUpdateCheck.</p><p>This method is only appropriate to call in very limited circumstances, such as if your extension talks to a backend service, and the backend service has determined that the client extension version is very far out of date and you'd like to prompt a user to update. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources.</p><p>Note: When called with a callback, instead of returning an object this function will return the two properties as separate arguments passed to the callback.</p>",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "type": "object",
              "name": "result",
              "description": "RequestUpdateCheckResult object that holds the status of the update check and any details of the result if there is an update available",
              "properties": {
                "status": {
                  "$ref": "RequestUpdateCheckStatus",
                  "description": "Result of the update check."
                },
                "version": {
                  "type": "string",
                  "optional": true,
                  "description": "If an update is available, this contains the version of the available update."
                }
              }
            }
          ]
        }
      },
      {
        "name": "restart",
        "description": "Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's no-op.",
        "type": "function",
        "parameters": []
      },
      {
        "name": "restartAfterDelay",
        "description": "Restart the ChromeOS device when the app runs in kiosk mode after the given seconds. If called again before the time ends, the reboot will be delayed. If called with a value of -1, the reboot will be cancelled. It's a no-op in non-kiosk mode. It's only allowed to be called repeatedly by the first extension to invoke this API.",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "seconds",
            "description": "Time to wait in seconds before rebooting the device, or -1 to cancel a scheduled reboot."
          }
        ],
        "returns_async": {
          "name": "callback",
          "description": "Promise that resolves when a restart request was successfully rescheduled.",
          "parameters": [],
          "optional": true
        }
      },
      {
        "name": "connect",
        "type": "function",
        "nocompile": true,
        "description": "Attempts to connect listeners within an extension (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and <a href=\"/docs/extensions/manifest/externally_connectable\">web messaging</a>. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect).",
        "parameters": [
          {"type": "string", "name": "extensionId", "optional": true, "description": "The ID of the extension to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for <a href=\"/docs/extensions/reference/manifest/externally-connectable\">web messaging</a>."},
          {
            "type": "object",
            "name": "connectInfo",
            "properties": {
              "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for processes that are listening for the connection event." },
              "includeTlsChannelId": { "type": "boolean", "optional": true, "description": "Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event." }
            },
            "optional": true
          }
        ],
        "returns": {
          "$ref": "Port",
          "description": "Port through which messages can be sent and received. The port's $(ref:Port onDisconnect) event is fired if the extension does not exist. "
        }
      },
      {
        "name": "connectNative",
        "type": "function",
        "nocompile": true,
        "description": "Connects to a native application in the host machine. This method requires the <code>\"nativeMessaging\"</code> permission. See <a href=\"develop/concepts/native-messaging\">Native Messaging</a> for more information.",
        "parameters": [
          {
            "type": "string",
            "name": "application",
            "description": "The name of the registered application to connect to."
          }
        ],
        "returns": {
          "$ref": "Port",
          "description": "Port through which messages can be sent and received with the application"
        }
      },
      {
        "name": "sendMessage",
        "type": "function",
        "nocompile": true,
        "description": "Sends a single message to event listeners within your extension or a different extension/app. Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. If sending to your extension, the $(ref:runtime.onMessage) event will be fired in every frame of your extension (except for the sender's frame), or $(ref:runtime.onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $(ref:tabs.sendMessage).",
        "parameters": [
          {"type": "string", "name": "extensionId", "optional": true, "description": "The ID of the extension to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for <a href=\"/docs/extensions/manifest/externally_connectable\">web messaging</a>."},
          { "type": "any", "name": "message", "description": "The message to send. This message should be a JSON-ifiable object." },
          {
            "type": "object",
            "name": "options",
            "properties": {
              "includeTlsChannelId": { "type": "boolean", "optional": true, "description": "Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event." }
            },
            "optional": true
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "description": "Promise support was added for extension contexts in Chrome 99. When communicating from a web page to an extension, promises are available from Chrome 118.",
          "parameters": [
            {
              "name": "response",
              "type": "any",
              "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message."
            }
          ]
        }
      },
      {
        "name": "sendNativeMessage",
        "type": "function",
        "nocompile": true,
        "description": "Send a single message to a native application. This method requires the <code>\"nativeMessaging\"</code> permission.",
        "parameters": [
          {
            "name": "application",
            "description": "The name of the native messaging host.",
            "type": "string"
          },
          {
            "name": "message",
            "description": "The message that will be passed to the native messaging host.",
            "type": "object",
            "additionalProperties": {
              "type": "any"
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": [
            {
              "name": "response",
              "type": "any",
              "description": "The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message.",
              "additionalProperties": {
                "type": "any"
              }
            }
          ]
        }
      },
      {
        "name": "getPlatformInfo",
        "type": "function",
        "description": "Returns information about the current platform.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "description": "Promise that resolves with information about the current platform.",
          "parameters": [
            {
              "name": "platformInfo",
              "$ref": "PlatformInfo"
            }
          ]
        }
      },
      {
        "name": "getPackageDirectoryEntry",
        "type": "function",
        "description": "Returns a DirectoryEntry for the package directory.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "directoryEntry",
              "type": "object",
              "additionalProperties": { "type": "any" },
              "isInstanceOf": "DirectoryEntry"
            }
          ]
        }
      },
      {
        "name": "getContexts",
        "type": "function",
        "description": "Fetches information about active contexts associated with this extension",
        "parameters": [
          {
            "$ref": "ContextFilter",
            "name": "filter",
            "description": "A filter to find matching contexts. A context matches if it matches all specified fields in the filter. Any unspecified field in the filter matches all contexts."
          }
        ],
        "returns_async": {
          "name": "callback",
          "description": "Promise that resolves with the matching contexts, if any.",
          "parameters": [
            {
              "name": "contexts",
              "type": "array",
              "description": "The matching contexts, if any.",
              "items": { "$ref": "ExtensionContext" }
            }
          ]
        }
      }
    ],
    "events": [
      {
        "name": "onStartup",
        "type": "function",
        "description": "Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode."
      },
      {
        "name": "onInstalled",
        "type": "function",
        "description": "Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version.",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "properties": {
              "reason": {
                "$ref": "OnInstalledReason",
                "description": "The reason that this event is being dispatched."
              },
              "previousVersion": {
                "type": "string",
                "optional": true,
                "description": "Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'."
              },
              "id": {
                "type": "string",
                "optional": true,
                "description": "Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'."
              }
            }
          }
        ]
      },
      {
        "name": "onSuspend",
        "type": "function",
        "description": "Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. "
      },
      {
        "name": "onSuspendCanceled",
        "type": "function",
        "description": "Sent after onSuspend to indicate that the app won't be unloaded after all."
      },
      {
        "name": "onUpdateAvailable",
        "type": "function",
        "description": "Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call chrome.runtime.reload() manually in response to this event the update will not get installed until the next time Chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if chrome.runtime.reload() is called in response to this event.",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "properties": {
              "version": {
                "type": "string",
                "description": "The version number of the available update."
              }
            },
            "additionalProperties": { "type": "any" },
            "description": "The manifest details of the available update."
          }
        ]
      },
      {
        // TODO(xiyuan): onBrowserUpdateAvailable is deprecated in favor of
        // onRestartRequired. We should remove it when we are sure it is unused.
        "name": "onBrowserUpdateAvailable",
        "type": "function",
        "description": "Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required.",
        "deprecated": "Please use $(ref:runtime.onRestartRequired).",
        "parameters": []
      },
      {
        "name": "onConnect",
        "type": "function",
        "nocompile": true,
        "options": {
          "unmanaged": true
        },
        "description": "Fired when a connection is made from either an extension process or a content script (by $(ref:runtime.connect)).",
        "parameters": [
          {"$ref": "Port", "name": "port"}
        ]
      },
      {
        "name": "onConnectExternal",
        "type": "function",
        "nocompile": true,
        "description": "Fired when a connection is made from another extension (by $(ref:runtime.connect)), or from an externally connectable web site.",
        "parameters": [
          {"$ref": "Port", "name": "port"}
        ]
      },
      {
        "name": "onUserScriptConnect",
        "type": "function",
        "nocompile": true,
        "options": { "unmanaged": true },
        "description": "Fired when a connection is made from a user script from this extension.",
        "parameters": [
          {"$ref": "Port", "name": "port"}
        ]
      },
      {
        "name": "onConnectNative",
        "type": "function",
        "nocompile": true,
        "description": "Fired when a connection is made from a native application. This event requires the <code>\"nativeMessaging\"</code> permission. It is only supported on Chrome OS.",
        "parameters": [
          {"$ref": "Port", "name": "port"}
        ]
      },
      {
        "name": "onMessage",
        "type": "function",
        "nocompile": true,
        "options": {
          "unmanaged": true
        },
        "description": "Fired when a message is sent from either an extension process (by $(ref:runtime.sendMessage)) or a content script (by $(ref:tabs.sendMessage)).",
        "parameters": [
          {"name": "message", "type": "any", "optional": true, "description": "The message sent by the calling script."},
          {"name": "sender", "$ref": "MessageSender" },
          {
            "name": "sendResponse",
            "type": "function",
            "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, <strong>unless you return true</strong> from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called).",
            "parameters": [
              {"name": "response", "type": "any", "optional": true, "description": "The response to return to the message sender."}
            ]
          }
        ],
        "returns": {
          "choices": [
            {"type": "boolean"},
            {"type": "object", "isInstanceOf": "Promise"}
          ],
          "optional": true,
          "description": "Return true (or a Promise) from the event listener if you wish to call <code>sendResponse</code> after the event listener returns."
        }
      },
      {
        "name": "onMessageExternal",
        "type": "function",
        "nocompile": true,
        "options": { "unmanaged": true },
        "description": "Fired when a message is sent from another extension (by $(ref:runtime.sendMessage)). Cannot be used in a content script.",
        "parameters": [
          {"name": "message", "type": "any", "optional": true, "description": "The message sent by the calling script."},
          {"name": "sender", "$ref": "MessageSender" },
          {
            "name": "sendResponse",
            "type": "function",
            "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, <strong>unless you return true</strong> from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called).",
            "parameters": [
              {"name": "response", "type": "any", "optional": true, "description": "The response to return to the message sender."}
            ]
          }
        ],
        "returns": {
          "choices": [
            {"type": "boolean"},
            {"type": "object", "isInstanceOf": "Promise"}
          ],
          "optional": true,
          "description": "Return true (or a Promise) from the event listener if you wish to call <code>sendResponse</code> after the event listener returns."
        }
      },
      {
        "name": "onUserScriptMessage",
        "type": "function",
        "nocompile": true,
        "options": { "unmanaged": true },
        "description": "Fired when a message is sent from a user script associated with the same extension.",
        "parameters": [
          {"name": "message", "type": "any", "optional": true, "description": "The message sent by the user script."},
          {"name": "sender", "$ref": "MessageSender" },
          {
            "name": "sendResponse",
            "type": "function",
            "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, <strong>unless you return true</strong> from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called).",
            "parameters": [
              {"name": "response", "type": "any", "optional": true, "description": "The response to return to the message sender."}
            ]
          }
        ],
        "returns": {
          "type": "boolean",
          "optional": true,
          "description": "Return true from the event listener if you wish to call <code>sendResponse</code> after the event listener returns."
        }
      },
      {
        "name": "onRestartRequired",
        "type": "function",
        "description": "Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps.",
        "parameters": [
          {
            "$ref": "OnRestartRequiredReason",
            "name": "reason",
            "description": "The reason that the event is being dispatched."
          }
        ]
      }
    ]
  }
]