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