blob: 96a08c9c4af202f457b70ce5dfd8de8eee1a403e [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
560/** @constructor */
561CodeMirror.StringStream = function(line) {
562 this.pos = 0;
563 this.start = 0;
564};
565CodeMirror.StringStream.prototype = {
566 backUp: function(n) {},
567 column: function() {},
568 current: function() {},
569 eat: function(match) {},
570 eatSpace: function() {},
571 eatWhile: function(match) {},
572 eol: function() {},
573 indentation: function() {},
574 /**
575 * @param {!RegExp|string} pattern
576 * @param {boolean=} consume
577 * @param {boolean=} caseInsensitive
578 */
579 match: function(pattern, consume, caseInsensitive) {},
580 next: function() {},
581 peek: function() {},
582 skipTo: function(ch) {},
583 skipToEnd: function() {},
584 sol: function() {}
585};
586
587/** @constructor */
588CodeMirror.TextMarker = function(doc, type) {};
589CodeMirror.TextMarker.prototype = {
590 clear: function() {},
591 find: function() {},
592 changed: function() {}
593};
594
595/** @constructor */
596CodeMirror.LineWidget = function() {};
597CodeMirror.LineWidget.prototype = {
598 clear: function() {}
599};
600
601/** @type {Object.<string, !Object.<string, string>>} */
602CodeMirror.keyMap;
603
604/** @type {{scrollLeft: number, scrollTop: number}} */
605CodeMirror.doc;
606
607/**
608 * @param {string} mime
609 * @param {string} mode
610 */
611CodeMirror.defineMIME = function(mime, mode) {};
612
613/** @type {boolean} */
614window.dispatchStandaloneTestRunnerMessages;
615
Gaoping Huang1e081662019-10-03 20:22:56616const dagre = {};
617dagre.graphlib = {};
618/**
619 * @constructor
620 */
621dagre.graphlib.Graph = function() {};
622
623dagre.graphlib.json = {};
624
625/**
626 * @param {string} graphData
627 * @return {!dagre.graphlib.Graph}
628 */
629dagre.graphlib.json.read = function(graphData) {};
630
631/**
632 * @param {!dagre.graphlib.Graph} graph
633 * @return {string}
634 */
635dagre.graphlib.json.write = function(graph) {};
636
637/**
638 * @param {!dagre.graphlib.Graph} graph
639 * @param {?Object=} options
640 */
641dagre.layout = function(graph, options) {};
642// Since the object types in JSDoc should use capitalized `Dagre`, dagre is renamed as Dagre below.
643// Note that `var Dagre={}` will be added in dagre_module.js, so to prevent variable redefinition,
644// the workaround is to name the module+folder as `dagre_layout`. This workaround is similar to
645// `cm` and `CodeMirror`.
646const Dagre = dagre;
647
Blink Reformat4c46d092018-04-07 15:32:37648const ESTree = {};
649
650/**
651 * @constructor
652 */
653ESTree.Node = function() {
654 /** @type {number} */
655 this.start;
656 /** @type {number} */
657 this.end;
658 /** @type {string} */
659 this.type;
660 /** @type {(!ESTree.Node|undefined)} */
Tim van der Lippe1cf8e422020-03-12 16:09:21661 this.key;
662 /** @type {(!ESTree.Node|undefined)} */
Blink Reformat4c46d092018-04-07 15:32:37663 this.body;
664 /** @type {(!Array.<!ESTree.Node>|undefined)} */
665 this.declarations;
666 /** @type {(!Array.<!ESTree.Node>|undefined)} */
667 this.properties;
668 /** @type {(!ESTree.Node|undefined)} */
669 this.init;
670 /** @type {(!Array.<!ESTree.Node>|undefined)} */
671 this.params;
672 /** @type {(string|undefined)} */
673 this.name;
674 /** @type {(?ESTree.Node|undefined)} */
675 this.id;
676 /** @type {(number|undefined)} */
677 this.length;
678 /** @type {(?ESTree.Node|undefined)} */
679 this.argument;
680 /** @type {(string|undefined)} */
681 this.operator;
682 /** @type {(!ESTree.Node|undefined)} */
683 this.right;
684 /** @type {(!ESTree.Node|undefined)} */
685 this.left;
686 /** @type {(string|undefined)} */
687 this.kind;
688 /** @type {(!ESTree.Node|undefined)} */
689 this.property;
690 /** @type {(!ESTree.Node|undefined)} */
691 this.object;
692 /** @type {(string|undefined)} */
693 this.raw;
694 /** @type {(boolean|undefined)} */
695 this.computed;
696};
697
698/**
699 * @extends {ESTree.Node}
700 * @constructor
701 */
702ESTree.TemplateLiteralNode = function() {
703 /** @type {!Array.<!ESTree.Node>} */
704 this.quasis;
705 /** @type {!Array.<!ESTree.Node>} */
706 this.expressions;
707};
708
709/**
710 * @type {string}
711 * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object
712 * TODO(jsbell): DOMException should be a subclass of Error.
713 */
714DOMException.prototype.message;
715/** @type {number} */
716DOMException.ABORT_ERR;
717
718/**
719 * @constructor
720 * @param {!Object} params
721 */
722const Terminal = function(params) {};
723
724Terminal.prototype = {
725 fit: function() {},
726 linkify: function() {},
727 /** @param {!Element} element */
728 open: function(element) {},
729 /** @param {string} eventName * @param {!Function} handler */
730 on: function(eventName, handler) {}
731};
732
733/**
734 * @param {string} context
735 * @return {!Console}
736 */
737Console.prototype.context = function(context) {};
738
Tim van der Lippe29fab472019-08-15 14:46:48739// Globally defined functions
Blink Reformat4c46d092018-04-07 15:32:37740
741/**
742 * @param {!Array<string>|string} strings
743 * @param {...*} vararg
744 * @return {string}
745 */
746const ls = function(strings, vararg) {};
747
748/**
Tim van der Lippe29fab472019-08-15 14:46:48749* @param {string} tagName
750* @param {string=} customElementType
751* @return {!Element}
752*/
753const createElement = function(tagName, customElementType) {};
754
755/**
756 * @param {number|string} data
757 * @return {!Text}
758 */
759const createTextNode = function(data) {};
760
761/**
Tim van der Lippe29fab472019-08-15 14:46:48762 * @param {string} childType
763 * @param {string=} className
764 * @return {!Element}
765 */
766const createSVGElement = function(childType, className) {};
767
768/**
769 * @return {!DocumentFragment}
770 */
771const createDocumentFragment = function() {};
772
773/**
774 * @param {!Event} event
775 * @return {boolean}
776 */
777const isEnterKey = function(event) {};
778
779/**
780 * @param {!Event} event
781 * @return {boolean}
782 */
783const isEnterOrSpaceKey = function(event) {};
784
785/**
786 * @param {!Event} event
787 * @return {boolean}
788 */
789const isEscKey = function(event) {};
790
791/**
Tim van der Lipped71c22d2020-03-19 12:29:19792 * @param {!{startPage: string, name: string, exposeExperimentalAPIs: boolean}} extensionInfo
Tim van der Lippe29fab472019-08-15 14:46:48793 * @param {string} inspectedTabId
794 * @param {string} themeName
795 * @param {!Array<number>} keysToForward
796 * @param {function(!Object, !Object)|undefined} testHook
797 * @return {string}
798 */
799const buildExtensionAPIInjectedScript = function(extensionInfo, inspectedTabId, themeName, keysToForward, testHook) {};
800
801/**
802 * @param {number} m
803 * @param {number} n
804 * @return {number}
805 */
806const mod = function(m, n) {};
807
808/**
809 * @param {string} query
810 * @param {boolean} caseSensitive
811 * @param {boolean} isRegex
812 * @return {!RegExp}
813 */
814const createSearchRegex = function(query, caseSensitive, isRegex) {};
815
816/**
817 * @param {string} query
818 * @param {string=} flags
819 * @return {!RegExp}
820 */
821const createPlainTextSearchRegex = function(query, flags) {};
822
823/**
Tim van der Lippe29fab472019-08-15 14:46:48824 * @param {number} spacesCount
825 * @return {string}
826 */
827const spacesPadding = function(spacesCount) {};
828
829/**
830 * @param {number} value
831 * @param {number} symbolsCount
832 * @return {string}
833 */
834const numberToStringWithSpacesPadding = function(value, symbolsCount) {};
835
836/**
Tim van der Lippe29fab472019-08-15 14:46:48837 * @param {*} value
838 */
839const suppressUnused = function(value) {};
840
841/**
842 * TODO: move into its own module
843 * @param {function()} callback
844 */
845const runOnWindowLoad = function(callback) {};
846
847/**
848 * @template T
849 * @param {function(new:T, ...)} constructorFunction
850 * @return {!T}
851 */
852const singleton = function(constructorFunction) {};
853
854/**
855 * @param {?string} content
856 * @return {number}
857 */
858const base64ToSize = function(content) {};
859
860/**
Mathias Bynens2670a652019-12-20 09:21:07861 * @param {?string} input
862 * @return {string}
863 */
864const unescapeCssString = function(input) {};
865
866/**
Blink Reformat4c46d092018-04-07 15:32:37867 * @constructor
868 * @param {function(!Array<*>)} callback
869 */
870const ResizeObserver = function(callback) {};
Paul Irish8f1e33d2018-05-31 02:29:50871
872
873// Lighthouse Report Renderer
874
875/**
876 * @constructor
877 * @param {!Document} document
878 */
879const DOM = function(document) {};
880
881/**
882 * @constructor
883 * @param {!DOM} dom
884 */
885const ReportRenderer = function(dom) {};
886
887ReportRenderer.prototype = {
888 /**
889 * @param {!ReportRenderer.ReportJSON} report
890 * @param {!Element} container Parent element to render the report into.
891 */
892 renderReport: function(report, container) {},
893
894 /**
895 * @param {!Document|!Element} context
896 */
897 setTemplateContext: function(context) {},
898
899};
900
901/**
[email protected]f2f8c092019-05-30 22:01:56902 * @constructor
903 * @param {!DOM} dom
904 */
[email protected]c5214af2019-06-25 20:31:21905const ReportUIFeatures = function(dom) {
906 /** @type {!ReportRenderer.ReportJSON} */
907 this.json;
908
909 /** @type {!Document} */
910 this._document;
911};
[email protected]f2f8c092019-05-30 22:01:56912
913ReportUIFeatures.prototype = {
914 /**
915 * @param {!Document|!Element} context
916 */
917 setTemplateContext: function(context) {},
918
919 /**
920 * @param {!ReportRenderer.ReportJSON} report
921 */
922 initFeatures: function(report) {},
[email protected]c5214af2019-06-25 20:31:21923
924 _resetUIState: function() {},
[email protected]f2f8c092019-05-30 22:01:56925};
926
927/**
Paul Irish8f1e33d2018-05-31 02:29:50928 * @typedef {{
929 * rawValue: (number|boolean|undefined),
930 * id: string,
931 * title: string,
932 * description: string,
933 * explanation: (string|undefined),
934 * errorMessage: (string|undefined),
935 * displayValue: (string|Array<string|number>|undefined),
936 * scoreDisplayMode: string,
937 * error: boolean,
938 * score: (number|null),
939 * details: (!DetailsRenderer.DetailsJSON|undefined),
940 * }}
941 */
942ReportRenderer.AuditResultJSON;
943
944/**
945 * @typedef {{
946 * id: string,
947 * score: (number|null),
948 * weight: number,
949 * group: (string|undefined),
950 * result: ReportRenderer.AuditResultJSON
951 * }}
952 */
953ReportRenderer.AuditJSON;
954
955/**
956 * @typedef {{
957 * title: string,
958 * id: string,
959 * score: (number|null),
960 * description: (string|undefined),
961 * manualDescription: string,
962 * auditRefs: !Array<!ReportRenderer.AuditJSON>
963 * }}
964 */
965ReportRenderer.CategoryJSON;
966
967/**
968 * @typedef {{
969 * title: string,
970 * description: (string|undefined),
971 * }}
972 */
973ReportRenderer.GroupJSON;
974
975/**
976 * @typedef {{
977 * lighthouseVersion: string,
978 * userAgent: string,
979 * fetchTime: string,
980 * timing: {total: number},
981 * requestedUrl: string,
982 * finalUrl: string,
983 * runWarnings: (!Array<string>|undefined),
984 * artifacts: {traces: {defaultPass: {traceEvents: !Array}}},
985 * audits: !Object<string, !ReportRenderer.AuditResultJSON>,
986 * categories: !Object<string, !ReportRenderer.CategoryJSON>,
987 * categoryGroups: !Object<string, !ReportRenderer.GroupJSON>,
988 * }}
989 */
990ReportRenderer.ReportJSON;
991
992/**
993 * @typedef {{
994 * traces: {defaultPass: {traceEvents: !Array}},
995 * }}
996 */
997ReportRenderer.RunnerResultArtifacts;
998
999/**
1000 * @typedef {{
1001 * lhr: !ReportRenderer.ReportJSON,
1002 * artifacts: ReportRenderer.RunnerResultArtifacts,
Tim van der Lippeffa78622019-09-16 12:07:121003 * report: string,
1004 * stack: string
Paul Irish8f1e33d2018-05-31 02:29:501005 * }}
1006 */
1007ReportRenderer.RunnerResult;
1008
1009
1010/**
1011 * @constructor
1012 * @param {!DOM} dom
1013 * @param {!DetailsRenderer} detailsRenderer
1014 */
1015const CategoryRenderer = function(dom, detailsRenderer) {};
1016
1017
1018/**
1019 * @constructor
1020 * @param {!DOM} dom
1021 */
1022const DetailsRenderer = function(dom) {};
1023
1024DetailsRenderer.prototype = {
1025 /**
1026 * @param {!DetailsRenderer.NodeDetailsJSON} item
1027 * @return {!Element}
1028 */
1029 renderNode: function(item) {},
1030};
1031
1032/**
1033 * @typedef {{
1034 * type: string,
1035 * value: (string|number|undefined),
1036 * summary: (DetailsRenderer.OpportunitySummary|undefined),
1037 * granularity: (number|undefined),
1038 * displayUnit: (string|undefined)
1039 * }}
1040 */
1041DetailsRenderer.DetailsJSON;
1042
1043/**
1044 * @typedef {{
1045 * type: string,
1046 * path: (string|undefined),
1047 * selector: (string|undefined),
1048 * snippet:(string|undefined)
1049 * }}
1050 */
1051DetailsRenderer.NodeDetailsJSON;
1052
Connor Clark0403a422019-11-19 02:03:181053/**
1054 * @typedef {{
1055 * sourceUrl: (string|undefined),
1056 * sourceLine: (string|undefined),
1057 * sourceColumn: (string|undefined),
1058 * }}
1059 */
1060DetailsRenderer.SourceLocationDetailsJSON;
1061
Paul Irish8f1e33d2018-05-31 02:29:501062/** @typedef {{
1063 * wastedMs: (number|undefined),
1064 * wastedBytes: (number|undefined),
1065 * }}
1066 */
1067DetailsRenderer.OpportunitySummary;
Ingvar Stepanyan562fcd72018-06-06 22:52:091068
Connor Clark2bc3be22020-02-14 22:34:191069const LighthouseReportGenerator = class {
1070 /**
1071 * @param {!ReportRenderer.ReportJSON} lhr
1072 * @return {string}
1073 */
1074 generateReportHtml(lhr) {
1075 return '';
1076 }
1077};
Tim van der Lippe7b190162019-09-27 15:10:441078
1079/** @interface */
1080class InspectorFrontendHostAPI {
1081 /**
1082 * @param {string=} type
1083 */
1084 addFileSystem(type) {
1085 }
1086
1087 loadCompleted() {
1088 }
1089
1090 /**
1091 * @param {number} requestId
1092 * @param {string} fileSystemPath
1093 * @param {string} excludedFolders
1094 */
1095 indexPath(requestId, fileSystemPath, excludedFolders) {
1096 }
1097
1098 /**
1099 * Requests inspected page to be placed atop of the inspector frontend with specified bounds.
1100 * @param {{x: number, y: number, width: number, height: number}} bounds
1101 */
1102 setInspectedPageBounds(bounds) {
1103 }
1104
1105 /**
1106 * @param {!Array<string>} certChain
1107 */
1108 showCertificateViewer(certChain) {
1109 }
1110
1111 /**
1112 * @param {string} shortcuts
1113 */
1114 setWhitelistedShortcuts(shortcuts) {
1115 }
1116
1117 /**
1118 * @param {boolean} active
1119 */
1120 setEyeDropperActive(active) {
1121 }
1122
1123 inspectElementCompleted() {
1124 }
1125
1126 /**
1127 * @param {string} url
1128 */
1129 openInNewTab(url) {
1130 }
1131
1132 /**
1133 * @param {string} fileSystemPath
1134 */
1135 showItemInFolder(fileSystemPath) {
1136 }
1137
1138 /**
1139 * @param {string} fileSystemPath
1140 */
1141 removeFileSystem(fileSystemPath) {
1142 }
1143
1144 requestFileSystems() {
1145 }
1146
1147 /**
1148 * @param {string} url
1149 * @param {string} content
1150 * @param {boolean} forceSaveAs
1151 */
1152 save(url, content, forceSaveAs) {
1153 }
1154
1155 /**
1156 * @param {string} url
1157 * @param {string} content
1158 */
1159 append(url, content) {
1160 }
1161
1162 /**
1163 * @param {string} url
1164 */
1165 close(url) {
1166 }
1167
1168 /**
1169 * @param {number} requestId
1170 * @param {string} fileSystemPath
1171 * @param {string} query
1172 */
1173 searchInPath(requestId, fileSystemPath, query) {
1174 }
1175
1176 /**
1177 * @param {number} requestId
1178 */
1179 stopIndexing(requestId) {
1180 }
1181
1182 bringToFront() {
1183 }
1184
1185 closeWindow() {
1186 }
1187
1188 copyText(text) {
1189 }
1190
1191 /**
1192 * @param {string} url
1193 */
1194 inspectedURLChanged(url) {
1195 }
1196
1197 /**
1198 * @param {string} fileSystemId
1199 * @param {string} registeredName
Tim van der Lipped71c22d2020-03-19 12:29:191200 * @return {?FileSystem}
Tim van der Lippe7b190162019-09-27 15:10:441201 */
1202 isolatedFileSystem(fileSystemId, registeredName) {
1203 }
1204
1205 /**
1206 * @param {string} url
1207 * @param {string} headers
1208 * @param {number} streamId
1209 * @param {function(!InspectorFrontendHostAPI.LoadNetworkResourceResult)} callback
1210 */
1211 loadNetworkResource(url, headers, streamId, callback) {
1212 }
1213
1214 /**
1215 * @param {function(!Object<string, string>)} callback
1216 */
1217 getPreferences(callback) {
1218 }
1219
1220 /**
1221 * @param {string} name
1222 * @param {string} value
1223 */
1224 setPreference(name, value) {
1225 }
1226
1227 /**
1228 * @param {string} name
1229 */
1230 removePreference(name) {
1231 }
1232
1233 clearPreferences() {
1234 }
1235
1236 /**
1237 * @param {!FileSystem} fileSystem
1238 */
1239 upgradeDraggedFileSystemPermissions(fileSystem) {
1240 }
1241
1242 /**
1243 * @return {string}
1244 */
1245 platform() {
1246 }
1247
1248 /**
1249 * @param {string} actionName
1250 * @param {number} actionCode
1251 * @param {number} bucketSize
1252 */
1253 recordEnumeratedHistogram(actionName, actionCode, bucketSize) {
1254 }
1255
1256 /**
1257 * @param {string} histogramName
1258 * @param {number} duration
1259 */
1260 recordPerformanceHistogram(histogramName, duration) {
1261 }
1262
1263 /**
1264 * @param {string} umaName
1265 */
1266 recordUserMetricsAction(umaName) {
1267 }
1268
1269 /**
1270 * @param {string} message
1271 */
1272 sendMessageToBackend(message) {
1273 }
1274
1275 /**
1276 * @param {!Adb.Config} config
1277 */
1278 setDevicesDiscoveryConfig(config) {
1279 }
1280
1281 /**
1282 * @param {boolean} enabled
1283 */
1284 setDevicesUpdatesEnabled(enabled) {
1285 }
1286
1287 /**
1288 * @param {string} pageId
1289 * @param {string} action
1290 */
1291 performActionOnRemotePage(pageId, action) {
1292 }
1293
1294 /**
1295 * @param {string} browserId
1296 * @param {string} url
1297 */
1298 openRemotePage(browserId, url) {
1299 }
1300
1301 openNodeFrontend() {
1302 }
1303
1304 /**
1305 * @param {string} origin
1306 * @param {string} script
1307 */
1308 setInjectedScriptForOrigin(origin, script) {
1309 }
1310
1311 /**
1312 * @param {boolean} isDocked
1313 * @param {function()} callback
1314 */
1315 setIsDocked(isDocked, callback) {
1316 }
1317
1318 /**
1319 * @return {number}
1320 */
1321 zoomFactor() {
1322 }
1323
1324 zoomIn() {
1325 }
1326
1327 zoomOut() {
1328 }
1329
1330 resetZoom() {
1331 }
1332
1333 /**
1334 * @param {number} x
1335 * @param {number} y
1336 * @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
1337 * @param {!Document} document
1338 */
1339 showContextMenuAtPoint(x, y, items, document) {
1340 }
1341
1342 /**
1343 * @param {function()} callback
1344 */
1345 reattach(callback) {
1346 }
1347
1348 readyForTest() {
1349 }
1350
1351 connectionReady() {
1352 }
1353
1354 /**
1355 * @param {boolean} value
1356 */
1357 setOpenNewWindowForPopups(value) {
1358 }
1359
1360 /**
1361 * @return {boolean}
1362 */
1363 isHostedMode() {
1364 }
1365
1366 /**
1367 * @param {function(!ExtensionDescriptor)} callback
1368 */
1369 setAddExtensionCallback(callback) {
1370 }
1371}
1372
1373/** @typedef
1374{{
1375 type: string,
1376 id: (number|undefined),
1377 label: (string|undefined),
1378 enabled: (boolean|undefined),
1379 checked: (boolean|undefined),
1380 subItems: (!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>|undefined)
1381}} */
1382InspectorFrontendHostAPI.ContextMenuDescriptor;
1383
1384/** @typedef
1385{{
1386 statusCode: number,
Sigurd Schneidera327cde2020-01-21 15:48:121387 headers: (!Object.<string, string>|undefined),
1388 netError: (number|undefined),
1389 netErrorName: (string|undefined),
1390 urlValid: (boolean|undefined),
1391 messageOverride: (string|undefined)
Tim van der Lippe7b190162019-09-27 15:10:441392}} */
Tim van der Lippe99e59b82019-09-30 20:00:591393InspectorFrontendHostAPI.LoadNetworkResourceResult;
1394
1395/**
1396 * @interface
1397 */
1398class ServicePort {
1399 /**
1400 * @param {function(string)} messageHandler
1401 * @param {function(string)} closeHandler
1402 */
1403 setHandlers(messageHandler, closeHandler) {
1404 }
1405
1406 /**
1407 * @param {string} message
1408 * @return {!Promise<boolean>}
1409 */
1410 send(message) {
1411 }
1412
1413 /**
1414 * @return {!Promise<boolean>}
1415 */
1416 close() {
1417 }
Tim van der Lippe20b29c22019-11-04 14:36:151418}
Hongchan Choi3e884332019-12-12 18:47:431419
1420const fabric = {};
Tim van der Lippeee97fa32020-04-23 15:20:561421
1422class AnchorBox {
1423 /**
1424 * @param {number=} x
1425 * @param {number=} y
1426 * @param {number=} width
1427 * @param {number=} height
1428 */
1429 constructor(x, y, width, height) {
1430 /** @type {number} */
1431 this.x;
1432 /** @type {number} */
1433 this.y;
1434 /** @type {number} */
1435 this.width;
1436 /** @type {number} */
1437 this.height;
1438 }
1439
1440 /**
1441 * @param {number} x
1442 * @param {number} y
1443 * @return {boolean}
1444 */
1445 contains(x, y) {
1446 }
1447
1448 /**
1449 * @param {!AnchorBox} box
1450 * @return {!AnchorBox}
1451 */
1452 relativeTo(box) {
1453 }
1454
1455 /**
1456 * @param {!Element} element
1457 * @return {!AnchorBox}
1458 */
1459 relativeToElement(element) {
1460 }
1461
1462 /**
1463 * @param {?AnchorBox} anchorBox
1464 * @return {boolean}
1465 */
1466 equals(anchorBox) {
1467 }
1468}