Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / front_end / externs.js
blob779d2c3ec5300ec1c89db53efcf0ddceb37ac132
1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
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.
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.
31 // WebKit Web Facing API
33 /**
34 * @param {!Object} object
35 * @param {!Function} callback
37 Object.observe = function(object, callback) {}
39 /** @type {boolean} */
40 Event.prototype.isMetaOrCtrlForTest;
42 /** @type {string} */
43 Event.prototype.code;
45 /**
46 * @type {number}
48 KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;
50 /**
51 * @param {!T} value
52 * @param {boolean=} onlyFirst
53 * @this {Array.<T>}
54 * @template T
56 Array.prototype.remove = function(value, onlyFirst) {}
57 /**
58 * @param {!Array.<!T>} array
59 * @this {Array.<!T>}
60 * @template T
62 Array.prototype.pushAll = function(array) {}
63 /**
64 * @return {!Object.<string, boolean>}
65 * @this {Array.<T>}
66 * @template T
68 Array.prototype.keySet = function() {}
69 /**
70 * @param {number} index
71 * @return {!Array.<!T>}
72 * @this {Array.<T>}
73 * @template T
75 Array.prototype.rotate = function(index) {}
76 /**
77 * @this {Array.<number>}
79 Array.prototype.sortNumbers = function() {}
80 /**
81 * @param {!T} object
82 * @param {function(!T,!S):number=} comparator
83 * @return {number}
84 * @this {Array.<S>}
85 * @template T,S
87 Array.prototype.lowerBound = function(object, comparator) {}
88 /**
89 * @param {!T} object
90 * @param {function(!T,!S):number=} comparator
91 * @return {number}
92 * @this {Array.<S>}
93 * @template T,S
95 Array.prototype.upperBound = function(object, comparator) {}
96 /**
97 * @param {!T} value
98 * @param {function(!T,!S):number} comparator
99 * @return {number}
100 * @this {Array.<S>}
101 * @template T,S
103 Array.prototype.binaryIndexOf = function(value, comparator) {}
105 * @param {function(number, number): number} comparator
106 * @param {number} leftBound
107 * @param {number} rightBound
108 * @param {number} sortWindowLeft
109 * @param {number} sortWindowRight
110 * @return {!Array.<number>}
111 * @this {Array.<number>}
113 Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {}
116 * @param {function(!T,!T): number=} comparator
117 * @return {!Array.<T>}
118 * @this {Array.<T>}
119 * @template T
121 Array.prototype.stableSort = function(comparator) {}
124 * @this {Array.<number>}
125 * @param {function(number,number):boolean} comparator
126 * @param {number} left
127 * @param {number} right
128 * @param {number} pivotIndex
129 * @return {number}
131 Array.prototype.partition = function(comparator, left, right, pivotIndex) {}
134 * @this {Array.<number>}
135 * @param {number} k
136 * @param {function(number,number):boolean=} comparator
137 * @return {number}
139 Array.prototype.qselect = function(k, comparator) {}
142 * @param {string} field
143 * @return {!Array.<!T>}
144 * @this {Array.<!Object.<string,T>>}
145 * @template T
147 Array.prototype.select = function(field) {}
150 * @return {!T|undefined}
151 * @this {Array.<T>}
152 * @template T
154 Array.prototype.peekLast = function() {}
157 * @param {!Array.<T>} array
158 * @param {function(T,T):number} comparator
159 * @return {!Array.<T>}
160 * @this {!Array.<T>}
161 * @template T
163 Array.prototype.intersectOrdered = function(array, comparator) {}
166 * @param {!Array.<T>} array
167 * @param {function(T,T):number} comparator
168 * @return {!Array.<T>}
169 * @this {!Array.<T>}
170 * @template T
172 Array.prototype.mergeOrdered = function(array, comparator) {}
174 // File System API
176 * @constructor
178 function DOMFileSystem() {}
181 * @type {DirectoryEntry}
183 DOMFileSystem.prototype.root = null;
186 * @type {*}
188 window.domAutomationController;
190 var DevToolsHost = {};
192 /** @typedef {{type:string, id:(number|undefined),
193 label:(string|undefined), enabled:(boolean|undefined), checked:(boolean|undefined),
194 subItems:(!Array.<!DevToolsHost.ContextMenuDescriptor>|undefined)}} */
195 DevToolsHost.ContextMenuDescriptor;
198 * @return {number}
200 DevToolsHost.zoomFactor = function() { }
203 * @param {string} origin
204 * @param {string} script
206 DevToolsHost.setInjectedScriptForOrigin = function(origin, script) { }
209 * @param {string} text
211 DevToolsHost.copyText = function(text) { }
214 * @return {string}
216 DevToolsHost.platform = function() { }
219 * @param {number} x
220 * @param {number} y
221 * @param {!Array.<!DevToolsHost.ContextMenuDescriptor>} items
222 * @param {!Document} document
224 DevToolsHost.showContextMenuAtPoint = function(x, y, items, document) { }
227 * @param {string} message
229 DevToolsHost.sendMessageToBackend = function(message) { }
232 * @param {string} message
234 DevToolsHost.sendMessageToEmbedder = function(message) { }
237 * @return {string}
239 DevToolsHost.getSelectionBackgroundColor = function() { }
242 * @return {string}
244 DevToolsHost.getSelectionForegroundColor = function() { }
247 * @return {boolean}
249 DevToolsHost.isUnderTest = function() { }
252 * @return {boolean}
254 DevToolsHost.isHostedMode = function() { }
256 // FIXME: remove everything below.
257 var FormatterWorker = {}
258 var WebInspector = {}
260 WebInspector.panels = {};
262 WebInspector.reload = function() { }
264 /** Extensions API */
266 /** @constructor */
267 function AuditCategory() {}
268 /** @constructor */
269 function AuditResult() {}
270 /** @constructor */
271 function EventSink() {}
272 /** @constructor */
273 function ExtensionSidebarPane() {}
274 /** @constructor */
275 function Panel() {}
276 /** @constructor */
277 function PanelWithSidebar() {}
278 /** @constructor */
279 function Resource() {}
280 /** @constructor */
281 function Timeline() {}
283 var extensionServer;
286 * @constructor
288 function ExtensionDescriptor() {
289 this.startPage = "";
290 this.name = "";
294 * @constructor
296 function ExtensionReloadOptions() {
297 this.ignoreCache = false;
298 this.injectedScript = "";
299 this.userAgent = "";
302 var Adb = {};
303 /** @typedef {{id: string, name: string, url: string, adbAttachedForeign: boolean}} */
304 Adb.Page;
305 /** @typedef {{id: string, adbBrowserChromeVersion: string, compatibleVersion: boolean, adbBrowserName: string, source: string, adbBrowserVersion: string, pages: !Array<!Adb.Page>}} */
306 Adb.Browser;
307 /** @typedef {{id: string, adbModel: string, adbSerial: string, browsers: !Array.<!Adb.Browser>, adbPortStatus: !Array.<number>, adbConnected: boolean}} */
308 Adb.Device;
309 /** @typedef {!Object.<string, string>} */
310 Adb.PortForwardingConfig;
313 * @constructor
315 function diff_match_patch()
319 diff_match_patch.prototype = {
321 * @param {string} text1
322 * @param {string} text2
323 * @return {!Array.<!{0: number, 1: string}>}
325 diff_main: function(text1, text2) { }
328 /** @constructor */
329 function Path2D() {}
330 Path2D.prototype = {
332 * @param {number} x
333 * @param {number} y
334 * @param {number} w
335 * @param {number} h
337 rect: function(x, y, w, h) { },
339 * @param {number} x
340 * @param {number} y
342 moveTo: function(x, y) { },
344 * @param {number} x
345 * @param {number} y
347 lineTo: function(x, y) { }
350 /** @constructor */
351 var Doc = function() { }
352 Doc.prototype = {
353 /** @type {number} */
354 scrollLeft: 0,
355 /** @type {number} */
356 scrollTop: 0
359 /** @constructor */
360 var CodeMirror = function(element, config) { }
361 CodeMirror.on = function(obj, type, handler) { }
362 CodeMirror.prototype = {
363 /** @type {!Doc} */
364 doc: null,
365 addKeyMap: function(map) { },
366 addLineClass: function(handle, where, cls) { },
367 /** @param {?Object=} options */
368 addLineWidget: function(handle, node, options) { },
370 * @param {string|!Object} spec
371 * @param {!Object=} options
373 addOverlay: function(spec, options) { },
374 addWidget: function(pos, node, scroll, vert, horiz) { },
375 charCoords: function(pos, mode) { },
376 clearGutter: function(gutterID) { },
377 clearHistory: function() { },
378 clipPos: function(pos) { },
379 /** @param {string=} mode */
380 coordsChar: function(coords, mode) { },
381 /** @param {string=} mode */
382 cursorCoords: function(start, mode) { },
383 defaultCharWidth: function() { },
384 defaultTextHeight: function() { },
385 deleteH: function(dir, unit) { },
387 * @param {*=} to
388 * @param {*=} op
390 eachLine: function(from, to, op) { },
391 execCommand: function(cmd) { },
392 extendSelection: function(from, to) { },
393 findMarksAt: function(pos) { },
395 * @param {!CodeMirror.Pos} from
396 * @param {boolean=} strict
397 * @param {Object=} config
399 findMatchingBracket: function(from, strict, config) { },
400 findPosH: function(from, amount, unit, visually) { },
401 findPosV: function(from, amount, unit, goalColumn) { },
402 firstLine: function() { },
403 focus: function() { },
404 getAllMarks: function() { },
405 /** @param {string=} start */
406 getCursor: function(start) { },
407 getDoc: function() { },
408 getGutterElement: function() { },
409 getHistory: function() { },
410 getInputField: function(){ },
411 getLine: function(line) { },
413 * @return {!{wrapClass: string, height: number}}
415 getLineHandle: function(line) { },
416 getLineNumber: function(line) { },
418 * @return {!{token: function(CodeMirror.StringStream, Object):string}}
420 getMode: function() { },
421 getOption: function(option) { },
422 /** @param {*=} lineSep */
423 getRange: function(from, to, lineSep) { },
425 * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}}
427 getScrollInfo: function() { },
428 getScrollerElement: function() { },
429 getSelection: function() { },
430 getSelections: function() { },
431 getStateAfter: function(line) { },
432 getTokenAt: function(pos) { },
433 /** @param {*=} lineSep */
434 getValue: function(lineSep) { },
435 getViewport: function() { },
436 getWrapperElement: function() { },
437 hasFocus: function() { },
438 historySize: function() { },
439 indentLine: function(n, dir, aggressive) { },
440 indentSelection: function(how) { },
441 indexFromPos: function(coords) { },
442 isClean: function() { },
443 iterLinkedDocs: function(f) { },
444 lastLine: function() { },
445 lineCount: function() { },
446 lineInfo: function(line) { },
448 * @param {number} height
449 * @param {string=} mode
451 lineAtHeight: function(height, mode) { },
452 linkedDoc: function(options) { },
453 listSelections: function() { },
454 markClean: function() { },
455 markText: function(from, to, options) { },
456 moveH: function(dir, unit) { },
457 moveV: function(dir, unit) { },
458 off: function(type, f) { },
459 on: function(type, f) { },
460 operation: function(f) { },
461 posFromIndex: function(off) { },
462 redo: function() { },
463 refresh: function() { },
464 removeKeyMap: function(map) { },
465 removeLine: function(line) { },
466 removeLineClass: function(handle, where, cls) { },
467 removeLineWidget: function(widget) { },
468 removeOverlay: function(spec) { },
469 /** @param {*=} origin */
470 replaceRange: function(code, from, to, origin) { },
472 * @param {string} replacement
473 * @param {string=} select
475 replaceSelection: function(replacement, select) { },
477 * @param {!Array.<string>} textPerSelection
479 replaceSelections: function(textPerSelection) { },
480 /** @param {*=} margin */
481 scrollIntoView: function(pos, margin) { },
482 scrollTo: function(x, y) { },
483 setBookmark: function(pos, options) { },
484 setCursor: function(line, ch, extend) { },
485 setExtending: function(val) { },
486 setGutterMarker: function(line, gutterID, value) { },
487 setHistory: function(histData) { },
488 setLine: function(line, text) { },
489 setOption: function(option, value) { },
490 setSelection: function(anchor, head) { },
492 * @param {number=} primaryIndex
493 * @param {?Object=} config
495 setSelections: function(selections, primaryIndex, config) { },
496 setSize: function(width, height) { },
497 setValue: function(code) { },
498 somethingSelected: function() { },
499 swapDoc: function(doc) { },
500 undo: function() { },
501 unlinkDoc: function(other) { }
503 /** @type {!{cursorDiv: Element}} */
504 CodeMirror.prototype.display;
505 /** @type {!Object} */
506 CodeMirror.Pass;
507 CodeMirror.showHint = function(codeMirror, hintintFunction) { };
508 CodeMirror.commands = {};
509 CodeMirror.modes = {};
510 CodeMirror.mimeModes = {};
511 CodeMirror.getMode = function(options, spec) { };
512 CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { };
513 CodeMirror.defineMode = function(modeName, modeConstructor) { };
514 CodeMirror.startState = function(mode) { };
516 /** @typedef {{canceled: boolean, from: !CodeMirror.Pos, to: !CodeMirror.Pos, text: string, origin: string, cancel: function()}} */
517 CodeMirror.BeforeChangeObject;
519 /** @typedef {{from: !CodeMirror.Pos, to: !CodeMirror.Pos, origin: string, text: !Array.<string>, removed: !Array.<string>}} */
520 CodeMirror.ChangeObject;
522 /** @constructor */
523 CodeMirror.Pos = function(line, ch) { }
524 /** @type {number} */
525 CodeMirror.Pos.prototype.line;
526 /** @type {number} */
527 CodeMirror.Pos.prototype.ch;
530 * @param {!CodeMirror.Pos} pos1
531 * @param {!CodeMirror.Pos} pos2
532 * @return {number}
534 CodeMirror.cmpPos = function(pos1, pos2) { };
536 /** @constructor */
537 CodeMirror.StringStream = function(line)
539 this.pos = 0;
540 this.start = 0;
542 CodeMirror.StringStream.prototype = {
543 backUp: function(n) { },
544 column: function() { },
545 current: function() { },
546 eat: function(match) { },
547 eatSpace: function() { },
548 eatWhile: function(match) { },
549 eol: function() { },
550 indentation: function() { },
552 * @param {!RegExp|string} pattern
553 * @param {boolean=} consume
554 * @param {boolean=} caseInsensitive
556 match: function(pattern, consume, caseInsensitive) { },
557 next: function() { },
558 peek: function() { },
559 skipTo: function(ch) { },
560 skipToEnd: function() { },
561 sol: function() { }
564 /** @type {Object.<string, !Object.<string, string>>} */
565 CodeMirror.keyMap;
567 /** @type {{scrollLeft: number, scrollTop: number}} */
568 CodeMirror.doc;
570 /** @type {boolean} */
571 window.dispatchStandaloneTestRunnerMessages;
574 * @param {*} obj
575 * @return {boolean}
577 ArrayBuffer.isView = function(obj) { }
580 * @param {Array.<Object>} keyframes
581 * @param {number|Object} timing
582 * @return {Object}
584 Element.prototype.animate = function(keyframes, timing) { }
586 var acorn = {
588 * @param {string} text
589 * @param {Object.<string, boolean>} options
590 * @return {!ESTree.Node}
592 parse: function(text, options) {},
595 * @param {string} text
596 * @param {Object.<string, boolean>} options
597 * @return {!Acorn.Tokenizer}
599 tokenizer: function(text, options) {},
601 tokTypes: {
602 _true: new Acorn.TokenType(),
603 _false: new Acorn.TokenType(),
604 num: new Acorn.TokenType(),
605 regexp: new Acorn.TokenType(),
606 string: new Acorn.TokenType(),
607 name: new Acorn.TokenType(),
608 eof: new Acorn.TokenType()
612 var Acorn = {};
614 * @constructor
616 Acorn.Tokenizer = function() {
617 /** @type {function():!Acorn.Token} */
618 this.getToken;
622 * @constructor
624 Acorn.TokenType = function() {
625 /** @type {string} */
626 this.label;
627 /** @type {(string|undefined)} */
628 this.keyword;
632 * @typedef {{type: !Acorn.TokenType, value: string, start: number, end: number}}
634 Acorn.Token;
637 * @typedef {{type: string, value: string, start: number, end: number}}
639 Acorn.Comment;
642 * @typedef {(!Acorn.Token|!Acorn.Comment)}
644 Acorn.TokenOrComment;
646 var ESTree = {};
649 * @constructor
651 ESTree.Node = function()
653 /** @type {number} */
654 this.start;
655 /** @type {number} */
656 this.end;
657 /** @type {string} */
658 this.type;
659 /** @type {(!ESTree.Node|undefined)} */
660 this.body;
661 /** @type {(!Array.<!ESTree.Node>|undefined)} */
662 this.declarations;
663 /** @type {(!Array.<!ESTree.Node>|undefined)} */
664 this.properties;
665 /** @type {(!ESTree.Node|undefined)} */
666 this.init;
670 * @extends {ESTree.Node}
671 * @constructor
673 ESTree.TemplateLiteralNode = function()
675 /** @type {!Array.<!ESTree.Node>} */
676 this.quasis;
677 /** @type {!Array.<!ESTree.Node>} */
678 this.expressions;