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 31// WebKit Web Facing API 32 33/** @type {boolean} */ 34Event.prototype.isMetaOrCtrlForTest; 35 36/** 37 * @type {number} 38 */ 39KeyboardEvent.DOM_KEY_LOCATION_NUMPAD; 40 41// FIXME: Remove after the Closure compiler roll. 42/** @param {*} message */ 43function postMessage(message) {} 44 45/** 46 * @param {string} eventName 47 * @param {!Function} listener 48 * @param {boolean=} capturing 49 */ 50function addEventListener(eventName, listener, capturing) {} 51 52/** 53 * @param {!T} value 54 * @param {boolean=} onlyFirst 55 * @this {Array.<T>} 56 * @template T 57 */ 58Array.prototype.remove = function(value, onlyFirst) {} 59/** 60 * @param {!Array.<!T>} array 61 * @this {Array.<!T>} 62 * @template T 63 */ 64Array.prototype.pushAll = function(array) {} 65/** 66 * @return {!Object.<string, boolean>} 67 * @this {Array.<T>} 68 * @template T 69 */ 70Array.prototype.keySet = function() {} 71/** 72 * @param {number} index 73 * @return {!Array.<!T>} 74 * @this {Array.<T>} 75 * @template T 76 */ 77Array.prototype.rotate = function(index) {} 78/** 79 * @this {Array.<number>} 80 */ 81Array.prototype.sortNumbers = function() {} 82/** 83 * @param {!T} object 84 * @param {function(!T,!S):number=} comparator 85 * @return {number} 86 * @this {Array.<S>} 87 * @template T,S 88 */ 89Array.prototype.lowerBound = function(object, comparator) {} 90/** 91 * @param {!T} object 92 * @param {function(!T,!S):number=} comparator 93 * @return {number} 94 * @this {Array.<S>} 95 * @template T,S 96 */ 97Array.prototype.upperBound = function(object, comparator) {} 98/** 99 * @param {!T} value 100 * @param {function(!T,!S):number} comparator 101 * @return {number} 102 * @this {Array.<S>} 103 * @template T,S 104 */ 105Array.prototype.binaryIndexOf = function(value, comparator) {} 106/** 107 * @param {function(number, number): number} comparator 108 * @param {number} leftBound 109 * @param {number} rightBound 110 * @param {number} sortWindowLeft 111 * @param {number} sortWindowRight 112 * @return {!Array.<number>} 113 * @this {Array.<number>} 114 */ 115Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {} 116 117/** 118 * @param {function(!T,!T): number=} comparator 119 * @return {!Array.<T>} 120 * @this {Array.<T>} 121 * @template T 122 */ 123Array.prototype.stableSort = function(comparator) {} 124 125/** 126 * @this {Array.<number>} 127 * @param {function(number,number):boolean} comparator 128 * @param {number} left 129 * @param {number} right 130 * @param {number} pivotIndex 131 * @return {number} 132 */ 133Array.prototype.partition = function(comparator, left, right, pivotIndex) {} 134 135/** 136 * @this {Array.<number>} 137 * @param {number} k 138 * @param {function(number,number):boolean=} comparator 139 * @return {number} 140 */ 141Array.prototype.qselect = function(k, comparator) {} 142 143/** 144 * @param {string} field 145 * @return {!Array.<!T>} 146 * @this {Array.<!Object.<string,T>>} 147 * @template T 148 */ 149Array.prototype.select = function(field) {} 150 151/** 152 * @return {!T|undefined} 153 * @this {Array.<T>} 154 * @template T 155 */ 156Array.prototype.peekLast = function() {} 157 158/** 159 * @param {!Array.<T>} array 160 * @param {function(T,T):number} comparator 161 * @return {!Array.<T>} 162 * @this {!Array.<T>} 163 * @template T 164 */ 165Array.prototype.intersectOrdered = function(array, comparator) {} 166 167/** 168 * @param {!Array.<T>} array 169 * @param {function(T,T):number} comparator 170 * @return {!Array.<T>} 171 * @this {!Array.<T>} 172 * @template T 173 */ 174Array.prototype.mergeOrdered = function(array, comparator) {} 175 176// File System API 177/** 178 * @constructor 179 */ 180function DOMFileSystem() {} 181 182/** 183 * @type {DirectoryEntry} 184 */ 185DOMFileSystem.prototype.root = null; 186 187/** @interface */ 188function InspectorFrontendHostAPI() {} 189/** @param {!Function=} callback */ 190InspectorFrontendHostAPI.prototype.addFileSystem = function(callback) {} 191/** @param {!Function=} callback */ 192InspectorFrontendHostAPI.prototype.append = function(url, content, callback) {} 193/** @param {!Function=} callback */ 194InspectorFrontendHostAPI.prototype.indexPath = function(requestId, fileSystemPath, callback) {} 195/** @return {string} */ 196InspectorFrontendHostAPI.prototype.getSelectionBackgroundColor = function() {} 197/** @return {string} */ 198InspectorFrontendHostAPI.prototype.getSelectionForegroundColor = function() {} 199/** @return {boolean} */ 200InspectorFrontendHost.isUnderTest = function() {} 201/** 202 * Requests inspected page to be placed atop of the inspector frontend with specified bounds. 203 * @param {{x: number, y: number, width: number, height: number}} bounds 204 */ 205InspectorFrontendHostAPI.prototype.setInspectedPageBounds = function(bounds) {} 206/** 207 * Requests inspected page to be placed atop of the inspector frontend 208 * with passed insets from the frontend sides, respecting minimum size passed. 209 * @param {{top: number, left: number, right: number, bottom: number}} insets 210 * @param {{width: number, height: number}} minSize 211 */ 212InspectorFrontendHostAPI.prototype.setContentsResizingStrategy = function(insets, minSize) {} 213/** @param {string} shortcuts */ 214InspectorFrontendHostAPI.prototype.setWhitelistedShortcuts = function(shortcuts) {} 215InspectorFrontendHostAPI.prototype.inspectElementCompleted = function() {} 216/** @param {!Function=} callback */ 217InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y, callback) {} 218/** @param {!Function=} callback */ 219InspectorFrontendHostAPI.prototype.openInNewTab = function(url, callback) {} 220/** @param {!Function=} callback */ 221InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath, callback) {} 222/** @param {!Function=} callback */ 223InspectorFrontendHostAPI.prototype.requestFileSystems = function(callback) {} 224/** @param {!Function=} callback */ 225InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs, callback) {} 226/** @param {!Function=} callback */ 227InspectorFrontendHostAPI.prototype.searchInPath = function(requestId, fileSystemPath, query, callback) {} 228/** @param {!Function=} callback */ 229InspectorFrontendHostAPI.prototype.stopIndexing = function(requestId, callback) {} 230 231InspectorFrontendHostAPI.prototype.bringToFront = function() {} 232InspectorFrontendHostAPI.prototype.openUrlOnRemoteDeviceAndInspect = function(browserId, url) {} 233InspectorFrontendHostAPI.prototype.closeWindow = function() {} 234InspectorFrontendHostAPI.prototype.copyText = function(text) {} 235InspectorFrontendHostAPI.prototype.inspectedURLChanged = function(url) {} 236InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {} 237InspectorFrontendHostAPI.prototype.upgradeDraggedFileSystemPermissions = function(DOMFileSystem) {} 238InspectorFrontendHostAPI.prototype.platform = function() {} 239InspectorFrontendHostAPI.prototype.port = function() {} 240InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {} 241InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {} 242InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {} 243InspectorFrontendHostAPI.prototype.sendMessageToEmbedder = function(message) {} 244InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {} 245InspectorFrontendHostAPI.prototype.setIsDocked = function(isDocked, callback) {} 246InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {} 247InspectorFrontendHostAPI.prototype.subscribe = function(eventType) {} 248InspectorFrontendHostAPI.prototype.unsubscribe = function(eventType) {} 249InspectorFrontendHostAPI.prototype.zoomFactor = function() {} 250InspectorFrontendHostAPI.prototype.zoomIn = function() {} 251InspectorFrontendHostAPI.prototype.zoomOut = function() {} 252InspectorFrontendHostAPI.prototype.resetZoom = function() {} 253/** @type {InspectorFrontendHostAPI} */ 254var InspectorFrontendHost; 255InspectorFrontendHost.embedderMessageAck = function(id, error) {} 256 257// FIXME: remove everything below. 258var FormatterWorker = {} 259var WebInspector = {} 260 261WebInspector.panels = {}; 262WebInspector.inspectorFrontendEventSink = {}; 263 264WebInspector.reload = function() { } 265 266/** Extensions API */ 267 268/** @constructor */ 269function AuditCategory() {} 270/** @constructor */ 271function AuditResult() {} 272/** @constructor */ 273function EventSink() {} 274/** @constructor */ 275function ExtensionSidebarPane() {} 276/** @constructor */ 277function Panel() {} 278/** @constructor */ 279function PanelWithSidebar() {} 280/** @constructor */ 281function Request() {} 282/** @constructor */ 283function Resource() {} 284/** @constructor */ 285function Timeline() {} 286 287var extensionServer; 288 289/** 290 * @constructor 291 */ 292function ExtensionDescriptor() { 293 this.startPage = ""; 294 this.name = ""; 295} 296 297/** 298 * @constructor 299 */ 300function ExtensionReloadOptions() { 301 this.ignoreCache = false; 302 this.injectedScript = ""; 303 this.preprocessingScript = ""; 304 this.userAgent = ""; 305} 306 307/* jsdifflib API */ 308var difflib = {}; 309difflib.stringAsLines = function(text) { return []; } 310/** @constructor */ 311difflib.SequenceMatcher = function(baseText, newText) { } 312difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; } 313 314/** @constructor */ 315var Doc = function() { } 316Doc.prototype = { 317 /** @type {number} */ 318 scrollLeft: 0, 319 /** @type {number} */ 320 scrollTop: 0 321} 322 323/** @constructor */ 324var CodeMirror = function(element, config) { } 325CodeMirror.on = function(obj, type, handler) { } 326CodeMirror.prototype = { 327 /** @type {!Doc} */ 328 doc: null, 329 addKeyMap: function(map) { }, 330 addLineClass: function(handle, where, cls) { }, 331 /** @param {?Object=} options */ 332 addLineWidget: function(handle, node, options) { }, 333 /** 334 * @param {string|!Object} spec 335 * @param {!Object=} options 336 */ 337 addOverlay: function(spec, options) { }, 338 addWidget: function(pos, node, scroll, vert, horiz) { }, 339 charCoords: function(pos, mode) { }, 340 clearGutter: function(gutterID) { }, 341 clearHistory: function() { }, 342 clipPos: function(pos) { }, 343 /** @param {string=} mode */ 344 coordsChar: function(coords, mode) { }, 345 /** @param {string=} mode */ 346 cursorCoords: function(start, mode) { }, 347 defaultCharWidth: function() { }, 348 defaultTextHeight: function() { }, 349 deleteH: function(dir, unit) { }, 350 /** 351 * @param {*=} to 352 * @param {*=} op 353 */ 354 eachLine: function(from, to, op) { }, 355 execCommand: function(cmd) { }, 356 extendSelection: function(from, to) { }, 357 findMarksAt: function(pos) { }, 358 findMatchingBracket: function() { }, 359 findPosH: function(from, amount, unit, visually) { }, 360 findPosV: function(from, amount, unit, goalColumn) { }, 361 firstLine: function() { }, 362 focus: function() { }, 363 getAllMarks: function() { }, 364 /** @param {string=} start */ 365 getCursor: function(start) { }, 366 getDoc: function() { }, 367 getGutterElement: function() { }, 368 getHistory: function() { }, 369 getInputField: function(){ }, 370 getLine: function(line) { }, 371 /** 372 * @return {!{wrapClass: string}} 373 */ 374 getLineHandle: function(line) { }, 375 getLineNumber: function(line) { }, 376 getMode: function() { }, 377 getOption: function(option) { }, 378 /** @param {*=} lineSep */ 379 getRange: function(from, to, lineSep) { }, 380 /** 381 * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}} 382 */ 383 getScrollInfo: function() { }, 384 getScrollerElement: function() { }, 385 getSelection: function() { }, 386 getSelections: function() { }, 387 getStateAfter: function(line) { }, 388 getTokenAt: function(pos) { }, 389 /** @param {*=} lineSep */ 390 getValue: function(lineSep) { }, 391 getViewport: function() { }, 392 getWrapperElement: function() { }, 393 hasFocus: function() { }, 394 historySize: function() { }, 395 indentLine: function(n, dir, aggressive) { }, 396 indentSelection: function(how) { }, 397 indexFromPos: function(coords) { }, 398 isClean: function() { }, 399 iterLinkedDocs: function(f) { }, 400 lastLine: function() { }, 401 lineCount: function() { }, 402 lineInfo: function(line) { }, 403 /** 404 * @param {number} height 405 * @param {string=} mode 406 */ 407 lineAtHeight: function(height, mode) { }, 408 linkedDoc: function(options) { }, 409 listSelections: function() { }, 410 markClean: function() { }, 411 markText: function(from, to, options) { }, 412 moveH: function(dir, unit) { }, 413 moveV: function(dir, unit) { }, 414 off: function(type, f) { }, 415 on: function(type, f) { }, 416 operation: function(f) { }, 417 posFromIndex: function(off) { }, 418 redo: function() { }, 419 refresh: function() { }, 420 removeKeyMap: function(map) { }, 421 removeLine: function(line) { }, 422 removeLineClass: function(handle, where, cls) { }, 423 removeLineWidget: function(widget) { }, 424 removeOverlay: function(spec) { }, 425 /** @param {*=} origin */ 426 replaceRange: function(code, from, to, origin) { }, 427 replaceSelection: function(code, collapse, origin) { }, 428 /** @param {*=} margin */ 429 scrollIntoView: function(pos, margin) { }, 430 scrollTo: function(x, y) { }, 431 setBookmark: function(pos, options) { }, 432 setCursor: function(line, ch, extend) { }, 433 setExtending: function(val) { }, 434 setGutterMarker: function(line, gutterID, value) { }, 435 setHistory: function(histData) { }, 436 setLine: function(line, text) { }, 437 setOption: function(option, value) { }, 438 setSelection: function(anchor, head) { }, 439 /** 440 * @param {number=} primaryIndex 441 * @param {?Object=} config 442 */ 443 setSelections: function(selections, primaryIndex, config) { }, 444 setSize: function(width, height) { }, 445 setValue: function(code) { }, 446 somethingSelected: function() { }, 447 swapDoc: function(doc) { }, 448 undo: function() { }, 449 unlinkDoc: function(other) { } 450} 451/** @type {!{cursorDiv: Element}} */ 452CodeMirror.prototype.display; 453/** @type {!Object} */ 454CodeMirror.Pass; 455CodeMirror.showHint = function(codeMirror, hintintFunction) { }; 456CodeMirror.commands = {}; 457CodeMirror.modes = {}; 458CodeMirror.mimeModes = {}; 459CodeMirror.getMode = function(options, spec) { }; 460CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { }; 461CodeMirror.defineMode = function(modeName, modeConstructor) { }; 462CodeMirror.startState = function(mode) { }; 463 464/** @constructor */ 465CodeMirror.Pos = function(line, ch) { } 466/** @type {number} */ 467CodeMirror.Pos.prototype.line; 468/** @type {number} */ 469CodeMirror.Pos.prototype.ch; 470 471/** @constructor */ 472CodeMirror.StringStream = function(line) 473{ 474 this.pos = 0; 475 this.start = 0; 476} 477CodeMirror.StringStream.prototype = { 478 backUp: function (n) { }, 479 column: function () { }, 480 current: function () { }, 481 eat: function (match) { }, 482 eatSpace: function () { }, 483 eatWhile: function (match) { }, 484 eol: function () { }, 485 indentation: function () { }, 486 /** 487 * @param {!RegExp|string} pattern 488 * @param {boolean=} consume 489 * @param {boolean=} caseInsensitive 490 */ 491 match: function (pattern, consume, caseInsensitive) { }, 492 next: function () { }, 493 peek: function () { }, 494 skipTo: function (ch) { }, 495 skipToEnd: function () { }, 496 sol: function () { } 497} 498 499/** @type {Object.<string, !Object.<string, string>>} */ 500CodeMirror.keyMap; 501 502/** @type {{scrollLeft: number, scrollTop: number}} */ 503CodeMirror.doc; 504 505/** 506 * @constructor 507 * @extends {Event} 508 */ 509function ErrorEvent() {} 510 511/** @type {string} */ 512ErrorEvent.prototype.message; 513 514/** @type {boolean} */ 515window.dispatchStandaloneTestRunnerMessages; 516