blob: 46b5282718da1eed6a66ca29ef869f7ec6d94974 [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)} */
754 this.body;
755 /** @type {(!Array.<!ESTree.Node>|undefined)} */
756 this.declarations;
757 /** @type {(!Array.<!ESTree.Node>|undefined)} */
758 this.properties;
759 /** @type {(!ESTree.Node|undefined)} */
760 this.init;
761 /** @type {(!Array.<!ESTree.Node>|undefined)} */
762 this.params;
763 /** @type {(string|undefined)} */
764 this.name;
765 /** @type {(?ESTree.Node|undefined)} */
766 this.id;
767 /** @type {(number|undefined)} */
768 this.length;
769 /** @type {(?ESTree.Node|undefined)} */
770 this.argument;
771 /** @type {(string|undefined)} */
772 this.operator;
773 /** @type {(!ESTree.Node|undefined)} */
774 this.right;
775 /** @type {(!ESTree.Node|undefined)} */
776 this.left;
777 /** @type {(string|undefined)} */
778 this.kind;
779 /** @type {(!ESTree.Node|undefined)} */
780 this.property;
781 /** @type {(!ESTree.Node|undefined)} */
782 this.object;
783 /** @type {(string|undefined)} */
784 this.raw;
785 /** @type {(boolean|undefined)} */
786 this.computed;
787};
788
789/**
790 * @extends {ESTree.Node}
791 * @constructor
792 */
793ESTree.TemplateLiteralNode = function() {
794 /** @type {!Array.<!ESTree.Node>} */
795 this.quasis;
796 /** @type {!Array.<!ESTree.Node>} */
797 this.expressions;
798};
799
800/**
801 * @type {string}
802 * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object
803 * TODO(jsbell): DOMException should be a subclass of Error.
804 */
805DOMException.prototype.message;
806/** @type {number} */
807DOMException.ABORT_ERR;
808
809/**
810 * @constructor
811 * @param {!Object} params
812 */
813const Terminal = function(params) {};
814
815Terminal.prototype = {
816 fit: function() {},
817 linkify: function() {},
818 /** @param {!Element} element */
819 open: function(element) {},
820 /** @param {string} eventName * @param {!Function} handler */
821 on: function(eventName, handler) {}
822};
823
824/**
825 * @param {string} context
826 * @return {!Console}
827 */
828Console.prototype.context = function(context) {};
829
Tim van der Lippe29fab472019-08-15 14:46:48830// Globally defined functions
Blink Reformat4c46d092018-04-07 15:32:37831
832/**
833 * @param {!Array<string>|string} strings
834 * @param {...*} vararg
835 * @return {string}
836 */
837const ls = function(strings, vararg) {};
838
839/**
Tim van der Lippe29fab472019-08-15 14:46:48840* @param {string} tagName
841* @param {string=} customElementType
842* @return {!Element}
843*/
844const createElement = function(tagName, customElementType) {};
845
846/**
847 * @param {number|string} data
848 * @return {!Text}
849 */
850const createTextNode = function(data) {};
851
852/**
853 * @param {string} elementName
854 * @param {string=} className
855 * @param {string=} customElementType
856 * @return {!Element}
857 */
858const createElementWithClass = function(elementName, className, customElementType) {};
859
860/**
861 * @param {string} childType
862 * @param {string=} className
863 * @return {!Element}
864 */
865const createSVGElement = function(childType, className) {};
866
867/**
868 * @return {!DocumentFragment}
869 */
870const createDocumentFragment = function() {};
871
872/**
873 * @param {!Event} event
874 * @return {boolean}
875 */
876const isEnterKey = function(event) {};
877
878/**
879 * @param {!Event} event
880 * @return {boolean}
881 */
882const isEnterOrSpaceKey = function(event) {};
883
884/**
885 * @param {!Event} event
886 * @return {boolean}
887 */
888const isEscKey = function(event) {};
889
890/**
891 * @param {!ExtensionDescriptor} extensionInfo
892 * @param {string} inspectedTabId
893 * @param {string} themeName
894 * @param {!Array<number>} keysToForward
895 * @param {function(!Object, !Object)|undefined} testHook
896 * @return {string}
897 */
898const buildExtensionAPIInjectedScript = function(extensionInfo, inspectedTabId, themeName, keysToForward, testHook) {};
899
900/**
901 * @param {number} m
902 * @param {number} n
903 * @return {number}
904 */
905const mod = function(m, n) {};
906
907/**
908 * @param {string} query
909 * @param {boolean} caseSensitive
910 * @param {boolean} isRegex
911 * @return {!RegExp}
912 */
913const createSearchRegex = function(query, caseSensitive, isRegex) {};
914
915/**
916 * @param {string} query
917 * @param {string=} flags
918 * @return {!RegExp}
919 */
920const createPlainTextSearchRegex = function(query, flags) {};
921
922/**
923 * @param {!RegExp} regex
924 * @param {string} content
925 * @return {number}
926 */
927const countRegexMatches = function(regex, content) {};
928
929/**
930 * @param {number} spacesCount
931 * @return {string}
932 */
933const spacesPadding = function(spacesCount) {};
934
935/**
936 * @param {number} value
937 * @param {number} symbolsCount
938 * @return {string}
939 */
940const numberToStringWithSpacesPadding = function(value, symbolsCount) {};
941
942/**
943 * @param {string} url
944 * @return {!Promise.<string>}
945 */
946const loadXHR = function(url) {};
947
948/**
949 * @param {*} value
950 */
951const suppressUnused = function(value) {};
952
953/**
954 * TODO: move into its own module
955 * @param {function()} callback
956 */
957const runOnWindowLoad = function(callback) {};
958
959/**
960 * @template T
961 * @param {function(new:T, ...)} constructorFunction
962 * @return {!T}
963 */
964const singleton = function(constructorFunction) {};
965
966/**
967 * @param {?string} content
968 * @return {number}
969 */
970const base64ToSize = function(content) {};
971
972/**
Mathias Bynens2670a652019-12-20 09:21:07973 * @param {?string} input
974 * @return {string}
975 */
976const unescapeCssString = function(input) {};
977
978/**
Blink Reformat4c46d092018-04-07 15:32:37979 * @constructor
980 * @param {function(!Array<*>)} callback
981 */
982const ResizeObserver = function(callback) {};
Paul Irish8f1e33d2018-05-31 02:29:50983
984
985// Lighthouse Report Renderer
986
987/**
988 * @constructor
989 * @param {!Document} document
990 */
991const DOM = function(document) {};
992
993/**
994 * @constructor
995 * @param {!DOM} dom
996 */
997const ReportRenderer = function(dom) {};
998
999ReportRenderer.prototype = {
1000 /**
1001 * @param {!ReportRenderer.ReportJSON} report
1002 * @param {!Element} container Parent element to render the report into.
1003 */
1004 renderReport: function(report, container) {},
1005
1006 /**
1007 * @param {!Document|!Element} context
1008 */
1009 setTemplateContext: function(context) {},
1010
1011};
1012
1013/**
[email protected]f2f8c092019-05-30 22:01:561014 * @constructor
1015 * @param {!DOM} dom
1016 */
[email protected]c5214af2019-06-25 20:31:211017const ReportUIFeatures = function(dom) {
1018 /** @type {!ReportRenderer.ReportJSON} */
1019 this.json;
1020
1021 /** @type {!Document} */
1022 this._document;
1023};
[email protected]f2f8c092019-05-30 22:01:561024
1025ReportUIFeatures.prototype = {
1026 /**
1027 * @param {!Document|!Element} context
1028 */
1029 setTemplateContext: function(context) {},
1030
1031 /**
1032 * @param {!ReportRenderer.ReportJSON} report
1033 */
1034 initFeatures: function(report) {},
[email protected]c5214af2019-06-25 20:31:211035
1036 _resetUIState: function() {},
[email protected]f2f8c092019-05-30 22:01:561037};
1038
1039/**
Paul Irish8f1e33d2018-05-31 02:29:501040 * @typedef {{
1041 * rawValue: (number|boolean|undefined),
1042 * id: string,
1043 * title: string,
1044 * description: string,
1045 * explanation: (string|undefined),
1046 * errorMessage: (string|undefined),
1047 * displayValue: (string|Array<string|number>|undefined),
1048 * scoreDisplayMode: string,
1049 * error: boolean,
1050 * score: (number|null),
1051 * details: (!DetailsRenderer.DetailsJSON|undefined),
1052 * }}
1053 */
1054ReportRenderer.AuditResultJSON;
1055
1056/**
1057 * @typedef {{
1058 * id: string,
1059 * score: (number|null),
1060 * weight: number,
1061 * group: (string|undefined),
1062 * result: ReportRenderer.AuditResultJSON
1063 * }}
1064 */
1065ReportRenderer.AuditJSON;
1066
1067/**
1068 * @typedef {{
1069 * title: string,
1070 * id: string,
1071 * score: (number|null),
1072 * description: (string|undefined),
1073 * manualDescription: string,
1074 * auditRefs: !Array<!ReportRenderer.AuditJSON>
1075 * }}
1076 */
1077ReportRenderer.CategoryJSON;
1078
1079/**
1080 * @typedef {{
1081 * title: string,
1082 * description: (string|undefined),
1083 * }}
1084 */
1085ReportRenderer.GroupJSON;
1086
1087/**
1088 * @typedef {{
1089 * lighthouseVersion: string,
1090 * userAgent: string,
1091 * fetchTime: string,
1092 * timing: {total: number},
1093 * requestedUrl: string,
1094 * finalUrl: string,
1095 * runWarnings: (!Array<string>|undefined),
1096 * artifacts: {traces: {defaultPass: {traceEvents: !Array}}},
1097 * audits: !Object<string, !ReportRenderer.AuditResultJSON>,
1098 * categories: !Object<string, !ReportRenderer.CategoryJSON>,
1099 * categoryGroups: !Object<string, !ReportRenderer.GroupJSON>,
1100 * }}
1101 */
1102ReportRenderer.ReportJSON;
1103
1104/**
1105 * @typedef {{
1106 * traces: {defaultPass: {traceEvents: !Array}},
1107 * }}
1108 */
1109ReportRenderer.RunnerResultArtifacts;
1110
1111/**
1112 * @typedef {{
1113 * lhr: !ReportRenderer.ReportJSON,
1114 * artifacts: ReportRenderer.RunnerResultArtifacts,
Tim van der Lippeffa78622019-09-16 12:07:121115 * report: string,
1116 * stack: string
Paul Irish8f1e33d2018-05-31 02:29:501117 * }}
1118 */
1119ReportRenderer.RunnerResult;
1120
1121
1122/**
1123 * @constructor
1124 * @param {!DOM} dom
1125 * @param {!DetailsRenderer} detailsRenderer
1126 */
1127const CategoryRenderer = function(dom, detailsRenderer) {};
1128
1129
1130/**
1131 * @constructor
1132 * @param {!DOM} dom
1133 */
1134const DetailsRenderer = function(dom) {};
1135
1136DetailsRenderer.prototype = {
1137 /**
1138 * @param {!DetailsRenderer.NodeDetailsJSON} item
1139 * @return {!Element}
1140 */
1141 renderNode: function(item) {},
1142};
1143
1144/**
1145 * @typedef {{
1146 * type: string,
1147 * value: (string|number|undefined),
1148 * summary: (DetailsRenderer.OpportunitySummary|undefined),
1149 * granularity: (number|undefined),
1150 * displayUnit: (string|undefined)
1151 * }}
1152 */
1153DetailsRenderer.DetailsJSON;
1154
1155/**
1156 * @typedef {{
1157 * type: string,
1158 * path: (string|undefined),
1159 * selector: (string|undefined),
1160 * snippet:(string|undefined)
1161 * }}
1162 */
1163DetailsRenderer.NodeDetailsJSON;
1164
Connor Clark0403a422019-11-19 02:03:181165/**
1166 * @typedef {{
1167 * sourceUrl: (string|undefined),
1168 * sourceLine: (string|undefined),
1169 * sourceColumn: (string|undefined),
1170 * }}
1171 */
1172DetailsRenderer.SourceLocationDetailsJSON;
1173
Paul Irish8f1e33d2018-05-31 02:29:501174/** @typedef {{
1175 * wastedMs: (number|undefined),
1176 * wastedBytes: (number|undefined),
1177 * }}
1178 */
1179DetailsRenderer.OpportunitySummary;
Ingvar Stepanyan562fcd72018-06-06 22:52:091180
[email protected]90147502019-04-09 03:41:431181const Lighthouse = {};
1182
1183Lighthouse.ReportGenerator = {};
1184
1185/**
1186 * @param {!ReportRenderer.ReportJSON} lhr
1187 * @return {string}
1188 */
1189Lighthouse.ReportGenerator.generateReportHtml;
1190
1191/**
1192 * @param {string} source
1193 * @param {Array<{search: string, replacement: string}>} replacements
1194 * @return {string}
1195 */
1196Lighthouse.ReportGenerator.replaceStrings;
Tim van der Lippe7b190162019-09-27 15:10:441197
1198/** @interface */
1199class InspectorFrontendHostAPI {
1200 /**
1201 * @param {string=} type
1202 */
1203 addFileSystem(type) {
1204 }
1205
1206 loadCompleted() {
1207 }
1208
1209 /**
1210 * @param {number} requestId
1211 * @param {string} fileSystemPath
1212 * @param {string} excludedFolders
1213 */
1214 indexPath(requestId, fileSystemPath, excludedFolders) {
1215 }
1216
1217 /**
1218 * Requests inspected page to be placed atop of the inspector frontend with specified bounds.
1219 * @param {{x: number, y: number, width: number, height: number}} bounds
1220 */
1221 setInspectedPageBounds(bounds) {
1222 }
1223
1224 /**
1225 * @param {!Array<string>} certChain
1226 */
1227 showCertificateViewer(certChain) {
1228 }
1229
1230 /**
1231 * @param {string} shortcuts
1232 */
1233 setWhitelistedShortcuts(shortcuts) {
1234 }
1235
1236 /**
1237 * @param {boolean} active
1238 */
1239 setEyeDropperActive(active) {
1240 }
1241
1242 inspectElementCompleted() {
1243 }
1244
1245 /**
1246 * @param {string} url
1247 */
1248 openInNewTab(url) {
1249 }
1250
1251 /**
1252 * @param {string} fileSystemPath
1253 */
1254 showItemInFolder(fileSystemPath) {
1255 }
1256
1257 /**
1258 * @param {string} fileSystemPath
1259 */
1260 removeFileSystem(fileSystemPath) {
1261 }
1262
1263 requestFileSystems() {
1264 }
1265
1266 /**
1267 * @param {string} url
1268 * @param {string} content
1269 * @param {boolean} forceSaveAs
1270 */
1271 save(url, content, forceSaveAs) {
1272 }
1273
1274 /**
1275 * @param {string} url
1276 * @param {string} content
1277 */
1278 append(url, content) {
1279 }
1280
1281 /**
1282 * @param {string} url
1283 */
1284 close(url) {
1285 }
1286
1287 /**
1288 * @param {number} requestId
1289 * @param {string} fileSystemPath
1290 * @param {string} query
1291 */
1292 searchInPath(requestId, fileSystemPath, query) {
1293 }
1294
1295 /**
1296 * @param {number} requestId
1297 */
1298 stopIndexing(requestId) {
1299 }
1300
1301 bringToFront() {
1302 }
1303
1304 closeWindow() {
1305 }
1306
1307 copyText(text) {
1308 }
1309
1310 /**
1311 * @param {string} url
1312 */
1313 inspectedURLChanged(url) {
1314 }
1315
1316 /**
1317 * @param {string} fileSystemId
1318 * @param {string} registeredName
1319 * @return {?DOMFileSystem}
1320 */
1321 isolatedFileSystem(fileSystemId, registeredName) {
1322 }
1323
1324 /**
1325 * @param {string} url
1326 * @param {string} headers
1327 * @param {number} streamId
1328 * @param {function(!InspectorFrontendHostAPI.LoadNetworkResourceResult)} callback
1329 */
1330 loadNetworkResource(url, headers, streamId, callback) {
1331 }
1332
1333 /**
1334 * @param {function(!Object<string, string>)} callback
1335 */
1336 getPreferences(callback) {
1337 }
1338
1339 /**
1340 * @param {string} name
1341 * @param {string} value
1342 */
1343 setPreference(name, value) {
1344 }
1345
1346 /**
1347 * @param {string} name
1348 */
1349 removePreference(name) {
1350 }
1351
1352 clearPreferences() {
1353 }
1354
1355 /**
1356 * @param {!FileSystem} fileSystem
1357 */
1358 upgradeDraggedFileSystemPermissions(fileSystem) {
1359 }
1360
1361 /**
1362 * @return {string}
1363 */
1364 platform() {
1365 }
1366
1367 /**
1368 * @param {string} actionName
1369 * @param {number} actionCode
1370 * @param {number} bucketSize
1371 */
1372 recordEnumeratedHistogram(actionName, actionCode, bucketSize) {
1373 }
1374
1375 /**
1376 * @param {string} histogramName
1377 * @param {number} duration
1378 */
1379 recordPerformanceHistogram(histogramName, duration) {
1380 }
1381
1382 /**
1383 * @param {string} umaName
1384 */
1385 recordUserMetricsAction(umaName) {
1386 }
1387
1388 /**
1389 * @param {string} message
1390 */
1391 sendMessageToBackend(message) {
1392 }
1393
1394 /**
1395 * @param {!Adb.Config} config
1396 */
1397 setDevicesDiscoveryConfig(config) {
1398 }
1399
1400 /**
1401 * @param {boolean} enabled
1402 */
1403 setDevicesUpdatesEnabled(enabled) {
1404 }
1405
1406 /**
1407 * @param {string} pageId
1408 * @param {string} action
1409 */
1410 performActionOnRemotePage(pageId, action) {
1411 }
1412
1413 /**
1414 * @param {string} browserId
1415 * @param {string} url
1416 */
1417 openRemotePage(browserId, url) {
1418 }
1419
1420 openNodeFrontend() {
1421 }
1422
1423 /**
1424 * @param {string} origin
1425 * @param {string} script
1426 */
1427 setInjectedScriptForOrigin(origin, script) {
1428 }
1429
1430 /**
1431 * @param {boolean} isDocked
1432 * @param {function()} callback
1433 */
1434 setIsDocked(isDocked, callback) {
1435 }
1436
1437 /**
1438 * @return {number}
1439 */
1440 zoomFactor() {
1441 }
1442
1443 zoomIn() {
1444 }
1445
1446 zoomOut() {
1447 }
1448
1449 resetZoom() {
1450 }
1451
1452 /**
1453 * @param {number} x
1454 * @param {number} y
1455 * @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
1456 * @param {!Document} document
1457 */
1458 showContextMenuAtPoint(x, y, items, document) {
1459 }
1460
1461 /**
1462 * @param {function()} callback
1463 */
1464 reattach(callback) {
1465 }
1466
1467 readyForTest() {
1468 }
1469
1470 connectionReady() {
1471 }
1472
1473 /**
1474 * @param {boolean} value
1475 */
1476 setOpenNewWindowForPopups(value) {
1477 }
1478
1479 /**
1480 * @return {boolean}
1481 */
1482 isHostedMode() {
1483 }
1484
1485 /**
1486 * @param {function(!ExtensionDescriptor)} callback
1487 */
1488 setAddExtensionCallback(callback) {
1489 }
1490}
1491
1492/** @typedef
1493{{
1494 type: string,
1495 id: (number|undefined),
1496 label: (string|undefined),
1497 enabled: (boolean|undefined),
1498 checked: (boolean|undefined),
1499 subItems: (!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>|undefined)
1500}} */
1501InspectorFrontendHostAPI.ContextMenuDescriptor;
1502
1503/** @typedef
1504{{
1505 statusCode: number,
Sigurd Schneidera327cde2020-01-21 15:48:121506 headers: (!Object.<string, string>|undefined),
1507 netError: (number|undefined),
1508 netErrorName: (string|undefined),
1509 urlValid: (boolean|undefined),
1510 messageOverride: (string|undefined)
Tim van der Lippe7b190162019-09-27 15:10:441511}} */
Tim van der Lippe99e59b82019-09-30 20:00:591512InspectorFrontendHostAPI.LoadNetworkResourceResult;
1513
1514/**
1515 * @interface
1516 */
1517class ServicePort {
1518 /**
1519 * @param {function(string)} messageHandler
1520 * @param {function(string)} closeHandler
1521 */
1522 setHandlers(messageHandler, closeHandler) {
1523 }
1524
1525 /**
1526 * @param {string} message
1527 * @return {!Promise<boolean>}
1528 */
1529 send(message) {
1530 }
1531
1532 /**
1533 * @return {!Promise<boolean>}
1534 */
1535 close() {
1536 }
Tim van der Lippe20b29c22019-11-04 14:36:151537}
Hongchan Choi3e884332019-12-12 18:47:431538
1539const fabric = {};