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