Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 1 | /* |
| 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 Luo | 66e332c | 2018-04-09 18:00:14 | [diff] [blame^] | 31 | // Blink Web Facing API |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * @param {!Object} object |
| 35 | * @param {!Function} callback |
| 36 | */ |
| 37 | Object.observe = function(object, callback) {}; |
| 38 | |
| 39 | /** @type {boolean} */ |
| 40 | Event.prototype.isMetaOrCtrlForTest; |
| 41 | |
| 42 | /** @type {string} */ |
| 43 | Event.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} */ |
| 51 | MouseEvent.prototype.movementX; |
| 52 | |
| 53 | /** @type {number} */ |
| 54 | MouseEvent.prototype.movementY; |
| 55 | |
| 56 | /** |
| 57 | * @type {number} |
| 58 | */ |
| 59 | KeyboardEvent.DOM_KEY_LOCATION_NUMPAD; |
| 60 | |
| 61 | /** |
| 62 | * @param {!T} value |
| 63 | * @param {boolean=} onlyFirst |
| 64 | * @this {Array.<T>} |
| 65 | * @template T |
| 66 | */ |
| 67 | Array.prototype.remove = function(value, onlyFirst) {}; |
| 68 | /** |
| 69 | * @param {!Array.<!T>} array |
| 70 | * @this {Array.<!T>} |
| 71 | * @template T |
| 72 | */ |
| 73 | Array.prototype.pushAll = function(array) {}; |
| 74 | /** |
| 75 | * @return {!Object.<string, boolean>} |
| 76 | * @this {Array.<T>} |
| 77 | * @template T |
| 78 | */ |
| 79 | Array.prototype.keySet = function() {}; |
| 80 | /** |
| 81 | * @param {number} index |
| 82 | * @return {!Array.<!T>} |
| 83 | * @this {Array.<T>} |
| 84 | * @template T |
| 85 | */ |
| 86 | Array.prototype.rotate = function(index) {}; |
| 87 | /** |
| 88 | * @this {Array.<number>} |
| 89 | */ |
| 90 | Array.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 | */ |
| 100 | Array.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 | */ |
| 110 | Array.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 | */ |
| 118 | Array.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 | */ |
| 128 | Array.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 | */ |
| 136 | Array.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 | */ |
| 146 | Array.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 | */ |
| 154 | Array.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 | */ |
| 162 | Array.prototype.select = function(field) {}; |
| 163 | |
| 164 | /** |
| 165 | * @return {!T|undefined} |
| 166 | * @this {Array.<T>} |
| 167 | * @template T |
| 168 | */ |
| 169 | Array.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 | */ |
| 178 | Array.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 | */ |
| 187 | Array.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 | */ |
| 196 | Int32Array.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 | */ |
| 202 | const BigInt = function(value) {}; |
| 203 | |
| 204 | /** @typedef {*} */ |
| 205 | const bigint = null; |
| 206 | |
| 207 | // File System API |
| 208 | /** |
| 209 | * @constructor |
| 210 | */ |
| 211 | function DOMFileSystem() { |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @type {DirectoryEntry} |
| 216 | */ |
| 217 | DOMFileSystem.prototype.root = null; |
| 218 | |
| 219 | /** |
| 220 | * @type {*} |
| 221 | */ |
| 222 | window.domAutomationController; |
| 223 | |
| 224 | const 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)}} */ |
| 229 | DevToolsHost.ContextMenuDescriptor; |
| 230 | |
| 231 | /** |
| 232 | * @return {number} |
| 233 | */ |
| 234 | DevToolsHost.zoomFactor = function() {}; |
| 235 | |
| 236 | /** |
| 237 | * @param {string} text |
| 238 | */ |
| 239 | DevToolsHost.copyText = function(text) {}; |
| 240 | |
| 241 | /** |
| 242 | * @return {string} |
| 243 | */ |
| 244 | DevToolsHost.platform = function() {}; |
| 245 | |
| 246 | /** |
| 247 | * @param {number} x |
| 248 | * @param {number} y |
| 249 | * @param {!Array.<!DevToolsHost.ContextMenuDescriptor>} items |
| 250 | * @param {!Document} document |
| 251 | */ |
| 252 | DevToolsHost.showContextMenuAtPoint = function(x, y, items, document) {}; |
| 253 | |
| 254 | /** |
| 255 | * @param {string} message |
| 256 | */ |
| 257 | DevToolsHost.sendMessageToEmbedder = function(message) {}; |
| 258 | |
| 259 | /** |
| 260 | * @return {string} |
| 261 | */ |
| 262 | DevToolsHost.getSelectionBackgroundColor = function() {}; |
| 263 | |
| 264 | /** |
| 265 | * @return {string} |
| 266 | */ |
| 267 | DevToolsHost.getSelectionForegroundColor = function() {}; |
| 268 | |
| 269 | /** |
| 270 | * @return {string} |
| 271 | */ |
| 272 | DevToolsHost.getInactiveSelectionBackgroundColor = function() {}; |
| 273 | |
| 274 | /** |
| 275 | * @return {string} |
| 276 | */ |
| 277 | DevToolsHost.getInactiveSelectionForegroundColor = function() {}; |
| 278 | |
| 279 | /** |
| 280 | * @return {boolean} |
| 281 | */ |
| 282 | DevToolsHost.isHostedMode = function() {}; |
| 283 | |
| 284 | /** |
| 285 | * @param {string} fileSystemId |
| 286 | * @param {string} registeredName |
| 287 | * @return {?DOMFileSystem} |
| 288 | */ |
| 289 | DevToolsHost.isolatedFileSystem = function(fileSystemId, registeredName) {}; |
| 290 | |
| 291 | /** |
| 292 | * @param {!FileSystem} fileSystem |
| 293 | */ |
| 294 | DevToolsHost.upgradeDraggedFileSystemPermissions = function(fileSystem) {}; |
| 295 | |
| 296 | /** Extensions API */ |
| 297 | |
| 298 | /** @constructor */ |
| 299 | function EventSink() { |
| 300 | } |
| 301 | /** @constructor */ |
| 302 | function ExtensionSidebarPane() { |
| 303 | } |
| 304 | /** @constructor */ |
| 305 | function Panel() { |
| 306 | } |
| 307 | /** @constructor */ |
| 308 | function PanelWithSidebar() { |
| 309 | } |
| 310 | /** @constructor */ |
| 311 | function Resource() { |
| 312 | } |
| 313 | |
| 314 | let extensionServer; |
| 315 | |
| 316 | /** |
| 317 | * @constructor |
| 318 | */ |
| 319 | function ExtensionDescriptor() { |
| 320 | this.startPage = ''; |
| 321 | this.name = ''; |
| 322 | this.exposeExperimentalAPIs = false; |
| 323 | } |
| 324 | |
| 325 | /** |
| 326 | * @constructor |
| 327 | */ |
| 328 | function ExtensionReloadOptions() { |
| 329 | this.ignoreCache = false; |
| 330 | this.injectedScript = ''; |
| 331 | this.userAgent = ''; |
| 332 | } |
| 333 | |
| 334 | const Adb = {}; |
| 335 | /** @typedef {{id: string, name: string, url: string, attached: boolean}} */ |
| 336 | Adb.Page; |
| 337 | /** @typedef {{id: string, adbBrowserChromeVersion: string, compatibleVersion: boolean, adbBrowserName: string, source: string, adbBrowserVersion: string, pages: !Array<!Adb.Page>}} */ |
| 338 | Adb.Browser; |
| 339 | /** @typedef {{id: string, adbModel: string, adbSerial: string, browsers: !Array.<!Adb.Browser>, adbPortStatus: !Array.<number>, adbConnected: boolean}} */ |
| 340 | Adb.Device; |
| 341 | /** @typedef {!Object.<string, string>} */ |
| 342 | Adb.PortForwardingConfig; |
| 343 | /** @typedef {!{port: string, address: string}} */ |
| 344 | Adb.PortForwardingRule; |
| 345 | /** @typedef {{ports: !Object<string, number>, browserId: string}} */ |
| 346 | Adb.DevicePortForwardingStatus; |
| 347 | /** @typedef {!Object<string, !Adb.DevicePortForwardingStatus>} */ |
| 348 | Adb.PortForwardingStatus; |
| 349 | /** @typedef {!Array<string>} */ |
| 350 | Adb.NetworkDiscoveryConfig; |
| 351 | /** |
| 352 | * @typedef {!{ |
| 353 | * discoverUsbDevices: boolean, |
| 354 | * portForwardingEnabled: boolean, |
| 355 | * portForwardingConfig: !Adb.PortForwardingConfig, |
| 356 | * networkDiscoveryEnabled: boolean, |
| 357 | * networkDiscoveryConfig: !Adb.NetworkDiscoveryConfig |
| 358 | * }} |
| 359 | */ |
| 360 | Adb.Config; |
| 361 | |
| 362 | /** @const */ |
| 363 | const module = {}; |
| 364 | |
| 365 | /** |
| 366 | * @constructor |
| 367 | */ |
| 368 | function diff_match_patch() { |
| 369 | } |
| 370 | |
| 371 | diff_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 */ |
| 386 | const Doc = function() {}; |
| 387 | Doc.prototype = { |
| 388 | /** @type {number} */ |
| 389 | scrollLeft: 0, |
| 390 | /** @type {number} */ |
| 391 | scrollTop: 0 |
| 392 | }; |
| 393 | |
| 394 | /** @constructor */ |
| 395 | const CodeMirror = function(element, config) {}; |
| 396 | CodeMirror.on = function(obj, type, handler) {}; |
| 397 | CodeMirror.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) {}, |
| 413 | charCoords: function(pos, mode) {}, |
| 414 | clearGutter: function(gutterID) {}, |
| 415 | clearHistory: function() {}, |
| 416 | clipPos: function(pos) {}, |
| 417 | /** @param {string=} mode */ |
| 418 | coordsChar: function(coords, mode) {}, |
| 419 | /** @param {string=} mode */ |
| 420 | cursorCoords: function(start, mode) {}, |
| 421 | defaultCharWidth: function() {}, |
| 422 | defaultTextHeight: function() {}, |
| 423 | deleteH: function(dir, unit) {}, |
| 424 | /** |
| 425 | * @param {*=} to |
| 426 | * @param {*=} op |
| 427 | */ |
| 428 | eachLine: function(from, to, op) {}, |
| 429 | execCommand: function(cmd) {}, |
| 430 | extendSelection: function(from, to) {}, |
| 431 | findMarks: function(from, to) {}, |
| 432 | findMarksAt: function(pos) {}, |
| 433 | /** |
| 434 | * @param {!CodeMirror.Pos} from |
| 435 | * @param {boolean=} strict |
| 436 | * @param {Object=} config |
| 437 | */ |
| 438 | findMatchingBracket: function(from, strict, config) {}, |
| 439 | findPosH: function(from, amount, unit, visually) {}, |
| 440 | findPosV: function(from, amount, unit, goalColumn) {}, |
| 441 | firstLine: function() {}, |
| 442 | focus: function() {}, |
| 443 | getAllMarks: function() {}, |
| 444 | /** @param {string=} start */ |
| 445 | getCursor: function(start) {}, |
| 446 | getDoc: function() {}, |
| 447 | getGutterElement: function() {}, |
| 448 | getHistory: function() {}, |
| 449 | getInputField: function() {}, |
| 450 | getLine: function(line) {}, |
| 451 | /** |
| 452 | * @return {!{wrapClass: string, height: number}} |
| 453 | */ |
| 454 | getLineHandle: function(line) {}, |
| 455 | getLineNumber: function(line) {}, |
| 456 | /** |
| 457 | * @return {!{token: function(CodeMirror.StringStream, Object):string}} |
| 458 | */ |
| 459 | getMode: function() {}, |
| 460 | getOption: function(option) {}, |
| 461 | /** @param {*=} lineSep */ |
| 462 | getRange: function(from, to, lineSep) {}, |
| 463 | /** |
| 464 | * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}} |
| 465 | */ |
| 466 | getScrollInfo: function() {}, |
| 467 | getScrollerElement: function() {}, |
| 468 | getSelection: function() {}, |
| 469 | getSelections: function() {}, |
| 470 | getStateAfter: function(line) {}, |
| 471 | getTokenAt: function(pos) {}, |
| 472 | /** @param {*=} lineSep */ |
| 473 | getValue: function(lineSep) {}, |
| 474 | getViewport: function() {}, |
| 475 | getWrapperElement: function() {}, |
| 476 | hasFocus: function() {}, |
| 477 | historySize: function() {}, |
| 478 | indentLine: function(n, dir, aggressive) {}, |
| 479 | indentSelection: function(how) {}, |
| 480 | indexFromPos: function(coords) {}, |
| 481 | isClean: function() {}, |
| 482 | iterLinkedDocs: function(f) {}, |
| 483 | lastLine: function() {}, |
| 484 | lineCount: function() {}, |
| 485 | lineInfo: function(line) {}, |
| 486 | /** |
| 487 | * @param {number} height |
| 488 | * @param {string=} mode |
| 489 | */ |
| 490 | lineAtHeight: function(height, mode) {}, |
| 491 | linkedDoc: function(options) {}, |
| 492 | listSelections: function() {}, |
| 493 | markClean: function() {}, |
| 494 | markText: function(from, to, options) {}, |
| 495 | moveH: function(dir, unit) {}, |
| 496 | moveV: function(dir, unit) {}, |
| 497 | off: function(type, f) {}, |
| 498 | on: function(type, f) {}, |
| 499 | operation: function(f) {}, |
| 500 | posFromIndex: function(off) {}, |
| 501 | redo: function() {}, |
| 502 | refresh: function() {}, |
| 503 | removeKeyMap: function(map) {}, |
| 504 | removeLine: function(line) {}, |
| 505 | removeLineClass: function(handle, where, cls) {}, |
| 506 | removeLineWidget: function(widget) {}, |
| 507 | removeOverlay: function(spec) {}, |
| 508 | /** @param {*=} origin */ |
| 509 | replaceRange: function(code, from, to, origin) {}, |
| 510 | /** |
| 511 | * @param {string} replacement |
| 512 | * @param {string=} select |
| 513 | */ |
| 514 | replaceSelection: function(replacement, select) {}, |
| 515 | /** |
| 516 | * @param {!Array.<string>} textPerSelection |
| 517 | */ |
| 518 | replaceSelections: function(textPerSelection) {}, |
| 519 | /** @param {*=} margin */ |
| 520 | scrollIntoView: function(pos, margin) {}, |
| 521 | scrollTo: function(x, y) {}, |
| 522 | setBookmark: function(pos, options) {}, |
| 523 | setCursor: function(line, ch, extend) {}, |
| 524 | setExtending: function(val) {}, |
| 525 | setGutterMarker: function(line, gutterID, value) {}, |
| 526 | setHistory: function(histData) {}, |
| 527 | setLine: function(line, text) {}, |
| 528 | setOption: function(option, value) {}, |
| 529 | setSelection: function(anchor, head) {}, |
| 530 | /** |
| 531 | * @param {number=} primaryIndex |
| 532 | * @param {?Object=} config |
| 533 | */ |
| 534 | setSelections: function(selections, primaryIndex, config) {}, |
| 535 | setSize: function(width, height) {}, |
| 536 | setValue: function(code) {}, |
| 537 | somethingSelected: function() {}, |
| 538 | swapDoc: function(doc) {}, |
| 539 | undo: function() {}, |
| 540 | unlinkDoc: function(other) {} |
| 541 | }; |
| 542 | /** @type {!{cursorDiv: Element, lineSpace: Element}} */ |
| 543 | CodeMirror.prototype.display; |
| 544 | /** @type {!{mode: string}} */ |
| 545 | CodeMirror.prototype.options; |
| 546 | /** @type {!Object} */ |
| 547 | CodeMirror.Pass; |
| 548 | CodeMirror.showHint = function(codeMirror, hintintFunction) {}; |
| 549 | CodeMirror.commands = {}; |
| 550 | CodeMirror.modes = {}; |
| 551 | CodeMirror.mimeModes = {}; |
| 552 | CodeMirror.getMode = function(options, spec) {}; |
| 553 | CodeMirror.overlayMode = function(mode1, mode2, squashSpans) {}; |
| 554 | CodeMirror.defineMode = function(modeName, modeConstructor) {}; |
| 555 | CodeMirror.startState = function(mode) {}; |
| 556 | CodeMirror.copyState = function(mode, state) {}; |
| 557 | |
| 558 | /** @typedef {{canceled: boolean, from: !CodeMirror.Pos, to: !CodeMirror.Pos, text: string, origin: string, cancel: function()}} */ |
| 559 | CodeMirror.BeforeChangeObject; |
| 560 | |
| 561 | /** @typedef {{from: !CodeMirror.Pos, to: !CodeMirror.Pos, origin: string, text: !Array.<string>, removed: !Array.<string>}} */ |
| 562 | CodeMirror.ChangeObject; |
| 563 | |
| 564 | /** @constructor */ |
| 565 | CodeMirror.Pos = function(line, ch) {}; |
| 566 | /** @type {number} */ |
| 567 | CodeMirror.Pos.prototype.line; |
| 568 | /** @type {number} */ |
| 569 | CodeMirror.Pos.prototype.ch; |
| 570 | |
| 571 | /** |
| 572 | * @param {!CodeMirror.Pos} pos1 |
| 573 | * @param {!CodeMirror.Pos} pos2 |
| 574 | * @return {number} |
| 575 | */ |
| 576 | CodeMirror.cmpPos = function(pos1, pos2) {}; |
| 577 | |
| 578 | /** @constructor */ |
| 579 | CodeMirror.StringStream = function(line) { |
| 580 | this.pos = 0; |
| 581 | this.start = 0; |
| 582 | }; |
| 583 | CodeMirror.StringStream.prototype = { |
| 584 | backUp: function(n) {}, |
| 585 | column: function() {}, |
| 586 | current: function() {}, |
| 587 | eat: function(match) {}, |
| 588 | eatSpace: function() {}, |
| 589 | eatWhile: function(match) {}, |
| 590 | eol: function() {}, |
| 591 | indentation: function() {}, |
| 592 | /** |
| 593 | * @param {!RegExp|string} pattern |
| 594 | * @param {boolean=} consume |
| 595 | * @param {boolean=} caseInsensitive |
| 596 | */ |
| 597 | match: function(pattern, consume, caseInsensitive) {}, |
| 598 | next: function() {}, |
| 599 | peek: function() {}, |
| 600 | skipTo: function(ch) {}, |
| 601 | skipToEnd: function() {}, |
| 602 | sol: function() {} |
| 603 | }; |
| 604 | |
| 605 | /** @constructor */ |
| 606 | CodeMirror.TextMarker = function(doc, type) {}; |
| 607 | CodeMirror.TextMarker.prototype = { |
| 608 | clear: function() {}, |
| 609 | find: function() {}, |
| 610 | changed: function() {} |
| 611 | }; |
| 612 | |
| 613 | /** @constructor */ |
| 614 | CodeMirror.LineWidget = function() {}; |
| 615 | CodeMirror.LineWidget.prototype = { |
| 616 | clear: function() {} |
| 617 | }; |
| 618 | |
| 619 | /** @type {Object.<string, !Object.<string, string>>} */ |
| 620 | CodeMirror.keyMap; |
| 621 | |
| 622 | /** @type {{scrollLeft: number, scrollTop: number}} */ |
| 623 | CodeMirror.doc; |
| 624 | |
| 625 | /** |
| 626 | * @param {string} mime |
| 627 | * @param {string} mode |
| 628 | */ |
| 629 | CodeMirror.defineMIME = function(mime, mode) {}; |
| 630 | |
| 631 | /** @type {boolean} */ |
| 632 | window.dispatchStandaloneTestRunnerMessages; |
| 633 | |
| 634 | /** |
| 635 | * @param {Array.<Object>} keyframes |
| 636 | * @param {number|Object} timing |
| 637 | * @return {Object} |
| 638 | */ |
| 639 | Element.prototype.animate = function(keyframes, timing) {}; |
| 640 | |
| 641 | /** |
| 642 | * @param {...!Node} nodes |
| 643 | * @return {undefined} |
| 644 | * @see https://dom.spec.whatwg.org/#dom-parentnode-prepend |
| 645 | */ |
| 646 | Element.prototype.prepend = function(nodes) {}; |
| 647 | |
| 648 | /** |
| 649 | * @override |
| 650 | * @param {string} type |
| 651 | * @param {(!EventListener|!function (!Event): (boolean|undefined)|null)} listener |
| 652 | * @param {(boolean|!{capture: (boolean|undefined), once: (boolean|undefined), passive: (boolean|undefined)})=} options |
| 653 | * @this {EventTarget} |
| 654 | */ |
| 655 | Element.prototype.addEventListener = function(type, listener, options) {}; |
| 656 | |
| 657 | /** |
| 658 | * @override |
| 659 | * @param {string} type |
| 660 | * @param {(!EventListener|!function (!Event): (boolean|undefined)|null)} listener |
| 661 | * @param {(boolean|!{capture: (boolean|undefined), once: (boolean|undefined), passive: (boolean|undefined)})=} options |
| 662 | * @this {EventTarget} |
| 663 | */ |
| 664 | Element.prototype.removeEventListener = function(type, listener, options) {}; |
| 665 | |
| 666 | const acorn = { |
| 667 | /** |
| 668 | * @param {string} text |
| 669 | * @param {Object.<string, boolean>} options |
| 670 | * @return {!ESTree.Node} |
| 671 | */ |
| 672 | parse: function(text, options) {}, |
| 673 | |
| 674 | /** |
| 675 | * @param {string} text |
| 676 | * @param {Object.<string, boolean>} options |
| 677 | * @return {!ESTree.Node} |
| 678 | */ |
| 679 | parse_dammit: function(text, options) {}, |
| 680 | |
| 681 | /** |
| 682 | * @param {string} text |
| 683 | * @param {Object.<string, boolean>} options |
| 684 | * @return {!Acorn.Tokenizer} |
| 685 | */ |
| 686 | tokenizer: function(text, options) {}, |
| 687 | |
| 688 | tokTypes: { |
| 689 | _true: new Acorn.TokenType(), |
| 690 | _false: new Acorn.TokenType(), |
| 691 | _null: new Acorn.TokenType(), |
| 692 | num: new Acorn.TokenType(), |
| 693 | regexp: new Acorn.TokenType(), |
| 694 | string: new Acorn.TokenType(), |
| 695 | name: new Acorn.TokenType(), |
| 696 | eof: new Acorn.TokenType() |
| 697 | } |
| 698 | }; |
| 699 | |
| 700 | const Acorn = {}; |
| 701 | /** |
| 702 | * @constructor |
| 703 | */ |
| 704 | Acorn.Tokenizer = function() { |
| 705 | /** @type {function():!Acorn.Token} */ |
| 706 | this.getToken; |
| 707 | }; |
| 708 | |
| 709 | /** |
| 710 | * @constructor |
| 711 | */ |
| 712 | Acorn.TokenType = function() { |
| 713 | /** @type {string} */ |
| 714 | this.label; |
| 715 | /** @type {(string|undefined)} */ |
| 716 | this.keyword; |
| 717 | }; |
| 718 | |
| 719 | /** |
| 720 | * @typedef {{type: !Acorn.TokenType, value: string, start: number, end: number}} |
| 721 | */ |
| 722 | Acorn.Token; |
| 723 | |
| 724 | /** |
| 725 | * @typedef {{type: string, value: string, start: number, end: number}} |
| 726 | */ |
| 727 | Acorn.Comment; |
| 728 | |
| 729 | /** |
| 730 | * @typedef {(!Acorn.Token|!Acorn.Comment)} |
| 731 | */ |
| 732 | Acorn.TokenOrComment; |
| 733 | |
| 734 | const ESTree = {}; |
| 735 | |
| 736 | /** |
| 737 | * @constructor |
| 738 | */ |
| 739 | ESTree.Node = function() { |
| 740 | /** @type {number} */ |
| 741 | this.start; |
| 742 | /** @type {number} */ |
| 743 | this.end; |
| 744 | /** @type {string} */ |
| 745 | this.type; |
| 746 | /** @type {(!ESTree.Node|undefined)} */ |
| 747 | this.body; |
| 748 | /** @type {(!Array.<!ESTree.Node>|undefined)} */ |
| 749 | this.declarations; |
| 750 | /** @type {(!Array.<!ESTree.Node>|undefined)} */ |
| 751 | this.properties; |
| 752 | /** @type {(!ESTree.Node|undefined)} */ |
| 753 | this.init; |
| 754 | /** @type {(!Array.<!ESTree.Node>|undefined)} */ |
| 755 | this.params; |
| 756 | /** @type {(string|undefined)} */ |
| 757 | this.name; |
| 758 | /** @type {(?ESTree.Node|undefined)} */ |
| 759 | this.id; |
| 760 | /** @type {(number|undefined)} */ |
| 761 | this.length; |
| 762 | /** @type {(?ESTree.Node|undefined)} */ |
| 763 | this.argument; |
| 764 | /** @type {(string|undefined)} */ |
| 765 | this.operator; |
| 766 | /** @type {(!ESTree.Node|undefined)} */ |
| 767 | this.right; |
| 768 | /** @type {(!ESTree.Node|undefined)} */ |
| 769 | this.left; |
| 770 | /** @type {(string|undefined)} */ |
| 771 | this.kind; |
| 772 | /** @type {(!ESTree.Node|undefined)} */ |
| 773 | this.property; |
| 774 | /** @type {(!ESTree.Node|undefined)} */ |
| 775 | this.object; |
| 776 | /** @type {(string|undefined)} */ |
| 777 | this.raw; |
| 778 | /** @type {(boolean|undefined)} */ |
| 779 | this.computed; |
| 780 | }; |
| 781 | |
| 782 | /** |
| 783 | * @extends {ESTree.Node} |
| 784 | * @constructor |
| 785 | */ |
| 786 | ESTree.TemplateLiteralNode = function() { |
| 787 | /** @type {!Array.<!ESTree.Node>} */ |
| 788 | this.quasis; |
| 789 | /** @type {!Array.<!ESTree.Node>} */ |
| 790 | this.expressions; |
| 791 | }; |
| 792 | |
| 793 | /** |
| 794 | * @type {string} |
| 795 | * @see http://heycam.github.io/webidl/#es-DOMException-prototype-object |
| 796 | * TODO(jsbell): DOMException should be a subclass of Error. |
| 797 | */ |
| 798 | DOMException.prototype.message; |
| 799 | /** @type {number} */ |
| 800 | DOMException.ABORT_ERR; |
| 801 | |
| 802 | /** |
| 803 | * @constructor |
| 804 | * @param {!Object} params |
| 805 | */ |
| 806 | const Terminal = function(params) {}; |
| 807 | |
| 808 | Terminal.prototype = { |
| 809 | fit: function() {}, |
| 810 | linkify: function() {}, |
| 811 | /** @param {!Element} element */ |
| 812 | open: function(element) {}, |
| 813 | /** @param {string} eventName * @param {!Function} handler */ |
| 814 | on: function(eventName, handler) {} |
| 815 | }; |
| 816 | |
| 817 | /** |
| 818 | * @param {string} context |
| 819 | * @return {!Console} |
| 820 | */ |
| 821 | Console.prototype.context = function(context) {}; |
| 822 | |
| 823 | |
| 824 | /** |
| 825 | * @param {!Array<string>|string} strings |
| 826 | * @param {...*} vararg |
| 827 | * @return {string} |
| 828 | */ |
| 829 | const ls = function(strings, vararg) {}; |
| 830 | |
| 831 | /** |
| 832 | * @constructor |
| 833 | * @param {function(!Array<*>)} callback |
| 834 | */ |
| 835 | const ResizeObserver = function(callback) {}; |