blob: ace7420d35b9bfc0f385723dcf4e69c88919c65a [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
Erik Luo66e332c2018-04-09 18:00:1431// Blink Web Facing API
Blink Reformat4c46d092018-04-07 15:32:3732
33/**
34 * @param {!Object} object
35 * @param {!Function} callback
36 */
37Object.observe = function(object, callback) {};
38
39/** @type {boolean} */
40Event.prototype.isMetaOrCtrlForTest;
41
42/** @type {string} */
43Event.prototype.code;
44
45/**
46 * TODO(luoe): MouseEvent properties movementX and movementY from the
47 * PointerLock API are not yet standard. Once they are included in
48 * Closure Compiler, these custom externs can be removed.
49 */
50/** @type {number} */
51MouseEvent.prototype.movementX;
52
53/** @type {number} */
54MouseEvent.prototype.movementY;
55
56/**
57 * @type {number}
58 */
59KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;
60
61/**
62 * @param {!T} value
63 * @param {boolean=} onlyFirst
64 * @this {Array.<T>}
65 * @template T
66 */
67Array.prototype.remove = function(value, onlyFirst) {};
68/**
69 * @param {!Array.<!T>} array
70 * @this {Array.<!T>}
71 * @template T
72 */
73Array.prototype.pushAll = function(array) {};
74/**
75 * @return {!Object.<string, boolean>}
76 * @this {Array.<T>}
77 * @template T
78 */
79Array.prototype.keySet = function() {};
80/**
81 * @param {number} index
82 * @return {!Array.<!T>}
83 * @this {Array.<T>}
84 * @template T
85 */
86Array.prototype.rotate = function(index) {};
87/**
88 * @this {Array.<number>}
89 */
90Array.prototype.sortNumbers = function() {};
91/**
92 * @param {!S} object
93 * @param {function(!S,!T):number=} comparator
94 * @param {number=} left
95 * @param {number=} right
96 * @return {number}
97 * @this {Array.<T>}
98 * @template S
99 */
100Array.prototype.lowerBound = function(object, comparator, left, right) {};
101/**
102 * @param {!S} object
103 * @param {function(!S,!T):number=} comparator
104 * @param {number=} left
105 * @param {number=} right
106 * @return {number}
107 * @this {Array.<T>}
108 * @template S
109 */
110Array.prototype.upperBound = function(object, comparator, left, right) {};
111/**
112 * @param {!S} value
113 * @param {function(!S,!T):number} comparator
114 * @return {number}
115 * @this {Array.<T>}
116 * @template S
117 */
118Array.prototype.binaryIndexOf = function(value, comparator) {};
119/**
120 * @param {function(number, number): number} comparator
121 * @param {number} leftBound
122 * @param {number} rightBound
123 * @param {number} sortWindowLeft
124 * @param {number} sortWindowRight
125 * @return {!Array.<number>}
126 * @this {Array.<number>}
127 */
128Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {};
129
130/**
131 * @param {function(!T,!T): number=} comparator
132 * @return {!Array.<T>}
133 * @this {Array.<T>}
134 * @template T
135 */
136Array.prototype.stableSort = function(comparator) {};
137
138/**
139 * @this {Array.<number>}
140 * @param {function(number,number):boolean} comparator
141 * @param {number} left
142 * @param {number} right
143 * @param {number} pivotIndex
144 * @return {number}
145 */
146Array.prototype.partition = function(comparator, left, right, pivotIndex) {};
147
148/**
149 * @this {Array.<number>}
150 * @param {number} k
151 * @param {function(number,number):boolean=} comparator
152 * @return {number}
153 */
154Array.prototype.qselect = function(k, comparator) {};
155
156/**
157 * @param {string} field
158 * @return {!Array.<!T>}
159 * @this {Array.<!Object.<string,T>>}
160 * @template T
161 */
162Array.prototype.select = function(field) {};
163
164/**
165 * @return {!T|undefined}
166 * @this {Array.<T>}
167 * @template T
168 */
169Array.prototype.peekLast = function() {};
170
171/**
172 * @param {!Array.<T>} array
173 * @param {function(T,T):number} comparator
174 * @return {!Array.<T>}
175 * @this {!Array.<T>}
176 * @template T
177 */
178Array.prototype.intersectOrdered = function(array, comparator) {};
179
180/**
181 * @param {!Array.<T>} array
182 * @param {function(T,T):number} comparator
183 * @return {!Array.<T>}
184 * @this {!Array.<T>}
185 * @template T
186 */
187Array.prototype.mergeOrdered = function(array, comparator) {};
188
189/**
190 * @param {number} object
191 * @param {function(number, number):number=} comparator
192 * @param {number=} left
193 * @param {number=} right
194 * @return {number}
195 */
196Int32Array.prototype.lowerBound = function(object, comparator, left, right) {};
197
198// TODO(luoe): remove these BigInt types once closure supports them.
199/**
200 * @param {number|string} value
201 */
202const BigInt = function(value) {};
203
204/** @typedef {*} */
205const bigint = null;
206
207// File System API
208/**
209 * @constructor
210 */
211function DOMFileSystem() {
212}
213
214/**
215 * @type {DirectoryEntry}
216 */
217DOMFileSystem.prototype.root = null;
218
219/**
220 * @type {*}
221 */
222window.domAutomationController;
223
224const DevToolsHost = function() {};
225
226/** @typedef {{type:string, id:(number|undefined),
227 label:(string|undefined), enabled:(boolean|undefined), checked:(boolean|undefined),
228 subItems:(!Array.<!DevToolsHost.ContextMenuDescriptor>|undefined)}} */
229DevToolsHost.ContextMenuDescriptor;
230
231/**
232 * @return {number}
233 */
234DevToolsHost.zoomFactor = function() {};
235
236/**
237 * @param {string} text
238 */
239DevToolsHost.copyText = function(text) {};
240
241/**
242 * @return {string}
243 */
244DevToolsHost.platform = function() {};
245
246/**
247 * @param {number} x
248 * @param {number} y
249 * @param {!Array.<!DevToolsHost.ContextMenuDescriptor>} items
250 * @param {!Document} document
251 */
252DevToolsHost.showContextMenuAtPoint = function(x, y, items, document) {};
253
254/**
255 * @param {string} message
256 */
257DevToolsHost.sendMessageToEmbedder = function(message) {};
258
259/**
260 * @return {string}
261 */
262DevToolsHost.getSelectionBackgroundColor = function() {};
263
264/**
265 * @return {string}
266 */
267DevToolsHost.getSelectionForegroundColor = function() {};
268
269/**
270 * @return {string}
271 */
272DevToolsHost.getInactiveSelectionBackgroundColor = function() {};
273
274/**
275 * @return {string}
276 */
277DevToolsHost.getInactiveSelectionForegroundColor = function() {};
278
279/**
280 * @return {boolean}
281 */
282DevToolsHost.isHostedMode = function() {};
283
284/**
285 * @param {string} fileSystemId
286 * @param {string} registeredName
287 * @return {?DOMFileSystem}
288 */
289DevToolsHost.isolatedFileSystem = function(fileSystemId, registeredName) {};
290
291/**
292 * @param {!FileSystem} fileSystem
293 */
294DevToolsHost.upgradeDraggedFileSystemPermissions = function(fileSystem) {};
295
296/** Extensions API */
297
298/** @constructor */
299function EventSink() {
300}
301/** @constructor */
302function ExtensionSidebarPane() {
303}
304/** @constructor */
305function Panel() {
306}
307/** @constructor */
308function PanelWithSidebar() {
309}
310/** @constructor */
311function Resource() {
312}
313
314let extensionServer;
315
316/**
317 * @constructor
318 */
319function ExtensionDescriptor() {
320 this.startPage = '';
321 this.name = '';
322 this.exposeExperimentalAPIs = false;
323}
324
325/**
326 * @constructor
327 */
328function ExtensionReloadOptions() {
329 this.ignoreCache = false;
330 this.injectedScript = '';
331 this.userAgent = '';
332}
333
334const Adb = {};
335/** @typedef {{id: string, name: string, url: string, attached: boolean}} */
336Adb.Page;
337/** @typedef {{id: string, adbBrowserChromeVersion: string, compatibleVersion: boolean, adbBrowserName: string, source: string, adbBrowserVersion: string, pages: !Array<!Adb.Page>}} */
338Adb.Browser;
339/** @typedef {{id: string, adbModel: string, adbSerial: string, browsers: !Array.<!Adb.Browser>, adbPortStatus: !Array.<number>, adbConnected: boolean}} */
340Adb.Device;
341/** @typedef {!Object.<string, string>} */
342Adb.PortForwardingConfig;
343/** @typedef {!{port: string, address: string}} */
344Adb.PortForwardingRule;
345/** @typedef {{ports: !Object<string, number>, browserId: string}} */
346Adb.DevicePortForwardingStatus;
347/** @typedef {!Object<string, !Adb.DevicePortForwardingStatus>} */
348Adb.PortForwardingStatus;
349/** @typedef {!Array<string>} */
350Adb.NetworkDiscoveryConfig;
351/**
352 * @typedef {!{
353 * discoverUsbDevices: boolean,
354 * portForwardingEnabled: boolean,
355 * portForwardingConfig: !Adb.PortForwardingConfig,
356 * networkDiscoveryEnabled: boolean,
357 * networkDiscoveryConfig: !Adb.NetworkDiscoveryConfig
358 * }}
359 */
360Adb.Config;
361
362/** @const */
363const module = {};
364
365/**
366 * @constructor
367 */
368function diff_match_patch() {
369}
370
371diff_match_patch.prototype = {
372 /**
373 * @param {string} text1
374 * @param {string} text2
375 * @return {!Array.<!{0: number, 1: string}>}
376 */
377 diff_main: function(text1, text2) {},
378
379 /**
380 * @param {!Array.<!{0: number, 1: string}>} diff
381 */
382 diff_cleanupSemantic(diff) {}
383};
384
385/** @constructor */
386const Doc = function() {};
387Doc.prototype = {
388 /** @type {number} */
389 scrollLeft: 0,
390 /** @type {number} */
391 scrollTop: 0
392};
393
394/** @constructor */
395const CodeMirror = function(element, config) {};
396CodeMirror.on = function(obj, type, handler) {};
397CodeMirror.prototype = {
398 /** @type {!Doc} */
399 doc: null,
400 addKeyMap: function(map) {},
401 addLineClass: function(handle, where, cls) {},
402 /**
403 * @param {?Object=} options
404 * @return {!CodeMirror.LineWidget}
405 */
406 addLineWidget: function(handle, node, options) {},
407 /**
408 * @param {string|!Object} spec
409 * @param {!Object=} options
410 */
411 addOverlay: function(spec, options) {},
412 addWidget: function(pos, node, scroll, vert, horiz) {},
Joel Einbinderd7595c72018-05-15 17:41:54413 /** @param {boolean=} isClosed bv */
414 changeGeneration: function(isClosed) {},
Blink Reformat4c46d092018-04-07 15:32:37415 charCoords: function(pos, mode) {},
416 clearGutter: function(gutterID) {},
417 clearHistory: function() {},
418 clipPos: function(pos) {},
419 /** @param {string=} mode */
420 coordsChar: function(coords, mode) {},
421 /** @param {string=} mode */
422 cursorCoords: function(start, mode) {},
423 defaultCharWidth: function() {},
424 defaultTextHeight: function() {},
425 deleteH: function(dir, unit) {},
426 /**
427 * @param {*=} to
428 * @param {*=} op
429 */
430 eachLine: function(from, to, op) {},
431 execCommand: function(cmd) {},
432 extendSelection: function(from, to) {},
433 findMarks: function(from, to) {},
434 findMarksAt: function(pos) {},
435 /**
436 * @param {!CodeMirror.Pos} from
437 * @param {boolean=} strict
438 * @param {Object=} config
439 */
440 findMatchingBracket: function(from, strict, config) {},
441 findPosH: function(from, amount, unit, visually) {},
442 findPosV: function(from, amount, unit, goalColumn) {},
443 firstLine: function() {},
444 focus: function() {},
445 getAllMarks: function() {},
446 /** @param {string=} start */
447 getCursor: function(start) {},
448 getDoc: function() {},
449 getGutterElement: function() {},
450 getHistory: function() {},
451 getInputField: function() {},
452 getLine: function(line) {},
453 /**
454 * @return {!{wrapClass: string, height: number}}
455 */
456 getLineHandle: function(line) {},
457 getLineNumber: function(line) {},
458 /**
459 * @return {!{token: function(CodeMirror.StringStream, Object):string}}
460 */
461 getMode: function() {},
462 getOption: function(option) {},
463 /** @param {*=} lineSep */
464 getRange: function(from, to, lineSep) {},
465 /**
466 * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}}
467 */
468 getScrollInfo: function() {},
469 getScrollerElement: function() {},
470 getSelection: function() {},
471 getSelections: function() {},
472 getStateAfter: function(line) {},
473 getTokenAt: function(pos) {},
474 /** @param {*=} lineSep */
475 getValue: function(lineSep) {},
476 getViewport: function() {},
477 getWrapperElement: function() {},
478 hasFocus: function() {},
479 historySize: function() {},
480 indentLine: function(n, dir, aggressive) {},
481 indentSelection: function(how) {},
482 indexFromPos: function(coords) {},
Joel Einbinderd7595c72018-05-15 17:41:54483 /** @param {number=} generation */
484 isClean: function(generation) {},
Blink Reformat4c46d092018-04-07 15:32:37485 iterLinkedDocs: function(f) {},
486 lastLine: function() {},
487 lineCount: function() {},
488 lineInfo: function(line) {},
489 /**
490 * @param {number} height
491 * @param {string=} mode
492 */
493 lineAtHeight: function(height, mode) {},
494 linkedDoc: function(options) {},
495 listSelections: function() {},
496 markClean: function() {},
497 markText: function(from, to, options) {},
498 moveH: function(dir, unit) {},
499 moveV: function(dir, unit) {},
500 off: function(type, f) {},
501 on: function(type, f) {},
502 operation: function(f) {},
503 posFromIndex: function(off) {},
504 redo: function() {},
505 refresh: function() {},
506 removeKeyMap: function(map) {},
507 removeLine: function(line) {},
508 removeLineClass: function(handle, where, cls) {},
509 removeLineWidget: function(widget) {},
510 removeOverlay: function(spec) {},
511 /** @param {*=} origin */
512 replaceRange: function(code, from, to, origin) {},
513 /**
514 * @param {string} replacement
515 * @param {string=} select
516 */
517 replaceSelection: function(replacement, select) {},
518 /**
519 * @param {!Array.<string>} textPerSelection
520 */
521 replaceSelections: function(textPerSelection) {},
522 /** @param {*=} margin */
523 scrollIntoView: function(pos, margin) {},
524 scrollTo: function(x, y) {},
525 setBookmark: function(pos, options) {},
526 setCursor: function(line, ch, extend) {},
527 setExtending: function(val) {},
528 setGutterMarker: function(line, gutterID, value) {},
529 setHistory: function(histData) {},
530 setLine: function(line, text) {},
531 setOption: function(option, value) {},
Joel Einbinder5d6cc6e2018-05-05 06:29:47532 setSelection: function(anchor, head, options) {},
Blink Reformat4c46d092018-04-07 15:32:37533 /**
534 * @param {number=} primaryIndex
535 * @param {?Object=} config
536 */
537 setSelections: function(selections, primaryIndex, config) {},
538 setSize: function(width, height) {},
539 setValue: function(code) {},
540 somethingSelected: function() {},
541 swapDoc: function(doc) {},
542 undo: function() {},
543 unlinkDoc: function(other) {}
544};
Joel Einbinderbbaf3832018-12-15 00:05:35545/** @type {!{cursorDiv: Element, lineSpace: Element, gutters: Element}} */
Blink Reformat4c46d092018-04-07 15:32:37546CodeMirror.prototype.display;
John Emaud3bef012019-06-05 18:08:40547/** @type {!{devtoolsAccessibleName: string, mode: string, lineWrapping: boolean}} */
Blink Reformat4c46d092018-04-07 15:32:37548CodeMirror.prototype.options;
549/** @type {!Object} */
550CodeMirror.Pass;
551CodeMirror.showHint = function(codeMirror, hintintFunction) {};
552CodeMirror.commands = {};
553CodeMirror.modes = {};
554CodeMirror.mimeModes = {};
555CodeMirror.getMode = function(options, spec) {};
556CodeMirror.overlayMode = function(mode1, mode2, squashSpans) {};
557CodeMirror.defineMode = function(modeName, modeConstructor) {};
558CodeMirror.startState = function(mode) {};
559CodeMirror.copyState = function(mode, state) {};
Joel Einbinderf5ea74e2018-06-05 02:14:19560CodeMirror.inputStyles = {};
561CodeMirror.inputStyles.textarea = class {
562 constructor() {
563 /** @type {!HTMLTextAreaElement} */
564 this.textarea;
565 this.prevInput = '';
566 this.composing = false;
567 this.contextMenuPending = false;
568 /** @type {!CodeMirror} */
569 this.cm;
570 }
571 /**
572 * @param {!Object} display
573 */
574 init(display) {
575 }
576
577 /**
578 * @param {boolean=} typing
579 */
580 reset(typing) {
581 }
582
583 /**
584 * @return {boolean}
585 */
586 poll() {
587 return false;
588 }
589};
Blink Reformat4c46d092018-04-07 15:32:37590
591/** @typedef {{canceled: boolean, from: !CodeMirror.Pos, to: !CodeMirror.Pos, text: string, origin: string, cancel: function()}} */
592CodeMirror.BeforeChangeObject;
593
594/** @typedef {{from: !CodeMirror.Pos, to: !CodeMirror.Pos, origin: string, text: !Array.<string>, removed: !Array.<string>}} */
595CodeMirror.ChangeObject;
596
597/** @constructor */
598CodeMirror.Pos = function(line, ch) {};
599/** @type {number} */
600CodeMirror.Pos.prototype.line;
601/** @type {number} */
602CodeMirror.Pos.prototype.ch;
603
604/**
605 * @param {!CodeMirror.Pos} pos1
606 * @param {!CodeMirror.Pos} pos2
607 * @return {number}
608 */
609CodeMirror.cmpPos = function(pos1, pos2) {};
610
611/** @constructor */
612CodeMirror.StringStream = function(line) {
613 this.pos = 0;
614 this.start = 0;
615};
616CodeMirror.StringStream.prototype = {
617 backUp: function(n) {},
618 column: function() {},
619 current: function() {},
620 eat: function(match) {},
621 eatSpace: function() {},
622 eatWhile: function(match) {},
623 eol: function() {},
624 indentation: function() {},
625 /**
626 * @param {!RegExp|string} pattern
627 * @param {boolean=} consume
628 * @param {boolean=} caseInsensitive
629 */
630 match: function(pattern, consume, caseInsensitive) {},
631 next: function() {},
632 peek: function() {},
633 skipTo: function(ch) {},
634 skipToEnd: function() {},
635 sol: function() {}
636};
637
638/** @constructor */
639CodeMirror.TextMarker = function(doc, type) {};
640CodeMirror.TextMarker.prototype = {
641 clear: function() {},
642 find: function() {},
643 changed: function() {}
644};
645
646/** @constructor */
647CodeMirror.LineWidget = function() {};
648CodeMirror.LineWidget.prototype = {
649 clear: function() {}
650};
651
652/** @type {Object.<string, !Object.<string, string>>} */
653CodeMirror.keyMap;
654
655/** @type {{scrollLeft: number, scrollTop: number}} */
656CodeMirror.doc;
657
658/**
659 * @param {string} mime
660 * @param {string} mode
661 */
662CodeMirror.defineMIME = function(mime, mode) {};
663
664/** @type {boolean} */
665window.dispatchStandaloneTestRunnerMessages;
666
667/**
668 * @param {Array.<Object>} keyframes
669 * @param {number|Object} timing
670 * @return {Object}
671 */
672Element.prototype.animate = function(keyframes, timing) {};
673
674/**
675 * @param {...!Node} nodes
676 * @return {undefined}
Alexei Filippovf38c8362018-06-27 01:27:47677 * @see https://dom.spec.whatwg.org/#dom-parentnode-append
678 */
679Element.prototype.append = function(nodes) {};
680
681/**
682 * @param {...!Node} nodes
683 * @return {undefined}
Blink Reformat4c46d092018-04-07 15:32:37684 * @see https://dom.spec.whatwg.org/#dom-parentnode-prepend
685 */
686Element.prototype.prepend = function(nodes) {};
687
688/**
689 * @override
690 * @param {string} type
691 * @param {(!EventListener|!function (!Event): (boolean|undefined)|null)} listener
692 * @param {(boolean|!{capture: (boolean|undefined), once: (boolean|undefined), passive: (boolean|undefined)})=} options
693 * @this {EventTarget}
694 */
695Element.prototype.addEventListener = function(type, listener, options) {};
696
697/**
698 * @override
699 * @param {string} type
700 * @param {(!EventListener|!function (!Event): (boolean|undefined)|null)} listener
701 * @param {(boolean|!{capture: (boolean|undefined), once: (boolean|undefined), passive: (boolean|undefined)})=} options
702 * @this {EventTarget}
703 */
704Element.prototype.removeEventListener = function(type, listener, options) {};
705
706const acorn = {
707 /**
708 * @param {string} text
709 * @param {Object.<string, boolean>} options
710 * @return {!ESTree.Node}
711 */
712 parse: function(text, options) {},
713
714 /**
715 * @param {string} text
716 * @param {Object.<string, boolean>} options
Blink Reformat4c46d092018-04-07 15:32:37717 * @return {!Acorn.Tokenizer}
718 */
719 tokenizer: function(text, options) {},
720
721 tokTypes: {
722 _true: new Acorn.TokenType(),
723 _false: new Acorn.TokenType(),
724 _null: new Acorn.TokenType(),
725 num: new Acorn.TokenType(),
726 regexp: new Acorn.TokenType(),
727 string: new Acorn.TokenType(),
728 name: new Acorn.TokenType(),
729 eof: new Acorn.TokenType()
730 }
731};
732
Alexey Kozyatinskiy7f940512018-09-25 22:23:23733acorn.loose = {};
734
735/**
736 * @param {string} text
737 * @param {Object.<string, boolean>} options
738 * @return {!ESTree.Node}
739 */
740acorn.loose.parse = function(text, options) {};
741
Blink Reformat4c46d092018-04-07 15:32:37742const Acorn = {};
743/**
744 * @constructor
745 */
746Acorn.Tokenizer = function() {
747 /** @type {function():!Acorn.Token} */
748 this.getToken;
749};
750
751/**
752 * @constructor
753 */
754Acorn.TokenType = function() {
755 /** @type {string} */
756 this.label;
757 /** @type {(string|undefined)} */
758 this.keyword;
759};
760
761/**
762 * @typedef {{type: !Acorn.TokenType, value: string, start: number, end: number}}
763 */
764Acorn.Token;
765
766/**
767 * @typedef {{type: string, value: string, start: number, end: number}}
768 */
769Acorn.Comment;
770
771/**
772 * @typedef {(!Acorn.Token|!Acorn.Comment)}
773 */
774Acorn.TokenOrComment;
775
776const ESTree = {};
777
778/**
779 * @constructor
780 */
781ESTree.Node = function() {
782 /** @type {number} */
783 this.start;
784 /** @type {number} */
785 this.end;
786 /** @type {string} */
787 this.type;
788 /** @type {(!ESTree.Node|undefined)} */
789 this.body;
790 /** @type {(!Array.<!ESTree.Node>|undefined)} */
791 this.declarations;
792 /** @type {(!Array.<!ESTree.Node>|undefined)} */
793 this.properties;
794 /** @type {(!ESTree.Node|undefined)} */
795 this.init;
796 /** @type {(!Array.<!ESTree.Node>|undefined)} */
797 this.params;
798 /** @type {(string|undefined)} */
799 this.name;
800 /** @type {(?ESTree.Node|undefined)} */
801 this.id;
802 /** @type {(number|undefined)} */
803 this.length;
804 /** @type {(?ESTree.Node|undefined)} */
805 this.argument;
806 /** @type {(string|undefined)} */
807 this.operator;
808 /** @type {(!ESTree.Node|undefined)} */
809 this.right;
810 /** @type {(!ESTree.Node|undefined)} */
811 this.left;
812 /** @type {(string|undefined)} */
813 this.kind;
814 /** @type {(!ESTree.Node|undefined)} */
815 this.property;
816 /** @type {(!ESTree.Node|undefined)} */
817 this.object;
818 /** @type {(string|undefined)} */
819 this.raw;
820 /** @type {(boolean|undefined)} */
821 this.computed;
822};
823
824/**
825 * @extends {ESTree.Node}
826 * @constructor
827 */
828ESTree.TemplateLiteralNode = function() {
829 /** @type {!Array.<!ESTree.Node>} */
830 this.quasis;
831 /** @type {!Array.<!ESTree.Node>} */
832 this.expressions;
833};
834
835/**
836 * @type {string}
837 * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object
838 * TODO(jsbell): DOMException should be a subclass of Error.
839 */
840DOMException.prototype.message;
841/** @type {number} */
842DOMException.ABORT_ERR;
843
844/**
845 * @constructor
846 * @param {!Object} params
847 */
848const Terminal = function(params) {};
849
850Terminal.prototype = {
851 fit: function() {},
852 linkify: function() {},
853 /** @param {!Element} element */
854 open: function(element) {},
855 /** @param {string} eventName * @param {!Function} handler */
856 on: function(eventName, handler) {}
857};
858
859/**
860 * @param {string} context
861 * @return {!Console}
862 */
863Console.prototype.context = function(context) {};
864
865
866/**
867 * @param {!Array<string>|string} strings
868 * @param {...*} vararg
869 * @return {string}
870 */
871const ls = function(strings, vararg) {};
872
873/**
874 * @constructor
875 * @param {function(!Array<*>)} callback
876 */
877const ResizeObserver = function(callback) {};
Paul Irish8f1e33d2018-05-31 02:29:50878
879
880// Lighthouse Report Renderer
881
882/**
883 * @constructor
884 * @param {!Document} document
885 */
886const DOM = function(document) {};
887
888/**
889 * @constructor
890 * @param {!DOM} dom
891 */
892const ReportRenderer = function(dom) {};
893
894ReportRenderer.prototype = {
895 /**
896 * @param {!ReportRenderer.ReportJSON} report
897 * @param {!Element} container Parent element to render the report into.
898 */
899 renderReport: function(report, container) {},
900
901 /**
902 * @param {!Document|!Element} context
903 */
904 setTemplateContext: function(context) {},
905
906};
907
908/**
[email protected]f2f8c092019-05-30 22:01:56909 * @constructor
910 * @param {!DOM} dom
911 */
912const ReportUIFeatures = function(dom) {};
913
914ReportUIFeatures.prototype = {
915 /**
916 * @param {!Document|!Element} context
917 */
918 setTemplateContext: function(context) {},
919
920 /**
921 * @param {!ReportRenderer.ReportJSON} report
922 */
923 initFeatures: function(report) {},
924};
925
926/**
Paul Irish8f1e33d2018-05-31 02:29:50927 * @typedef {{
928 * rawValue: (number|boolean|undefined),
929 * id: string,
930 * title: string,
931 * description: string,
932 * explanation: (string|undefined),
933 * errorMessage: (string|undefined),
934 * displayValue: (string|Array<string|number>|undefined),
935 * scoreDisplayMode: string,
936 * error: boolean,
937 * score: (number|null),
938 * details: (!DetailsRenderer.DetailsJSON|undefined),
939 * }}
940 */
941ReportRenderer.AuditResultJSON;
942
943/**
944 * @typedef {{
945 * id: string,
946 * score: (number|null),
947 * weight: number,
948 * group: (string|undefined),
949 * result: ReportRenderer.AuditResultJSON
950 * }}
951 */
952ReportRenderer.AuditJSON;
953
954/**
955 * @typedef {{
956 * title: string,
957 * id: string,
958 * score: (number|null),
959 * description: (string|undefined),
960 * manualDescription: string,
961 * auditRefs: !Array<!ReportRenderer.AuditJSON>
962 * }}
963 */
964ReportRenderer.CategoryJSON;
965
966/**
967 * @typedef {{
968 * title: string,
969 * description: (string|undefined),
970 * }}
971 */
972ReportRenderer.GroupJSON;
973
974/**
975 * @typedef {{
976 * lighthouseVersion: string,
977 * userAgent: string,
978 * fetchTime: string,
979 * timing: {total: number},
980 * requestedUrl: string,
981 * finalUrl: string,
982 * runWarnings: (!Array<string>|undefined),
983 * artifacts: {traces: {defaultPass: {traceEvents: !Array}}},
984 * audits: !Object<string, !ReportRenderer.AuditResultJSON>,
985 * categories: !Object<string, !ReportRenderer.CategoryJSON>,
986 * categoryGroups: !Object<string, !ReportRenderer.GroupJSON>,
987 * }}
988 */
989ReportRenderer.ReportJSON;
990
991/**
992 * @typedef {{
993 * traces: {defaultPass: {traceEvents: !Array}},
994 * }}
995 */
996ReportRenderer.RunnerResultArtifacts;
997
998/**
999 * @typedef {{
1000 * lhr: !ReportRenderer.ReportJSON,
1001 * artifacts: ReportRenderer.RunnerResultArtifacts,
1002 * report: string
1003 * }}
1004 */
1005ReportRenderer.RunnerResult;
1006
1007
1008/**
1009 * @constructor
1010 * @param {!DOM} dom
1011 * @param {!DetailsRenderer} detailsRenderer
1012 */
1013const CategoryRenderer = function(dom, detailsRenderer) {};
1014
1015
1016/**
1017 * @constructor
1018 * @param {!DOM} dom
1019 */
1020const DetailsRenderer = function(dom) {};
1021
1022DetailsRenderer.prototype = {
1023 /**
1024 * @param {!DetailsRenderer.NodeDetailsJSON} item
1025 * @return {!Element}
1026 */
1027 renderNode: function(item) {},
1028};
1029
1030/**
1031 * @typedef {{
1032 * type: string,
1033 * value: (string|number|undefined),
1034 * summary: (DetailsRenderer.OpportunitySummary|undefined),
1035 * granularity: (number|undefined),
1036 * displayUnit: (string|undefined)
1037 * }}
1038 */
1039DetailsRenderer.DetailsJSON;
1040
1041/**
1042 * @typedef {{
1043 * type: string,
1044 * path: (string|undefined),
1045 * selector: (string|undefined),
1046 * snippet:(string|undefined)
1047 * }}
1048 */
1049DetailsRenderer.NodeDetailsJSON;
1050
1051/** @typedef {{
1052 * wastedMs: (number|undefined),
1053 * wastedBytes: (number|undefined),
1054 * }}
1055 */
1056DetailsRenderer.OpportunitySummary;
Ingvar Stepanyan562fcd72018-06-06 22:52:091057
1058
1059// Clipboard API
1060
1061/** @constructor */
1062const Clipboard = function() {};
1063/**
1064 * @param {string} data
1065 * @return {!Promise}
1066 */
1067Clipboard.prototype.writeText = function(data) {};
1068
1069/** @type {Clipboard} */
1070Navigator.prototype.clipboard;
[email protected]90147502019-04-09 03:41:431071
1072const Lighthouse = {};
1073
1074Lighthouse.ReportGenerator = {};
1075
1076/**
1077 * @param {!ReportRenderer.ReportJSON} lhr
1078 * @return {string}
1079 */
1080Lighthouse.ReportGenerator.generateReportHtml;
1081
1082/**
1083 * @param {string} source
1084 * @param {Array<{search: string, replacement: string}>} replacements
1085 * @return {string}
1086 */
1087Lighthouse.ReportGenerator.replaceStrings;