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 = false; 35/** @param {...*} vararg */ 36Event.prototype.initWebKitWheelEvent = function(vararg) {} 37Event.prototype.stopImmediatePropagation = function() {} 38 39/** 40 * @constructor 41 * @extends {KeyboardEvent} 42 * @param {string} eventType 43 * @param {!Object=} properties 44 */ 45window.KeyboardEvent = function(eventType, properties) {} 46 47/** 48 * @type {number} 49 */ 50KeyboardEvent.DOM_KEY_LOCATION_NUMPAD; 51 52/** @param {?Element} element */ 53window.getComputedStyle = function(element) {} 54/** @param {*} message */ 55function postMessage(message) {} 56 57/** @type {*} */ 58window.testRunner = null; 59 60/** 61 * @constructor 62 */ 63function WebKitMutation(callback) 64{ 65 this.type = ""; 66 /** @type {Node} */ this.target = null; 67 /** @type {!Array.<!Node>} */ this.addedNodes = []; 68 /** @type {!Array.<!Node>} */ this.removedNodes = []; 69} 70 71/** 72 * @constructor 73 * @param {function(!Array.<!WebKitMutation>)} callback 74 */ 75function WebKitMutationObserver(callback) {} 76/** 77 * @param {!Node} container 78 * @param {!Object} options 79 */ 80WebKitMutationObserver.prototype.observe = function(container, options) {} 81WebKitMutationObserver.prototype.disconnect = function() {} 82 83/** 84 * @param {string} eventName 85 * @param {!Function} listener 86 * @param {boolean=} capturing 87 */ 88function addEventListener(eventName, listener, capturing) {} 89 90/** 91 * @param {!T} value 92 * @param {boolean=} onlyFirst 93 * @this {Array.<T>} 94 * @template T 95 */ 96Array.prototype.remove = function(value, onlyFirst) {} 97/** 98 * @return {!Object.<string, boolean>} 99 * @this {Array.<T>} 100 * @template T 101 */ 102Array.prototype.keySet = function() {} 103/** 104 * @param {number} index 105 * @return {!Array.<!T>} 106 * @this {Array.<T>} 107 * @template T 108 */ 109Array.prototype.rotate = function(index) {} 110/** 111 * @param {!T} object 112 * @param {function(!T,!S):number=} comparator 113 * @return {number} 114 * @this {Array.<S>} 115 * @template T,S 116 */ 117Array.prototype.lowerBound = function(object, comparator) {} 118/** 119 * @param {!T} object 120 * @param {function(!T,!S):number=} comparator 121 * @return {number} 122 * @this {Array.<S>} 123 * @template T,S 124 */ 125Array.prototype.upperBound = function(object, comparator) {} 126/** 127 * @param {!T} value 128 * @param {function(!T,!S):number} comparator 129 * @return {number} 130 * @this {Array.<S>} 131 * @template T,S 132 */ 133Array.prototype.binaryIndexOf = function(value, comparator) {} 134/** 135 * @param {function(number, number): number} comparator 136 * @param {number} leftBound 137 * @param {number} rightBound 138 * @param {number} sortWindowLeft 139 * @param {number} sortWindowRight 140 * @return {!Array.<number>} 141 * @this {Array.<number>} 142 */ 143Array.prototype.sortRange = function(comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {} 144 145/** 146 * @param {function(!T,!T): number=} comparator 147 * @return {!Array.<T>} 148 * @this {Array.<T>} 149 * @template T 150 */ 151Array.prototype.stableSort = function(comparator) {} 152 153/** 154 * @this {Array.<number>} 155 * @param {function(number,number):boolean} comparator 156 * @param {number} left 157 * @param {number} right 158 * @param {number} pivotIndex 159 * @return {number} 160 */ 161Array.prototype.partition = function(comparator, left, right, pivotIndex) {} 162 163/** 164 * @this {Array.<number>} 165 * @param {number} k 166 * @param {function(number,number):boolean=} comparator 167 * @return {number} 168 */ 169Array.prototype.qselect = function(k, comparator) {} 170 171/** 172 * @param {string} field 173 * @return {!Array.<!T>} 174 * @this {Array.<!Object.<string,T>>} 175 * @template T 176 */ 177Array.prototype.select = function(field) {} 178 179/** 180 * @return {!T|undefined} 181 * @this {Array.<T>} 182 * @template T 183 */ 184Array.prototype.peekLast = function() {} 185 186/** 187 * @param {!Array.<T>} array 188 * @param {function(T,T):number} comparator 189 * @return {!Array.<T>} 190 * @this {!Array.<T>} 191 * @template T 192 */ 193Array.prototype.intersectOrdered = function(array, comparator) {} 194 195/** 196 * @param {!Array.<T>} array 197 * @param {function(T,T):number} comparator 198 * @return {!Array.<T>} 199 * @this {!Array.<T>} 200 * @template T 201 */ 202Array.prototype.mergeOrdered = function(array, comparator) {} 203 204DOMApplicationCache.prototype.UNCACHED = 0; 205DOMApplicationCache.prototype.IDLE = 1; 206DOMApplicationCache.prototype.CHECKING = 2; 207DOMApplicationCache.prototype.DOWNLOADING = 3; 208DOMApplicationCache.prototype.UPDATEREADY = 4; 209DOMApplicationCache.prototype.OBSOLETE = 5; 210 211// File System API 212/** 213 * @constructor 214 */ 215function DOMFileSystem() {} 216 217/** 218 * @type {DirectoryEntry} 219 */ 220DOMFileSystem.prototype.root = null; 221 222/** @type {Node} */ 223Range.prototype.startContainer; 224 225// Inspector Backend 226var InspectorBackend = {} 227InspectorBackend.runAfterPendingDispatches = function(message) {} 228 229/** @interface */ 230function InspectorFrontendHostAPI() {} 231/** @param {!Function=} callback callback */ 232InspectorFrontendHostAPI.prototype.addFileSystem = function(callback) {} 233/** @param {!Function=} callback callback */ 234InspectorFrontendHostAPI.prototype.append = function(url, content, callback) {} 235/** @param {!Function=} callback callback */ 236InspectorFrontendHostAPI.prototype.indexPath = function(requestId, fileSystemPath, callback) {} 237/** 238 * @param top 239 * @param left 240 * @param bottom 241 * @param right 242 */ 243InspectorFrontendHostAPI.prototype.setContentsInsets = function(top, left, bottom, right) {} 244/** @param {!Function=} callback callback */ 245InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y, callback) {} 246/** @param {!Function=} callback callback */ 247InspectorFrontendHostAPI.prototype.openInNewTab = function(url, callback) {} 248/** @param {!Function=} callback callback */ 249InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath, callback) {} 250/** @param {!Function=} callback callback */ 251InspectorFrontendHostAPI.prototype.requestFileSystems = function(callback) {} 252/** @param {!Function=} callback callback */ 253InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs, callback) {} 254/** @param {!Function=} callback callback */ 255InspectorFrontendHostAPI.prototype.searchInPath = function(requestId, fileSystemPath, query, callback) {} 256/** @param {!Function=} callback callback */ 257InspectorFrontendHostAPI.prototype.stopIndexing = function(requestId, callback) {} 258 259InspectorFrontendHostAPI.prototype.bringToFront = function() {} 260InspectorFrontendHostAPI.prototype.close = function(url) {} 261InspectorFrontendHostAPI.prototype.closeWindow = function() {} 262InspectorFrontendHostAPI.prototype.copyText = function(text) {} 263InspectorFrontendHostAPI.prototype.inspectedURLChanged = function(url) {} 264InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {} 265InspectorFrontendHostAPI.prototype.upgradeDraggedFileSystemPermissions = function(DOMFileSystem) {} 266InspectorFrontendHostAPI.prototype.loaded = function() {} 267InspectorFrontendHostAPI.prototype.localizedStringsURL = function() {} 268InspectorFrontendHostAPI.prototype.platform = function() {} 269InspectorFrontendHostAPI.prototype.port = function() {} 270InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {} 271InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {} 272InspectorFrontendHostAPI.prototype.recordSettingChanged = function(settingCode) {} 273InspectorFrontendHostAPI.prototype.requestSetDockSide = function(dockSide) {} 274InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {} 275InspectorFrontendHostAPI.prototype.sendMessageToEmbedder = function(message) {} 276InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {} 277InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {} 278InspectorFrontendHostAPI.prototype.supportsFileSystems = function() {} 279/** @type {InspectorFrontendHostAPI} */ 280var InspectorFrontendHost; 281 282/** @constructor */ 283function SourceMapV3() 284{ 285 /** @type {number} */ this.version; 286 /** @type {string} */ this.file; 287 /** @type {!Array.<string>} */ this.sources; 288 /** @type {!Array.<!SourceMapV3.Section>} */ this.sections; 289 /** @type {string} */ this.mappings; 290 /** @type {string} */ this.sourceRoot; 291} 292 293/** @constructor */ 294SourceMapV3.Section = function() 295{ 296 /** @type {SourceMapV3} */ this.map; 297 /** @type {SourceMapV3.Offset} */ this.offset; 298} 299 300/** @constructor */ 301SourceMapV3.Offset = function() 302{ 303 /** @type {number} */ this.line; 304 /** @type {number} */ this.column; 305} 306 307// FIXME: remove everything below. 308var FormatterWorker = {} 309var WebInspector = {} 310 311WebInspector.queryParamsObject = {} 312WebInspector.toggleSearchingForNode = function() {} 313WebInspector.panels = {}; 314 315/** 316 * @param {string=} messageLevel 317 * @param {boolean=} showConsole 318 */ 319WebInspector.log = function(message, messageLevel, showConsole) {} 320 321WebInspector.showErrorMessage = function(error) {} 322 323WebInspector.addMainEventListeners = function(doc) {} 324 325WebInspector.openResource = function(url, external) {} 326 327WebInspector.showConsole = function() {} 328 329/** 330 * @param {string} expression 331 * @param {boolean=} showResultOnly 332 */ 333WebInspector.evaluateInConsole = function(expression, showResultOnly) {} 334 335WebInspector.queryParamsObject = {} 336 337/** 338 * @param {!Element} element 339 * @return {boolean} 340 */ 341WebInspector.showAnchorLocation = function(element) {} 342 343WebInspector.Events = { 344 InspectorLoaded: "InspectorLoaded", 345 InspectorClosing: "InspectorClosing" 346} 347 348/** @type {!WebInspector.SettingsController} */ 349WebInspector.settingsController; 350 351 352/** 353 * @return {number} 354 */ 355WebInspector.zoomFactor = function() {} 356 357/** Extensions API */ 358 359/** @constructor */ 360function AuditCategory() {} 361/** @constructor */ 362function AuditResult() {} 363/** @constructor */ 364function EventSink() {} 365/** @constructor */ 366function ExtensionSidebarPane() {} 367/** @constructor */ 368function Panel() {} 369/** @constructor */ 370function PanelWithSidebar() {} 371/** @constructor */ 372function Request() {} 373/** @constructor */ 374function Resource() {} 375/** @constructor */ 376function Timeline() {} 377 378var extensionServer; 379 380/** @type {string} */ 381Location.prototype.origin = ""; 382 383/** 384 * @constructor 385 */ 386function ExtensionDescriptor() { 387 this.startPage = ""; 388 this.name = ""; 389} 390 391/** 392 * @constructor 393 */ 394function ExtensionReloadOptions() { 395 this.ignoreCache = false; 396 this.injectedScript = ""; 397 this.preprocessingScript = ""; 398 this.userAgent = ""; 399} 400 401WebInspector.showPanel = function(panel) 402{ 403} 404 405/** 406 * @param {!ExtensionDescriptor} extensionInfo 407 * @return {string} 408 */ 409function buildPlatformExtensionAPI(extensionInfo) {} 410 411/** 412 * @type {string} 413 */ 414WebInspector.inspectedPageDomain; 415 416WebInspector.SourceJavaScriptTokenizer = {} 417WebInspector.SourceJavaScriptTokenizer.Keywords = {} 418 419/** 420 * @return {boolean} 421 */ 422WebInspector.isInspectingDevice = function() {} 423 424var InspectorTest = {} 425 426/* jsdifflib API */ 427var difflib = {}; 428difflib.stringAsLines = function(text) { return []; } 429/** @constructor */ 430difflib.SequenceMatcher = function(baseText, newText) { } 431difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; } 432 433/** @constructor */ 434var CodeMirror = function() { } 435CodeMirror.on = function(obj, type, handler) { } 436CodeMirror.prototype = { 437 addKeyMap: function(map) { }, 438 addLineClass: function(handle, where, cls) { }, 439 addLineWidget: function(handle, node, options) { }, 440 /** 441 * @param {string|!Object} spec 442 * @param {!Object=} options 443 */ 444 addOverlay: function(spec, options) { }, 445 addWidget: function(pos, node, scroll, vert, horiz) { }, 446 charCoords: function(pos, mode) { }, 447 clearGutter: function(gutterID) { }, 448 clearHistory: function() { }, 449 clipPos: function(pos) { }, 450 coordsChar: function(coords, mode) { }, 451 cursorCoords: function(start, mode) { }, 452 defaultCharWidth: function() { }, 453 defaultTextHeight: function() { }, 454 deleteH: function(dir, unit) { }, 455 eachLine: function(from, to, op) { }, 456 execCommand: function(cmd) { }, 457 extendSelection: function(from, to) { }, 458 findMarksAt: function(pos) { }, 459 findMatchingBracket: function() { }, 460 findPosH: function(from, amount, unit, visually) { }, 461 findPosV: function(from, amount, unit, goalColumn) { }, 462 firstLine: function() { }, 463 focus: function() { }, 464 getAllMarks: function() { }, 465 /** @param {string=} start */ 466 getCursor: function(start) { }, 467 getDoc: function() { }, 468 getGutterElement: function() { }, 469 getHistory: function() { }, 470 getInputField: function(){ }, 471 getLine: function(line) { }, 472 /** 473 * @return {!{wrapClass: string}} 474 */ 475 getLineHandle: function(line) { }, 476 getLineNumber: function(line) { }, 477 getMode: function() { }, 478 getOption: function(option) { }, 479 getRange: function(from, to, lineSep) { }, 480 /** 481 * @return {!{left: number, top: number, width: number, height: number, clientWidth: number, clientHeight: number}} 482 */ 483 getScrollInfo: function() { }, 484 getScrollerElement: function() { }, 485 getSelection: function() { }, 486 getStateAfter: function(line) { }, 487 getTokenAt: function(pos) { }, 488 getValue: function(lineSep) { }, 489 getViewport: function() { }, 490 getWrapperElement: function() { }, 491 hasFocus: function() { }, 492 historySize: function() { }, 493 indentLine: function(n, dir, aggressive) { }, 494 indentSelection: function(how) { }, 495 indexFromPos: function(coords) { }, 496 isClean: function() { }, 497 iterLinkedDocs: function(f) { }, 498 lastLine: function() { }, 499 lineCount: function() { }, 500 lineInfo: function(line) { }, 501 /** 502 * @param {number} height 503 * @param {string=} mode 504 */ 505 lineAtHeight: function(height, mode) { }, 506 linkedDoc: function(options) { }, 507 markClean: function() { }, 508 markText: function(from, to, options) { }, 509 moveH: function(dir, unit) { }, 510 moveV: function(dir, unit) { }, 511 off: function(type, f) { }, 512 on: function(type, f) { }, 513 operation: function(f) { }, 514 posFromIndex: function(off) { }, 515 redo: function() { }, 516 refresh: function() { }, 517 removeKeyMap: function(map) { }, 518 removeLine: function(line) { }, 519 removeLineClass: function(handle, where, cls) { }, 520 removeLineWidget: function(widget) { }, 521 removeOverlay: function(spec) { }, 522 replaceRange: function(code, from, to, origin) { }, 523 replaceSelection: function(code, collapse, origin) { }, 524 scrollIntoView: function(pos, margin) { }, 525 scrollTo: function(x, y) { }, 526 setBookmark: function(pos, options) { }, 527 setCursor: function(line, ch, extend) { }, 528 setExtending: function(val) { }, 529 setGutterMarker: function(line, gutterID, value) { }, 530 setHistory: function(histData) { }, 531 setLine: function(line, text) { }, 532 setOption: function(option, value) { }, 533 setSelection: function(anchor, head) { }, 534 setSize: function(width, height) { }, 535 setValue: function(code) { }, 536 somethingSelected: function() { }, 537 swapDoc: function(doc) { }, 538 undo: function() { }, 539 unlinkDoc: function(other) { } 540} 541/** @type {number} */ 542CodeMirror.prototype.lineCount; 543CodeMirror.Pass; 544CodeMirror.showHint = function(codeMirror, hintintFunction) { }; 545CodeMirror.commands = {}; 546CodeMirror.modes = {}; 547CodeMirror.mimeModes = {}; 548CodeMirror.getMode = function(options, spec) { }; 549CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { }; 550CodeMirror.defineMode = function(modeName, modeConstructor) { }; 551CodeMirror.startState = function(mode) { }; 552 553/** @constructor */ 554CodeMirror.Pos = function(line, ch) { } 555/** type {number} */ 556CodeMirror.Pos.prototype.line; 557/** type {number} */ 558CodeMirror.Pos.prototype.ch; 559 560/** @constructor */ 561CodeMirror.StringStream = function(line) 562{ 563 this.pos = 0; 564 this.start = 0; 565} 566CodeMirror.StringStream.prototype = { 567 backUp: function (n) { }, 568 column: function () { }, 569 current: function () { }, 570 eat: function (match) { }, 571 eatSpace: function () { }, 572 eatWhile: function (match) { }, 573 eol: function () { }, 574 indentation: function () { }, 575 /** 576 * @param {!RegExp|string} pattern 577 * @param {boolean=} consume 578 * @param {boolean=} caseInsensitive 579 */ 580 match: function (pattern, consume, caseInsensitive) { }, 581 next: function () { }, 582 peek: function () { }, 583 skipTo: function (ch) { }, 584 skipToEnd: function () { }, 585 sol: function () { } 586} 587 588/** @type {Object.<string, !Object.<string, string>>} */ 589CodeMirror.keyMap; 590 591WebInspector.suggestReload = function() { } 592WebInspector.reload = function() { } 593 594WebInspector.settings.continuousPainting = /** type {WebInspector.Setting} */ { } 595WebInspector.settings.showDebugBorders = /** type {WebInspector.Setting} */ { } 596WebInspector.settings.showScrollBottleneckRects = /** type {WebInspector.Setting} */ { } 597WebInspector.settings.forceCompositingMode = /** type {WebInspector.Setting} */ { } 598WebInspector.settings.showFPSCounter = /** type {WebInspector.Setting} */ { } 599WebInspector.settings.showPaintRects = /** type {WebInspector.Setting} */ { } 600 601/** @type {boolean} */ 602window.dispatchStandaloneTestRunnerMessages; 603