blob: 52658203b548015d522a1f04c76538458ba14d95 [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};
545/** @type {!{cursorDiv: Element, lineSpace: Element}} */
546CodeMirror.prototype.display;
Joel Einbinderf5ea74e2018-06-05 02:14:19547/** @type {!{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
717 * @return {!ESTree.Node}
718 */
719 parse_dammit: function(text, options) {},
720
721 /**
722 * @param {string} text
723 * @param {Object.<string, boolean>} options
724 * @return {!Acorn.Tokenizer}
725 */
726 tokenizer: function(text, options) {},
727
728 tokTypes: {
729 _true: new Acorn.TokenType(),
730 _false: new Acorn.TokenType(),
731 _null: new Acorn.TokenType(),
732 num: new Acorn.TokenType(),
733 regexp: new Acorn.TokenType(),
734 string: new Acorn.TokenType(),
735 name: new Acorn.TokenType(),
736 eof: new Acorn.TokenType()
737 }
738};
739
740const Acorn = {};
741/**
742 * @constructor
743 */
744Acorn.Tokenizer = function() {
745 /** @type {function():!Acorn.Token} */
746 this.getToken;
747};
748
749/**
750 * @constructor
751 */
752Acorn.TokenType = function() {
753 /** @type {string} */
754 this.label;
755 /** @type {(string|undefined)} */
756 this.keyword;
757};
758
759/**
760 * @typedef {{type: !Acorn.TokenType, value: string, start: number, end: number}}
761 */
762Acorn.Token;
763
764/**
765 * @typedef {{type: string, value: string, start: number, end: number}}
766 */
767Acorn.Comment;
768
769/**
770 * @typedef {(!Acorn.Token|!Acorn.Comment)}
771 */
772Acorn.TokenOrComment;
773
774const ESTree = {};
775
776/**
777 * @constructor
778 */
779ESTree.Node = function() {
780 /** @type {number} */
781 this.start;
782 /** @type {number} */
783 this.end;
784 /** @type {string} */
785 this.type;
786 /** @type {(!ESTree.Node|undefined)} */
787 this.body;
788 /** @type {(!Array.<!ESTree.Node>|undefined)} */
789 this.declarations;
790 /** @type {(!Array.<!ESTree.Node>|undefined)} */
791 this.properties;
792 /** @type {(!ESTree.Node|undefined)} */
793 this.init;
794 /** @type {(!Array.<!ESTree.Node>|undefined)} */
795 this.params;
796 /** @type {(string|undefined)} */
797 this.name;
798 /** @type {(?ESTree.Node|undefined)} */
799 this.id;
800 /** @type {(number|undefined)} */
801 this.length;
802 /** @type {(?ESTree.Node|undefined)} */
803 this.argument;
804 /** @type {(string|undefined)} */
805 this.operator;
806 /** @type {(!ESTree.Node|undefined)} */
807 this.right;
808 /** @type {(!ESTree.Node|undefined)} */
809 this.left;
810 /** @type {(string|undefined)} */
811 this.kind;
812 /** @type {(!ESTree.Node|undefined)} */
813 this.property;
814 /** @type {(!ESTree.Node|undefined)} */
815 this.object;
816 /** @type {(string|undefined)} */
817 this.raw;
818 /** @type {(boolean|undefined)} */
819 this.computed;
820};
821
822/**
823 * @extends {ESTree.Node}
824 * @constructor
825 */
826ESTree.TemplateLiteralNode = function() {
827 /** @type {!Array.<!ESTree.Node>} */
828 this.quasis;
829 /** @type {!Array.<!ESTree.Node>} */
830 this.expressions;
831};
832
833/**
834 * @type {string}
835 * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object
836 * TODO(jsbell): DOMException should be a subclass of Error.
837 */
838DOMException.prototype.message;
839/** @type {number} */
840DOMException.ABORT_ERR;
841
842/**
843 * @constructor
844 * @param {!Object} params
845 */
846const Terminal = function(params) {};
847
848Terminal.prototype = {
849 fit: function() {},
850 linkify: function() {},
851 /** @param {!Element} element */
852 open: function(element) {},
853 /** @param {string} eventName * @param {!Function} handler */
854 on: function(eventName, handler) {}
855};
856
857/**
858 * @param {string} context
859 * @return {!Console}
860 */
861Console.prototype.context = function(context) {};
862
863
864/**
865 * @param {!Array<string>|string} strings
866 * @param {...*} vararg
867 * @return {string}
868 */
869const ls = function(strings, vararg) {};
870
871/**
872 * @constructor
873 * @param {function(!Array<*>)} callback
874 */
875const ResizeObserver = function(callback) {};
Paul Irish8f1e33d2018-05-31 02:29:50876
877
878// Lighthouse Report Renderer
879
880/**
881 * @constructor
882 * @param {!Document} document
883 */
884const DOM = function(document) {};
885
886/**
887 * @constructor
888 * @param {!DOM} dom
889 */
890const ReportRenderer = function(dom) {};
891
892ReportRenderer.prototype = {
893 /**
894 * @param {!ReportRenderer.ReportJSON} report
895 * @param {!Element} container Parent element to render the report into.
896 */
897 renderReport: function(report, container) {},
898
899 /**
900 * @param {!Document|!Element} context
901 */
902 setTemplateContext: function(context) {},
903
904};
905
906/**
907 * @typedef {{
908 * rawValue: (number|boolean|undefined),
909 * id: string,
910 * title: string,
911 * description: string,
912 * explanation: (string|undefined),
913 * errorMessage: (string|undefined),
914 * displayValue: (string|Array<string|number>|undefined),
915 * scoreDisplayMode: string,
916 * error: boolean,
917 * score: (number|null),
918 * details: (!DetailsRenderer.DetailsJSON|undefined),
919 * }}
920 */
921ReportRenderer.AuditResultJSON;
922
923/**
924 * @typedef {{
925 * id: string,
926 * score: (number|null),
927 * weight: number,
928 * group: (string|undefined),
929 * result: ReportRenderer.AuditResultJSON
930 * }}
931 */
932ReportRenderer.AuditJSON;
933
934/**
935 * @typedef {{
936 * title: string,
937 * id: string,
938 * score: (number|null),
939 * description: (string|undefined),
940 * manualDescription: string,
941 * auditRefs: !Array<!ReportRenderer.AuditJSON>
942 * }}
943 */
944ReportRenderer.CategoryJSON;
945
946/**
947 * @typedef {{
948 * title: string,
949 * description: (string|undefined),
950 * }}
951 */
952ReportRenderer.GroupJSON;
953
954/**
955 * @typedef {{
956 * lighthouseVersion: string,
957 * userAgent: string,
958 * fetchTime: string,
959 * timing: {total: number},
960 * requestedUrl: string,
961 * finalUrl: string,
962 * runWarnings: (!Array<string>|undefined),
963 * artifacts: {traces: {defaultPass: {traceEvents: !Array}}},
964 * audits: !Object<string, !ReportRenderer.AuditResultJSON>,
965 * categories: !Object<string, !ReportRenderer.CategoryJSON>,
966 * categoryGroups: !Object<string, !ReportRenderer.GroupJSON>,
967 * }}
968 */
969ReportRenderer.ReportJSON;
970
971/**
972 * @typedef {{
973 * traces: {defaultPass: {traceEvents: !Array}},
974 * }}
975 */
976ReportRenderer.RunnerResultArtifacts;
977
978/**
979 * @typedef {{
980 * lhr: !ReportRenderer.ReportJSON,
981 * artifacts: ReportRenderer.RunnerResultArtifacts,
982 * report: string
983 * }}
984 */
985ReportRenderer.RunnerResult;
986
987
988/**
989 * @constructor
990 * @param {!DOM} dom
991 * @param {!DetailsRenderer} detailsRenderer
992 */
993const CategoryRenderer = function(dom, detailsRenderer) {};
994
995
996/**
997 * @constructor
998 * @param {!DOM} dom
999 */
1000const DetailsRenderer = function(dom) {};
1001
1002DetailsRenderer.prototype = {
1003 /**
1004 * @param {!DetailsRenderer.NodeDetailsJSON} item
1005 * @return {!Element}
1006 */
1007 renderNode: function(item) {},
1008};
1009
1010/**
1011 * @typedef {{
1012 * type: string,
1013 * value: (string|number|undefined),
1014 * summary: (DetailsRenderer.OpportunitySummary|undefined),
1015 * granularity: (number|undefined),
1016 * displayUnit: (string|undefined)
1017 * }}
1018 */
1019DetailsRenderer.DetailsJSON;
1020
1021/**
1022 * @typedef {{
1023 * type: string,
1024 * path: (string|undefined),
1025 * selector: (string|undefined),
1026 * snippet:(string|undefined)
1027 * }}
1028 */
1029DetailsRenderer.NodeDetailsJSON;
1030
1031/** @typedef {{
1032 * wastedMs: (number|undefined),
1033 * wastedBytes: (number|undefined),
1034 * }}
1035 */
1036DetailsRenderer.OpportunitySummary;
Ingvar Stepanyan562fcd72018-06-06 22:52:091037
1038
1039// Clipboard API
1040
1041/** @constructor */
1042const Clipboard = function() {};
1043/**
1044 * @param {string} data
1045 * @return {!Promise}
1046 */
1047Clipboard.prototype.writeText = function(data) {};
1048
1049/** @type {Clipboard} */
1050Navigator.prototype.clipboard;