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