blob: 62e9e67c449d4b7020bf000ea932d51e86c38d38 [file] [log] [blame]
Blink Reformat4c46d092018-04-07 15:32:371/*
2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
Tim van der Lippe29fab472019-08-15 14:46:4831/* eslint-disable no-unused-vars */
32
Erik Luo66e332c2018-04-09 18:00:1433// Blink Web Facing API
Blink Reformat4c46d092018-04-07 15:32:3734
35/**
36 * @param {!Object} object
37 * @param {!Function} callback
38 */
39Object.observe = function(object, callback) {};
40
41/** @type {boolean} */
42Event.prototype.isMetaOrCtrlForTest;
43
44/** @type {string} */
45Event.prototype.code;
46
47/**
Blink Reformat4c46d092018-04-07 15:32:3748 * @type {number}
49 */
50KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;
51
52/**
53 * @param {!T} value
54 * @param {boolean=} onlyFirst
55 * @this {Array.<T>}
56 * @template T
57 */
58Array.prototype.remove = function(value, onlyFirst) {};
59/**
Blink Reformat4c46d092018-04-07 15:32:3760 * @return {!Object.<string, boolean>}
61 * @this {Array.<T>}
62 * @template T
63 */
64Array.prototype.keySet = function() {};
65/**
Blink Reformat4c46d092018-04-07 15:32:3766 * @param {!S} object
67 * @param {function(!S,!T):number=} comparator
68 * @param {number=} left
69 * @param {number=} right
70 * @return {number}
71 * @this {Array.<T>}
72 * @template S
73 */
74Array.prototype.lowerBound = function(object, comparator, left, right) {};
75/**
76 * @param {!S} object
77 * @param {function(!S,!T):number=} comparator
78 * @param {number=} left
79 * @param {number=} right
80 * @return {number}
81 * @this {Array.<T>}
82 * @template S
83 */
84Array.prototype.upperBound = function(object, comparator, left, right) {};
85/**
86 * @param {!S} value
87 * @param {function(!S,!T):number} comparator
88 * @return {number}
89 * @this {Array.<T>}
90 * @template S
91 */
92Array.prototype.binaryIndexOf = function(value, comparator) {};
93/**
94 * @param {function(number, number): number} comparator
95 * @param {number} leftBound
96 * @param {number} rightBound
97 * @param {number} sortWindowLeft
98 * @param {number} sortWindowRight
99 * @return {!Array.<number>}
100 * @this {Array.<number>}
101 */
102Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {};
103
104/**
Blink Reformat4c46d092018-04-07 15:32:37105 * @this {Array.<number>}
106 * @param {function(number,number):boolean} comparator
107 * @param {number} left
108 * @param {number} right
109 * @param {number} pivotIndex
110 * @return {number}
111 */
112Array.prototype.partition = function(comparator, left, right, pivotIndex) {};
113
114/**
Blink Reformat4c46d092018-04-07 15:32:37115 * @param {string} field
116 * @return {!Array.<!T>}
117 * @this {Array.<!Object.<string,T>>}
118 * @template T
119 */
120Array.prototype.select = function(field) {};
121
122/**
123 * @return {!T|undefined}
124 * @this {Array.<T>}
125 * @template T
126 */
127Array.prototype.peekLast = function() {};
128
129/**
130 * @param {!Array.<T>} array
131 * @param {function(T,T):number} comparator
132 * @return {!Array.<T>}
133 * @this {!Array.<T>}
134 * @template T
135 */
136Array.prototype.intersectOrdered = function(array, comparator) {};
137
138/**
139 * @param {!Array.<T>} array
140 * @param {function(T,T):number} comparator
141 * @return {!Array.<T>}
142 * @this {!Array.<T>}
143 * @template T
144 */
145Array.prototype.mergeOrdered = function(array, comparator) {};
146
147/**
148 * @param {number} object
149 * @param {function(number, number):number=} comparator
150 * @param {number=} left
151 * @param {number=} right
152 * @return {number}
153 */
154Int32Array.prototype.lowerBound = function(object, comparator, left, right) {};
155
Tim van der Lippe29fab472019-08-15 14:46:48156// TODO(luoe): remove these BigInt and ArrayLike types once closure supports them.
Blink Reformat4c46d092018-04-07 15:32:37157/**
158 * @param {number|string} value
159 */
160const BigInt = function(value) {};
161
162/** @typedef {*} */
163const bigint = null;
164
Tim van der Lippe29fab472019-08-15 14:46:48165/** @typedef {Array|NodeList|Arguments|{length: number}} */
166let ArrayLike;
167
Blink Reformat4c46d092018-04-07 15:32:37168/**
169 * @type {*}
170 */
171window.domAutomationController;
172
173const DevToolsHost = function() {};
174
175/** @typedef {{type:string, id:(number|undefined),
176 label:(string|undefined), enabled:(boolean|undefined), checked:(boolean|undefined),
177 subItems:(!Array.<!DevToolsHost.ContextMenuDescriptor>|undefined)}} */
178DevToolsHost.ContextMenuDescriptor;
179
180/**
181 * @return {number}
182 */
183DevToolsHost.zoomFactor = function() {};
184
185/**
186 * @param {string} text
187 */
188DevToolsHost.copyText = function(text) {};
189
190/**
191 * @return {string}
192 */
193DevToolsHost.platform = function() {};
194
195/**
196 * @param {number} x
197 * @param {number} y
198 * @param {!Array.<!DevToolsHost.ContextMenuDescriptor>} items
199 * @param {!Document} document
200 */
201DevToolsHost.showContextMenuAtPoint = function(x, y, items, document) {};
202
203/**
204 * @param {string} message
205 */
206DevToolsHost.sendMessageToEmbedder = function(message) {};
207
208/**
209 * @return {string}
210 */
211DevToolsHost.getSelectionBackgroundColor = function() {};
212
213/**
214 * @return {string}
215 */
216DevToolsHost.getSelectionForegroundColor = function() {};
217
218/**
219 * @return {string}
220 */
221DevToolsHost.getInactiveSelectionBackgroundColor = function() {};
222
223/**
224 * @return {string}
225 */
226DevToolsHost.getInactiveSelectionForegroundColor = function() {};
227
228/**
229 * @return {boolean}
230 */
231DevToolsHost.isHostedMode = function() {};
232
233/**
234 * @param {string} fileSystemId
235 * @param {string} registeredName
Tim van der Lipped71c22d2020-03-19 12:29:19236 * @return {?FileSystem}
Blink Reformat4c46d092018-04-07 15:32:37237 */
238DevToolsHost.isolatedFileSystem = function(fileSystemId, registeredName) {};
239
240/**
241 * @param {!FileSystem} fileSystem
242 */
243DevToolsHost.upgradeDraggedFileSystemPermissions = function(fileSystem) {};
244
245/** Extensions API */
246
247/** @constructor */
248function EventSink() {
249}
250/** @constructor */
251function ExtensionSidebarPane() {
252}
253/** @constructor */
254function Panel() {
255}
256/** @constructor */
257function PanelWithSidebar() {
258}
259/** @constructor */
260function Resource() {
261}
262
263let extensionServer;
264
265/**
266 * @constructor
267 */
268function ExtensionDescriptor() {
269 this.startPage = '';
270 this.name = '';
271 this.exposeExperimentalAPIs = false;
272}
273
274/**
275 * @constructor
276 */
277function ExtensionReloadOptions() {
278 this.ignoreCache = false;
279 this.injectedScript = '';
280 this.userAgent = '';
281}
282
283const Adb = {};
284/** @typedef {{id: string, name: string, url: string, attached: boolean}} */
285Adb.Page;
286/** @typedef {{id: string, adbBrowserChromeVersion: string, compatibleVersion: boolean, adbBrowserName: string, source: string, adbBrowserVersion: string, pages: !Array<!Adb.Page>}} */
287Adb.Browser;
288/** @typedef {{id: string, adbModel: string, adbSerial: string, browsers: !Array.<!Adb.Browser>, adbPortStatus: !Array.<number>, adbConnected: boolean}} */
289Adb.Device;
290/** @typedef {!Object.<string, string>} */
291Adb.PortForwardingConfig;
292/** @typedef {!{port: string, address: string}} */
293Adb.PortForwardingRule;
294/** @typedef {{ports: !Object<string, number>, browserId: string}} */
295Adb.DevicePortForwardingStatus;
296/** @typedef {!Object<string, !Adb.DevicePortForwardingStatus>} */
297Adb.PortForwardingStatus;
298/** @typedef {!Array<string>} */
299Adb.NetworkDiscoveryConfig;
300/**
301 * @typedef {!{
302 * discoverUsbDevices: boolean,
303 * portForwardingEnabled: boolean,
304 * portForwardingConfig: !Adb.PortForwardingConfig,
305 * networkDiscoveryEnabled: boolean,
306 * networkDiscoveryConfig: !Adb.NetworkDiscoveryConfig
307 * }}
308 */
309Adb.Config;
310
311/** @const */
312const module = {};
313
314/**
315 * @constructor
316 */
317function diff_match_patch() {
318}
319
320diff_match_patch.prototype = {
321 /**
322 * @param {string} text1
323 * @param {string} text2
324 * @return {!Array.<!{0: number, 1: string}>}
325 */
326 diff_main: function(text1, text2) {},
327
328 /**
329 * @param {!Array.<!{0: number, 1: string}>} diff
330 */
331 diff_cleanupSemantic(diff) {}
332};
333
334/** @constructor */
335const Doc = function() {};
336Doc.prototype = {
337 /** @type {number} */
338 scrollLeft: 0,
339 /** @type {number} */
340 scrollTop: 0
341};
342
343/** @constructor */
344const CodeMirror = function(element, config) {};
345CodeMirror.on = function(obj, type, handler) {};
346CodeMirror.prototype = {
347 /** @type {!Doc} */
348 doc: null,
349 addKeyMap: function(map) {},
350 addLineClass: function(handle, where, cls) {},
351 /**
352 * @param {?Object=} options
353 * @return {!CodeMirror.LineWidget}
354 */
355 addLineWidget: function(handle, node, options) {},
356 /**
357 * @param {string|!Object} spec
358 * @param {!Object=} options
359 */
360 addOverlay: function(spec, options) {},
361 addWidget: function(pos, node, scroll, vert, horiz) {},
Joel Einbinderd7595c72018-05-15 17:41:54362 /** @param {boolean=} isClosed bv */
363 changeGeneration: function(isClosed) {},
Blink Reformat4c46d092018-04-07 15:32:37364 charCoords: function(pos, mode) {},
365 clearGutter: function(gutterID) {},
366 clearHistory: function() {},
367 clipPos: function(pos) {},
368 /** @param {string=} mode */
369 coordsChar: function(coords, mode) {},
370 /** @param {string=} mode */
371 cursorCoords: function(start, mode) {},
372 defaultCharWidth: function() {},
373 defaultTextHeight: function() {},
374 deleteH: function(dir, unit) {},
375 /**
376 * @param {*=} to
377 * @param {*=} op
378 */
379 eachLine: function(from, to, op) {},
380 execCommand: function(cmd) {},
381 extendSelection: function(from, to) {},
382 findMarks: function(from, to) {},
383 findMarksAt: function(pos) {},
384 /**
385 * @param {!CodeMirror.Pos} from
386 * @param {boolean=} strict
387 * @param {Object=} config
388 */
389 findMatchingBracket: function(from, strict, config) {},
390 findPosH: function(from, amount, unit, visually) {},
391 findPosV: function(from, amount, unit, goalColumn) {},
392 firstLine: function() {},
393 focus: function() {},
394 getAllMarks: function() {},
395 /** @param {string=} start */
396 getCursor: function(start) {},
397 getDoc: function() {},
398 getGutterElement: function() {},
399 getHistory: function() {},
400 getInputField: function() {},
401 getLine: function(line) {},
402 /**
403 * @return {!{wrapClass: string, height: number}}
404 */
405 getLineHandle: function(line) {},
406 getLineNumber: function(line) {},
407 /**
408 * @return {!{token: function(CodeMirror.StringStream, Object):string}}
409 */
410 getMode: function() {},
411 getOption: function(option) {},
412 /** @param {*=} lineSep */
413 getRange: function(from, to, lineSep) {},
414 /**
415 * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}}
416 */
417 getScrollInfo: function() {},
418 getScrollerElement: function() {},
419 getSelection: function() {},
420 getSelections: function() {},
421 getStateAfter: function(line) {},
422 getTokenAt: function(pos) {},
423 /** @param {*=} lineSep */
424 getValue: function(lineSep) {},
425 getViewport: function() {},
426 getWrapperElement: function() {},
427 hasFocus: function() {},
428 historySize: function() {},
429 indentLine: function(n, dir, aggressive) {},
430 indentSelection: function(how) {},
431 indexFromPos: function(coords) {},
Joel Einbinderd7595c72018-05-15 17:41:54432 /** @param {number=} generation */
433 isClean: function(generation) {},
Blink Reformat4c46d092018-04-07 15:32:37434 iterLinkedDocs: function(f) {},
435 lastLine: function() {},
436 lineCount: function() {},
437 lineInfo: function(line) {},
438 /**
439 * @param {number} height
440 * @param {string=} mode
441 */
442 lineAtHeight: function(height, mode) {},
443 linkedDoc: function(options) {},
444 listSelections: function() {},
445 markClean: function() {},
446 markText: function(from, to, options) {},
447 moveH: function(dir, unit) {},
448 moveV: function(dir, unit) {},
449 off: function(type, f) {},
450 on: function(type, f) {},
451 operation: function(f) {},
452 posFromIndex: function(off) {},
453 redo: function() {},
454 refresh: function() {},
455 removeKeyMap: function(map) {},
456 removeLine: function(line) {},
457 removeLineClass: function(handle, where, cls) {},
458 removeLineWidget: function(widget) {},
459 removeOverlay: function(spec) {},
460 /** @param {*=} origin */
461 replaceRange: function(code, from, to, origin) {},
462 /**
463 * @param {string} replacement
464 * @param {string=} select
465 */
466 replaceSelection: function(replacement, select) {},
467 /**
468 * @param {!Array.<string>} textPerSelection
469 */
470 replaceSelections: function(textPerSelection) {},
471 /** @param {*=} margin */
472 scrollIntoView: function(pos, margin) {},
473 scrollTo: function(x, y) {},
474 setBookmark: function(pos, options) {},
475 setCursor: function(line, ch, extend) {},
476 setExtending: function(val) {},
477 setGutterMarker: function(line, gutterID, value) {},
478 setHistory: function(histData) {},
479 setLine: function(line, text) {},
480 setOption: function(option, value) {},
Joel Einbinder5d6cc6e2018-05-05 06:29:47481 setSelection: function(anchor, head, options) {},
Blink Reformat4c46d092018-04-07 15:32:37482 /**
483 * @param {number=} primaryIndex
484 * @param {?Object=} config
485 */
486 setSelections: function(selections, primaryIndex, config) {},
487 setSize: function(width, height) {},
488 setValue: function(code) {},
489 somethingSelected: function() {},
490 swapDoc: function(doc) {},
491 undo: function() {},
492 unlinkDoc: function(other) {}
493};
Joel Einbinderbbaf3832018-12-15 00:05:35494/** @type {!{cursorDiv: Element, lineSpace: Element, gutters: Element}} */
Blink Reformat4c46d092018-04-07 15:32:37495CodeMirror.prototype.display;
John Emaud3bef012019-06-05 18:08:40496/** @type {!{devtoolsAccessibleName: string, mode: string, lineWrapping: boolean}} */
Blink Reformat4c46d092018-04-07 15:32:37497CodeMirror.prototype.options;
498/** @type {!Object} */
499CodeMirror.Pass;
500CodeMirror.showHint = function(codeMirror, hintintFunction) {};
501CodeMirror.commands = {};
502CodeMirror.modes = {};
503CodeMirror.mimeModes = {};
504CodeMirror.getMode = function(options, spec) {};
505CodeMirror.overlayMode = function(mode1, mode2, squashSpans) {};
506CodeMirror.defineMode = function(modeName, modeConstructor) {};
507CodeMirror.startState = function(mode) {};
508CodeMirror.copyState = function(mode, state) {};
Joel Einbinderf5ea74e2018-06-05 02:14:19509CodeMirror.inputStyles = {};
510CodeMirror.inputStyles.textarea = class {
511 constructor() {
512 /** @type {!HTMLTextAreaElement} */
513 this.textarea;
514 this.prevInput = '';
515 this.composing = false;
516 this.contextMenuPending = false;
517 /** @type {!CodeMirror} */
518 this.cm;
519 }
520 /**
521 * @param {!Object} display
522 */
523 init(display) {
524 }
525
526 /**
527 * @param {boolean=} typing
528 */
529 reset(typing) {
530 }
531
532 /**
533 * @return {boolean}
534 */
535 poll() {
536 return false;
537 }
538};
Blink Reformat4c46d092018-04-07 15:32:37539
540/** @typedef {{canceled: boolean, from: !CodeMirror.Pos, to: !CodeMirror.Pos, text: string, origin: string, cancel: function()}} */
541CodeMirror.BeforeChangeObject;
542
543/** @typedef {{from: !CodeMirror.Pos, to: !CodeMirror.Pos, origin: string, text: !Array.<string>, removed: !Array.<string>}} */
544CodeMirror.ChangeObject;
545
546/** @constructor */
547CodeMirror.Pos = function(line, ch) {};
548/** @type {number} */
549CodeMirror.Pos.prototype.line;
550/** @type {number} */
551CodeMirror.Pos.prototype.ch;
552
553/**
554 * @param {!CodeMirror.Pos} pos1
555 * @param {!CodeMirror.Pos} pos2
556 * @return {number}
557 */
558CodeMirror.cmpPos = function(pos1, pos2) {};
559
Ng Zhi Anb674ea32020-06-03 17:46:29560/**
561 * @constructor
562 * @param {(!Array<string>|string)} line
563 * @param {number=} index
564 */
565CodeMirror.StringStream = function(line, index) {
Blink Reformat4c46d092018-04-07 15:32:37566 this.pos = 0;
567 this.start = 0;
568};
Ng Zhi Anb674ea32020-06-03 17:46:29569
Blink Reformat4c46d092018-04-07 15:32:37570CodeMirror.StringStream.prototype = {
571 backUp: function(n) {},
572 column: function() {},
573 current: function() {},
574 eat: function(match) {},
575 eatSpace: function() {},
576 eatWhile: function(match) {},
577 eol: function() {},
578 indentation: function() {},
579 /**
580 * @param {!RegExp|string} pattern
581 * @param {boolean=} consume
582 * @param {boolean=} caseInsensitive
583 */
584 match: function(pattern, consume, caseInsensitive) {},
585 next: function() {},
586 peek: function() {},
587 skipTo: function(ch) {},
588 skipToEnd: function() {},
589 sol: function() {}
590};
591
592/** @constructor */
593CodeMirror.TextMarker = function(doc, type) {};
594CodeMirror.TextMarker.prototype = {
595 clear: function() {},
596 find: function() {},
597 changed: function() {}
598};
599
600/** @constructor */
601CodeMirror.LineWidget = function() {};
602CodeMirror.LineWidget.prototype = {
603 clear: function() {}
604};
605
606/** @type {Object.<string, !Object.<string, string>>} */
607CodeMirror.keyMap;
608
609/** @type {{scrollLeft: number, scrollTop: number}} */
610CodeMirror.doc;
611
612/**
613 * @param {string} mime
614 * @param {string} mode
615 */
616CodeMirror.defineMIME = function(mime, mode) {};
617
618/** @type {boolean} */
619window.dispatchStandaloneTestRunnerMessages;
620
Gaoping Huang1e081662019-10-03 20:22:56621const dagre = {};
622dagre.graphlib = {};
623/**
624 * @constructor
625 */
626dagre.graphlib.Graph = function() {};
627
628dagre.graphlib.json = {};
629
630/**
631 * @param {string} graphData
632 * @return {!dagre.graphlib.Graph}
633 */
634dagre.graphlib.json.read = function(graphData) {};
635
636/**
637 * @param {!dagre.graphlib.Graph} graph
638 * @return {string}
639 */
640dagre.graphlib.json.write = function(graph) {};
641
642/**
643 * @param {!dagre.graphlib.Graph} graph
644 * @param {?Object=} options
645 */
646dagre.layout = function(graph, options) {};
647// Since the object types in JSDoc should use capitalized `Dagre`, dagre is renamed as Dagre below.
648// Note that `var Dagre={}` will be added in dagre_module.js, so to prevent variable redefinition,
649// the workaround is to name the module+folder as `dagre_layout`. This workaround is similar to
650// `cm` and `CodeMirror`.
651const Dagre = dagre;
652
Blink Reformat4c46d092018-04-07 15:32:37653const ESTree = {};
654
655/**
656 * @constructor
657 */
658ESTree.Node = function() {
659 /** @type {number} */
660 this.start;
661 /** @type {number} */
662 this.end;
663 /** @type {string} */
664 this.type;
665 /** @type {(!ESTree.Node|undefined)} */
Tim van der Lippe1cf8e422020-03-12 16:09:21666 this.key;
667 /** @type {(!ESTree.Node|undefined)} */
Blink Reformat4c46d092018-04-07 15:32:37668 this.body;
669 /** @type {(!Array.<!ESTree.Node>|undefined)} */
670 this.declarations;
671 /** @type {(!Array.<!ESTree.Node>|undefined)} */
672 this.properties;
673 /** @type {(!ESTree.Node|undefined)} */
674 this.init;
675 /** @type {(!Array.<!ESTree.Node>|undefined)} */
676 this.params;
677 /** @type {(string|undefined)} */
678 this.name;
679 /** @type {(?ESTree.Node|undefined)} */
680 this.id;
681 /** @type {(number|undefined)} */
682 this.length;
683 /** @type {(?ESTree.Node|undefined)} */
684 this.argument;
685 /** @type {(string|undefined)} */
686 this.operator;
687 /** @type {(!ESTree.Node|undefined)} */
688 this.right;
689 /** @type {(!ESTree.Node|undefined)} */
690 this.left;
691 /** @type {(string|undefined)} */
692 this.kind;
693 /** @type {(!ESTree.Node|undefined)} */
694 this.property;
695 /** @type {(!ESTree.Node|undefined)} */
696 this.object;
697 /** @type {(string|undefined)} */
698 this.raw;
699 /** @type {(boolean|undefined)} */
700 this.computed;
701};
702
703/**
704 * @extends {ESTree.Node}
705 * @constructor
706 */
707ESTree.TemplateLiteralNode = function() {
708 /** @type {!Array.<!ESTree.Node>} */
709 this.quasis;
710 /** @type {!Array.<!ESTree.Node>} */
711 this.expressions;
712};
713
714/**
715 * @type {string}
716 * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object
717 * TODO(jsbell): DOMException should be a subclass of Error.
718 */
719DOMException.prototype.message;
720/** @type {number} */
721DOMException.ABORT_ERR;
722
723/**
724 * @constructor
725 * @param {!Object} params
726 */
727const Terminal = function(params) {};
728
729Terminal.prototype = {
730 fit: function() {},
731 linkify: function() {},
732 /** @param {!Element} element */
733 open: function(element) {},
734 /** @param {string} eventName * @param {!Function} handler */
735 on: function(eventName, handler) {}
736};
737
738/**
739 * @param {string} context
740 * @return {!Console}
741 */
742Console.prototype.context = function(context) {};
743
Tim van der Lippe29fab472019-08-15 14:46:48744// Globally defined functions
Blink Reformat4c46d092018-04-07 15:32:37745
746/**
747 * @param {!Array<string>|string} strings
748 * @param {...*} vararg
749 * @return {string}
750 */
751const ls = function(strings, vararg) {};
752
753/**
Tim van der Lippe29fab472019-08-15 14:46:48754* @param {string} tagName
755* @param {string=} customElementType
756* @return {!Element}
757*/
758const createElement = function(tagName, customElementType) {};
759
760/**
761 * @param {number|string} data
762 * @return {!Text}
763 */
764const createTextNode = function(data) {};
765
766/**
Tim van der Lippe29fab472019-08-15 14:46:48767 * @param {string} childType
768 * @param {string=} className
769 * @return {!Element}
770 */
771const createSVGElement = function(childType, className) {};
772
773/**
774 * @return {!DocumentFragment}
775 */
776const createDocumentFragment = function() {};
777
778/**
779 * @param {!Event} event
780 * @return {boolean}
781 */
782const isEnterKey = function(event) {};
783
784/**
785 * @param {!Event} event
786 * @return {boolean}
787 */
788const isEnterOrSpaceKey = function(event) {};
789
790/**
791 * @param {!Event} event
792 * @return {boolean}
793 */
794const isEscKey = function(event) {};
795
796/**
Tim van der Lipped71c22d2020-03-19 12:29:19797 * @param {!{startPage: string, name: string, exposeExperimentalAPIs: boolean}} extensionInfo
Tim van der Lippe29fab472019-08-15 14:46:48798 * @param {string} inspectedTabId
799 * @param {string} themeName
800 * @param {!Array<number>} keysToForward
801 * @param {function(!Object, !Object)|undefined} testHook
802 * @return {string}
803 */
804const buildExtensionAPIInjectedScript = function(extensionInfo, inspectedTabId, themeName, keysToForward, testHook) {};
805
806/**
807 * @param {number} m
808 * @param {number} n
809 * @return {number}
810 */
811const mod = function(m, n) {};
812
813/**
814 * @param {string} query
815 * @param {boolean} caseSensitive
816 * @param {boolean} isRegex
817 * @return {!RegExp}
818 */
819const createSearchRegex = function(query, caseSensitive, isRegex) {};
820
821/**
822 * @param {string} query
823 * @param {string=} flags
824 * @return {!RegExp}
825 */
826const createPlainTextSearchRegex = function(query, flags) {};
827
828/**
Tim van der Lippe29fab472019-08-15 14:46:48829 * @param {number} spacesCount
830 * @return {string}
831 */
832const spacesPadding = function(spacesCount) {};
833
834/**
835 * @param {number} value
836 * @param {number} symbolsCount
837 * @return {string}
838 */
839const numberToStringWithSpacesPadding = function(value, symbolsCount) {};
840
841/**
Tim van der Lippe29fab472019-08-15 14:46:48842 * @param {*} value
843 */
844const suppressUnused = function(value) {};
845
846/**
847 * TODO: move into its own module
848 * @param {function()} callback
849 */
850const runOnWindowLoad = function(callback) {};
851
852/**
853 * @template T
854 * @param {function(new:T, ...)} constructorFunction
855 * @return {!T}
856 */
857const singleton = function(constructorFunction) {};
858
859/**
860 * @param {?string} content
861 * @return {number}
862 */
863const base64ToSize = function(content) {};
864
865/**
Mathias Bynens2670a652019-12-20 09:21:07866 * @param {?string} input
867 * @return {string}
868 */
869const unescapeCssString = function(input) {};
870
871/**
Blink Reformat4c46d092018-04-07 15:32:37872 * @constructor
873 * @param {function(!Array<*>)} callback
874 */
875const ResizeObserver = function(callback) {};
Paul Irish8f1e33d2018-05-31 02:29:50876
877
878// Lighthouse Report Renderer
879
880/**
881 * @constructor
882 * @param {!Document} document
883 */
884const DOM = function(document) {};
885
886/**
887 * @constructor
888 * @param {!DOM} dom
889 */
890const ReportRenderer = function(dom) {};
891
892ReportRenderer.prototype = {
893 /**
894 * @param {!ReportRenderer.ReportJSON} report
895 * @param {!Element} container Parent element to render the report into.
896 */
897 renderReport: function(report, container) {},
898
899 /**
900 * @param {!Document|!Element} context
901 */
902 setTemplateContext: function(context) {},
903
904};
905
906/**
[email protected]f2f8c092019-05-30 22:01:56907 * @constructor
908 * @param {!DOM} dom
909 */
[email protected]c5214af2019-06-25 20:31:21910const ReportUIFeatures = function(dom) {
911 /** @type {!ReportRenderer.ReportJSON} */
912 this.json;
913
914 /** @type {!Document} */
915 this._document;
916};
[email protected]f2f8c092019-05-30 22:01:56917
918ReportUIFeatures.prototype = {
919 /**
920 * @param {!Document|!Element} context
921 */
922 setTemplateContext: function(context) {},
923
924 /**
925 * @param {!ReportRenderer.ReportJSON} report
926 */
927 initFeatures: function(report) {},
[email protected]c5214af2019-06-25 20:31:21928
929 _resetUIState: function() {},
[email protected]f2f8c092019-05-30 22:01:56930};
931
932/**
Paul Irish8f1e33d2018-05-31 02:29:50933 * @typedef {{
934 * rawValue: (number|boolean|undefined),
935 * id: string,
936 * title: string,
937 * description: string,
938 * explanation: (string|undefined),
939 * errorMessage: (string|undefined),
940 * displayValue: (string|Array<string|number>|undefined),
941 * scoreDisplayMode: string,
942 * error: boolean,
943 * score: (number|null),
944 * details: (!DetailsRenderer.DetailsJSON|undefined),
945 * }}
946 */
947ReportRenderer.AuditResultJSON;
948
949/**
950 * @typedef {{
951 * id: string,
952 * score: (number|null),
953 * weight: number,
954 * group: (string|undefined),
955 * result: ReportRenderer.AuditResultJSON
956 * }}
957 */
958ReportRenderer.AuditJSON;
959
960/**
961 * @typedef {{
962 * title: string,
963 * id: string,
964 * score: (number|null),
965 * description: (string|undefined),
966 * manualDescription: string,
967 * auditRefs: !Array<!ReportRenderer.AuditJSON>
968 * }}
969 */
970ReportRenderer.CategoryJSON;
971
972/**
973 * @typedef {{
974 * title: string,
975 * description: (string|undefined),
976 * }}
977 */
978ReportRenderer.GroupJSON;
979
980/**
981 * @typedef {{
982 * lighthouseVersion: string,
983 * userAgent: string,
984 * fetchTime: string,
985 * timing: {total: number},
986 * requestedUrl: string,
987 * finalUrl: string,
988 * runWarnings: (!Array<string>|undefined),
989 * artifacts: {traces: {defaultPass: {traceEvents: !Array}}},
990 * audits: !Object<string, !ReportRenderer.AuditResultJSON>,
991 * categories: !Object<string, !ReportRenderer.CategoryJSON>,
992 * categoryGroups: !Object<string, !ReportRenderer.GroupJSON>,
993 * }}
994 */
995ReportRenderer.ReportJSON;
996
997/**
998 * @typedef {{
999 * traces: {defaultPass: {traceEvents: !Array}},
1000 * }}
1001 */
1002ReportRenderer.RunnerResultArtifacts;
1003
1004/**
1005 * @typedef {{
1006 * lhr: !ReportRenderer.ReportJSON,
1007 * artifacts: ReportRenderer.RunnerResultArtifacts,
Tim van der Lippeffa78622019-09-16 12:07:121008 * report: string,
1009 * stack: string
Paul Irish8f1e33d2018-05-31 02:29:501010 * }}
1011 */
1012ReportRenderer.RunnerResult;
1013
1014
1015/**
1016 * @constructor
1017 * @param {!DOM} dom
1018 * @param {!DetailsRenderer} detailsRenderer
1019 */
1020const CategoryRenderer = function(dom, detailsRenderer) {};
1021
1022
1023/**
1024 * @constructor
1025 * @param {!DOM} dom
1026 */
1027const DetailsRenderer = function(dom) {};
1028
1029DetailsRenderer.prototype = {
1030 /**
1031 * @param {!DetailsRenderer.NodeDetailsJSON} item
1032 * @return {!Element}
1033 */
1034 renderNode: function(item) {},
1035};
1036
1037/**
1038 * @typedef {{
1039 * type: string,
1040 * value: (string|number|undefined),
1041 * summary: (DetailsRenderer.OpportunitySummary|undefined),
1042 * granularity: (number|undefined),
1043 * displayUnit: (string|undefined)
1044 * }}
1045 */
1046DetailsRenderer.DetailsJSON;
1047
1048/**
1049 * @typedef {{
1050 * type: string,
1051 * path: (string|undefined),
1052 * selector: (string|undefined),
1053 * snippet:(string|undefined)
1054 * }}
1055 */
1056DetailsRenderer.NodeDetailsJSON;
1057
Connor Clark0403a422019-11-19 02:03:181058/**
1059 * @typedef {{
1060 * sourceUrl: (string|undefined),
1061 * sourceLine: (string|undefined),
1062 * sourceColumn: (string|undefined),
1063 * }}
1064 */
1065DetailsRenderer.SourceLocationDetailsJSON;
1066
Paul Irish8f1e33d2018-05-31 02:29:501067/** @typedef {{
1068 * wastedMs: (number|undefined),
1069 * wastedBytes: (number|undefined),
1070 * }}
1071 */
1072DetailsRenderer.OpportunitySummary;
Ingvar Stepanyan562fcd72018-06-06 22:52:091073
Connor Clark2bc3be22020-02-14 22:34:191074const LighthouseReportGenerator = class {
1075 /**
1076 * @param {!ReportRenderer.ReportJSON} lhr
1077 * @return {string}
1078 */
1079 generateReportHtml(lhr) {
1080 return '';
1081 }
1082};
Tim van der Lippe7b190162019-09-27 15:10:441083
1084/** @interface */
1085class InspectorFrontendHostAPI {
1086 /**
1087 * @param {string=} type
1088 */
1089 addFileSystem(type) {
1090 }
1091
1092 loadCompleted() {
1093 }
1094
1095 /**
1096 * @param {number} requestId
1097 * @param {string} fileSystemPath
1098 * @param {string} excludedFolders
1099 */
1100 indexPath(requestId, fileSystemPath, excludedFolders) {
1101 }
1102
1103 /**
1104 * Requests inspected page to be placed atop of the inspector frontend with specified bounds.
1105 * @param {{x: number, y: number, width: number, height: number}} bounds
1106 */
1107 setInspectedPageBounds(bounds) {
1108 }
1109
1110 /**
1111 * @param {!Array<string>} certChain
1112 */
1113 showCertificateViewer(certChain) {
1114 }
1115
1116 /**
1117 * @param {string} shortcuts
1118 */
1119 setWhitelistedShortcuts(shortcuts) {
1120 }
1121
1122 /**
1123 * @param {boolean} active
1124 */
1125 setEyeDropperActive(active) {
1126 }
1127
1128 inspectElementCompleted() {
1129 }
1130
1131 /**
1132 * @param {string} url
1133 */
1134 openInNewTab(url) {
1135 }
1136
1137 /**
1138 * @param {string} fileSystemPath
1139 */
1140 showItemInFolder(fileSystemPath) {
1141 }
1142
1143 /**
1144 * @param {string} fileSystemPath
1145 */
1146 removeFileSystem(fileSystemPath) {
1147 }
1148
1149 requestFileSystems() {
1150 }
1151
1152 /**
1153 * @param {string} url
1154 * @param {string} content
1155 * @param {boolean} forceSaveAs
1156 */
1157 save(url, content, forceSaveAs) {
1158 }
1159
1160 /**
1161 * @param {string} url
1162 * @param {string} content
1163 */
1164 append(url, content) {
1165 }
1166
1167 /**
1168 * @param {string} url
1169 */
1170 close(url) {
1171 }
1172
1173 /**
1174 * @param {number} requestId
1175 * @param {string} fileSystemPath
1176 * @param {string} query
1177 */
1178 searchInPath(requestId, fileSystemPath, query) {
1179 }
1180
1181 /**
1182 * @param {number} requestId
1183 */
1184 stopIndexing(requestId) {
1185 }
1186
1187 bringToFront() {
1188 }
1189
1190 closeWindow() {
1191 }
1192
1193 copyText(text) {
1194 }
1195
1196 /**
1197 * @param {string} url
1198 */
1199 inspectedURLChanged(url) {
1200 }
1201
1202 /**
1203 * @param {string} fileSystemId
1204 * @param {string} registeredName
Tim van der Lipped71c22d2020-03-19 12:29:191205 * @return {?FileSystem}
Tim van der Lippe7b190162019-09-27 15:10:441206 */
1207 isolatedFileSystem(fileSystemId, registeredName) {
1208 }
1209
1210 /**
1211 * @param {string} url
1212 * @param {string} headers
1213 * @param {number} streamId
1214 * @param {function(!InspectorFrontendHostAPI.LoadNetworkResourceResult)} callback
1215 */
1216 loadNetworkResource(url, headers, streamId, callback) {
1217 }
1218
1219 /**
1220 * @param {function(!Object<string, string>)} callback
1221 */
1222 getPreferences(callback) {
1223 }
1224
1225 /**
1226 * @param {string} name
1227 * @param {string} value
1228 */
1229 setPreference(name, value) {
1230 }
1231
1232 /**
1233 * @param {string} name
1234 */
1235 removePreference(name) {
1236 }
1237
1238 clearPreferences() {
1239 }
1240
1241 /**
1242 * @param {!FileSystem} fileSystem
1243 */
1244 upgradeDraggedFileSystemPermissions(fileSystem) {
1245 }
1246
1247 /**
1248 * @return {string}
1249 */
1250 platform() {
1251 }
1252
1253 /**
1254 * @param {string} actionName
1255 * @param {number} actionCode
1256 * @param {number} bucketSize
1257 */
1258 recordEnumeratedHistogram(actionName, actionCode, bucketSize) {
1259 }
1260
1261 /**
1262 * @param {string} histogramName
1263 * @param {number} duration
1264 */
1265 recordPerformanceHistogram(histogramName, duration) {
1266 }
1267
1268 /**
1269 * @param {string} umaName
1270 */
1271 recordUserMetricsAction(umaName) {
1272 }
1273
1274 /**
1275 * @param {string} message
1276 */
1277 sendMessageToBackend(message) {
1278 }
1279
1280 /**
1281 * @param {!Adb.Config} config
1282 */
1283 setDevicesDiscoveryConfig(config) {
1284 }
1285
1286 /**
1287 * @param {boolean} enabled
1288 */
1289 setDevicesUpdatesEnabled(enabled) {
1290 }
1291
1292 /**
1293 * @param {string} pageId
1294 * @param {string} action
1295 */
1296 performActionOnRemotePage(pageId, action) {
1297 }
1298
1299 /**
1300 * @param {string} browserId
1301 * @param {string} url
1302 */
1303 openRemotePage(browserId, url) {
1304 }
1305
1306 openNodeFrontend() {
1307 }
1308
1309 /**
1310 * @param {string} origin
1311 * @param {string} script
1312 */
1313 setInjectedScriptForOrigin(origin, script) {
1314 }
1315
1316 /**
1317 * @param {boolean} isDocked
1318 * @param {function()} callback
1319 */
1320 setIsDocked(isDocked, callback) {
1321 }
1322
1323 /**
1324 * @return {number}
1325 */
1326 zoomFactor() {
1327 }
1328
1329 zoomIn() {
1330 }
1331
1332 zoomOut() {
1333 }
1334
1335 resetZoom() {
1336 }
1337
1338 /**
1339 * @param {number} x
1340 * @param {number} y
1341 * @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
1342 * @param {!Document} document
1343 */
1344 showContextMenuAtPoint(x, y, items, document) {
1345 }
1346
1347 /**
1348 * @param {function()} callback
1349 */
1350 reattach(callback) {
1351 }
1352
1353 readyForTest() {
1354 }
1355
1356 connectionReady() {
1357 }
1358
1359 /**
1360 * @param {boolean} value
1361 */
1362 setOpenNewWindowForPopups(value) {
1363 }
1364
1365 /**
1366 * @return {boolean}
1367 */
1368 isHostedMode() {
1369 }
1370
1371 /**
1372 * @param {function(!ExtensionDescriptor)} callback
1373 */
1374 setAddExtensionCallback(callback) {
1375 }
1376}
1377
1378/** @typedef
1379{{
1380 type: string,
1381 id: (number|undefined),
1382 label: (string|undefined),
1383 enabled: (boolean|undefined),
1384 checked: (boolean|undefined),
1385 subItems: (!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>|undefined)
1386}} */
1387InspectorFrontendHostAPI.ContextMenuDescriptor;
1388
1389/** @typedef
1390{{
1391 statusCode: number,
Sigurd Schneidera327cde2020-01-21 15:48:121392 headers: (!Object.<string, string>|undefined),
1393 netError: (number|undefined),
1394 netErrorName: (string|undefined),
1395 urlValid: (boolean|undefined),
1396 messageOverride: (string|undefined)
Tim van der Lippe7b190162019-09-27 15:10:441397}} */
Tim van der Lippe99e59b82019-09-30 20:00:591398InspectorFrontendHostAPI.LoadNetworkResourceResult;
1399
1400/**
1401 * @interface
1402 */
1403class ServicePort {
1404 /**
1405 * @param {function(string)} messageHandler
1406 * @param {function(string)} closeHandler
1407 */
1408 setHandlers(messageHandler, closeHandler) {
1409 }
1410
1411 /**
1412 * @param {string} message
1413 * @return {!Promise<boolean>}
1414 */
1415 send(message) {
1416 }
1417
1418 /**
1419 * @return {!Promise<boolean>}
1420 */
1421 close() {
1422 }
Tim van der Lippe20b29c22019-11-04 14:36:151423}
Hongchan Choi3e884332019-12-12 18:47:431424
1425const fabric = {};
Tim van der Lippeee97fa32020-04-23 15:20:561426
1427class AnchorBox {
1428 /**
1429 * @param {number=} x
1430 * @param {number=} y
1431 * @param {number=} width
1432 * @param {number=} height
1433 */
1434 constructor(x, y, width, height) {
1435 /** @type {number} */
1436 this.x;
1437 /** @type {number} */
1438 this.y;
1439 /** @type {number} */
1440 this.width;
1441 /** @type {number} */
1442 this.height;
1443 }
1444
1445 /**
1446 * @param {number} x
1447 * @param {number} y
1448 * @return {boolean}
1449 */
1450 contains(x, y) {
1451 }
1452
1453 /**
1454 * @param {!AnchorBox} box
1455 * @return {!AnchorBox}
1456 */
1457 relativeTo(box) {
1458 }
1459
1460 /**
1461 * @param {!Element} element
1462 * @return {!AnchorBox}
1463 */
1464 relativeToElement(element) {
1465 }
1466
1467 /**
1468 * @param {?AnchorBox} anchorBox
1469 * @return {boolean}
1470 */
1471 equals(anchorBox) {
1472 }
1473}