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