Home | History | Annotate | Download | only in front_end
      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} */
     34 Event.prototype.isMetaOrCtrlForTest = false;
     35 /** @param {...*} vararg */
     36 Event.prototype.initWebKitWheelEvent = function(vararg) {}
     37 Event.prototype.stopImmediatePropagation = function() {}
     38 
     39 /**
     40  * @constructor
     41  * @extends {KeyboardEvent}
     42  * @param {string} eventType
     43  * @param {!Object=} properties
     44  */
     45 window.KeyboardEvent = function(eventType, properties) {}
     46 
     47 /**
     48  * @type {number}
     49  */
     50 KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;
     51 
     52 /** @param {?Element} element */
     53 window.getComputedStyle = function(element) {}
     54 /** @param {*} message */
     55 function postMessage(message) {}
     56 
     57 /** @type {*} */
     58 window.testRunner = null;
     59 
     60 /**
     61  * @constructor
     62  */
     63 function 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  */
     75 function WebKitMutationObserver(callback) {}
     76 /**
     77  * @param {!Node} container
     78  * @param {!Object} options
     79  */
     80 WebKitMutationObserver.prototype.observe = function(container, options) {}
     81 WebKitMutationObserver.prototype.disconnect = function() {}
     82 
     83 /**
     84  * @param {string} eventName
     85  * @param {!Function} listener
     86  * @param {boolean=} capturing
     87  */
     88 function addEventListener(eventName, listener, capturing) {}
     89 
     90 /**
     91  * @param {!T} value
     92  * @param {boolean=} onlyFirst
     93  * @this {Array.<T>}
     94  * @template T
     95  */
     96 Array.prototype.remove = function(value, onlyFirst) {}
     97 /**
     98  * @return {!Object.<string, boolean>}
     99  * @this {Array.<T>}
    100  * @template T
    101  */
    102 Array.prototype.keySet = function() {}
    103 /**
    104  * @param {number} index
    105  * @return {!Array.<!T>}
    106  * @this {Array.<T>}
    107  * @template T
    108  */
    109 Array.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  */
    117 Array.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  */
    125 Array.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  */
    133 Array.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  */
    143 Array.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  */
    151 Array.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  */
    161 Array.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  */
    169 Array.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  */
    177 Array.prototype.select = function(field) {}
    178 
    179 /**
    180  * @return {!T|undefined}
    181  * @this {Array.<T>}
    182  * @template T
    183  */
    184 Array.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  */
    193 Array.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  */
    202 Array.prototype.mergeOrdered = function(array, comparator) {}
    203 
    204 DOMApplicationCache.prototype.UNCACHED = 0;
    205 DOMApplicationCache.prototype.IDLE = 1;
    206 DOMApplicationCache.prototype.CHECKING = 2;
    207 DOMApplicationCache.prototype.DOWNLOADING = 3;
    208 DOMApplicationCache.prototype.UPDATEREADY = 4;
    209 DOMApplicationCache.prototype.OBSOLETE = 5;
    210 
    211 // File System API
    212 /**
    213  * @constructor
    214  */
    215 function DOMFileSystem() {}
    216 
    217 /**
    218  * @type {DirectoryEntry}
    219  */
    220 DOMFileSystem.prototype.root = null;
    221 
    222 /** @type {Node} */
    223 Range.prototype.startContainer;
    224 
    225 // Inspector Backend
    226 var InspectorBackend = {}
    227 InspectorBackend.runAfterPendingDispatches = function(message) {}
    228 
    229 /** @interface */
    230 function InspectorFrontendHostAPI() {}
    231 /** @param {!Function=} callback callback */
    232 InspectorFrontendHostAPI.prototype.addFileSystem = function(callback) {}
    233 /** @param {!Function=} callback callback */
    234 InspectorFrontendHostAPI.prototype.append = function(url, content, callback) {}
    235 /** @param {!Function=} callback callback */
    236 InspectorFrontendHostAPI.prototype.indexPath = function(requestId, fileSystemPath, callback) {}
    237 /**
    238  * @param top
    239  * @param left
    240  * @param bottom
    241  * @param right
    242  */
    243 InspectorFrontendHostAPI.prototype.setContentsInsets = function(top, left, bottom, right) {}
    244 /** @param {!Function=} callback callback */
    245 InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y, callback) {}
    246 /** @param {!Function=} callback callback */
    247 InspectorFrontendHostAPI.prototype.openInNewTab = function(url, callback) {}
    248 /** @param {!Function=} callback callback */
    249 InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath, callback) {}
    250 /** @param {!Function=} callback callback */
    251 InspectorFrontendHostAPI.prototype.requestFileSystems = function(callback) {}
    252 /** @param {!Function=} callback callback */
    253 InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs, callback) {}
    254 /** @param {!Function=} callback callback */
    255 InspectorFrontendHostAPI.prototype.searchInPath = function(requestId, fileSystemPath, query, callback) {}
    256 /** @param {!Function=} callback callback */
    257 InspectorFrontendHostAPI.prototype.stopIndexing = function(requestId, callback) {}
    258 
    259 InspectorFrontendHostAPI.prototype.bringToFront = function() {}
    260 InspectorFrontendHostAPI.prototype.close = function(url) {}
    261 InspectorFrontendHostAPI.prototype.closeWindow = function() {}
    262 InspectorFrontendHostAPI.prototype.copyText = function(text) {}
    263 InspectorFrontendHostAPI.prototype.inspectedURLChanged = function(url) {}
    264 InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {}
    265 InspectorFrontendHostAPI.prototype.upgradeDraggedFileSystemPermissions = function(DOMFileSystem) {}
    266 InspectorFrontendHostAPI.prototype.loaded = function() {}
    267 InspectorFrontendHostAPI.prototype.localizedStringsURL = function() {}
    268 InspectorFrontendHostAPI.prototype.platform = function() {}
    269 InspectorFrontendHostAPI.prototype.port = function() {}
    270 InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {}
    271 InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {}
    272 InspectorFrontendHostAPI.prototype.recordSettingChanged = function(settingCode) {}
    273 InspectorFrontendHostAPI.prototype.requestSetDockSide = function(dockSide) {}
    274 InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {}
    275 InspectorFrontendHostAPI.prototype.sendMessageToEmbedder = function(message) {}
    276 InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {}
    277 InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {}
    278 InspectorFrontendHostAPI.prototype.supportsFileSystems = function() {}
    279 /** @type {InspectorFrontendHostAPI} */
    280 var InspectorFrontendHost;
    281 
    282 /** @constructor */
    283 function 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 */
    294 SourceMapV3.Section = function()
    295 {
    296     /** @type {SourceMapV3} */ this.map;
    297     /** @type {SourceMapV3.Offset} */ this.offset;
    298 }
    299 
    300 /** @constructor */
    301 SourceMapV3.Offset = function()
    302 {
    303     /** @type {number} */ this.line;
    304     /** @type {number} */ this.column;
    305 }
    306 
    307 // FIXME: remove everything below.
    308 var FormatterWorker = {}
    309 var WebInspector = {}
    310 
    311 WebInspector.queryParamsObject = {}
    312 WebInspector.toggleSearchingForNode = function() {}
    313 WebInspector.panels = {};
    314 
    315 /**
    316  * @param {string=} messageLevel
    317  * @param {boolean=} showConsole
    318  */
    319 WebInspector.log = function(message, messageLevel, showConsole) {}
    320 
    321 WebInspector.showErrorMessage = function(error) {}
    322 
    323 WebInspector.addMainEventListeners = function(doc) {}
    324 
    325 WebInspector.openResource = function(url, external) {}
    326 
    327 WebInspector.showConsole = function() {}
    328 
    329 /**
    330  * @param {string} expression
    331  * @param {boolean=} showResultOnly
    332  */
    333 WebInspector.evaluateInConsole = function(expression, showResultOnly) {}
    334 
    335 WebInspector.queryParamsObject = {}
    336 
    337 /**
    338  * @param {!Element} element
    339  * @return {boolean}
    340  */
    341 WebInspector.showAnchorLocation = function(element) {}
    342 
    343 WebInspector.Events = {
    344     InspectorLoaded: "InspectorLoaded",
    345     InspectorClosing: "InspectorClosing"
    346 }
    347 
    348 /** @type {!WebInspector.SettingsController} */
    349 WebInspector.settingsController;
    350 
    351 
    352 /**
    353  * @return {number}
    354  */
    355 WebInspector.zoomFactor = function() {}
    356 
    357 /** Extensions API */
    358 
    359 /** @constructor */
    360 function AuditCategory() {}
    361 /** @constructor */
    362 function AuditResult() {}
    363 /** @constructor */
    364 function EventSink() {}
    365 /** @constructor */
    366 function ExtensionSidebarPane() {}
    367 /** @constructor */
    368 function Panel() {}
    369 /** @constructor */
    370 function PanelWithSidebar() {}
    371 /** @constructor */
    372 function Request() {}
    373 /** @constructor */
    374 function Resource() {}
    375 /** @constructor */
    376 function Timeline() {}
    377 
    378 var extensionServer;
    379 
    380 /** @type {string} */
    381 Location.prototype.origin = "";
    382 
    383 /**
    384  * @constructor
    385  */
    386 function ExtensionDescriptor() {
    387     this.startPage = "";
    388     this.name = "";
    389 }
    390 
    391 /**
    392  * @constructor
    393  */
    394 function ExtensionReloadOptions() {
    395     this.ignoreCache = false;
    396     this.injectedScript = "";
    397     this.preprocessingScript = "";
    398     this.userAgent = "";
    399 }
    400 
    401 WebInspector.showPanel = function(panel)
    402 {
    403 }
    404 
    405 /**
    406  * @param {!ExtensionDescriptor} extensionInfo
    407  * @return {string}
    408  */
    409 function buildPlatformExtensionAPI(extensionInfo) {}
    410 
    411 /**
    412  * @type {string}
    413  */
    414 WebInspector.inspectedPageDomain;
    415 
    416 WebInspector.SourceJavaScriptTokenizer = {}
    417 WebInspector.SourceJavaScriptTokenizer.Keywords = {}
    418 
    419 /**
    420  * @return {boolean}
    421  */
    422 WebInspector.isInspectingDevice = function() {}
    423 
    424 var InspectorTest = {}
    425 
    426 /* jsdifflib API */
    427 var difflib = {};
    428 difflib.stringAsLines = function(text) { return []; }
    429 /** @constructor */
    430 difflib.SequenceMatcher = function(baseText, newText) { }
    431 difflib.SequenceMatcher.prototype.get_opcodes = function() { return []; }
    432 
    433 /** @constructor */
    434 var CodeMirror = function() { }
    435 CodeMirror.on = function(obj, type, handler) { }
    436 CodeMirror.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} */
    542 CodeMirror.prototype.lineCount;
    543 CodeMirror.Pass;
    544 CodeMirror.showHint = function(codeMirror, hintintFunction) { };
    545 CodeMirror.commands = {};
    546 CodeMirror.modes = {};
    547 CodeMirror.mimeModes = {};
    548 CodeMirror.getMode = function(options, spec) { };
    549 CodeMirror.overlayMode = function(mode1, mode2, squashSpans) { };
    550 CodeMirror.defineMode = function(modeName, modeConstructor) { };
    551 CodeMirror.startState = function(mode) { };
    552 
    553 /** @constructor */
    554 CodeMirror.Pos = function(line, ch) { }
    555 /** type {number} */
    556 CodeMirror.Pos.prototype.line;
    557 /** type {number} */
    558 CodeMirror.Pos.prototype.ch;
    559 
    560 /** @constructor */
    561 CodeMirror.StringStream = function(line)
    562 {
    563     this.pos = 0;
    564     this.start = 0;
    565 }
    566 CodeMirror.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>>} */
    589 CodeMirror.keyMap;
    590 
    591 WebInspector.suggestReload = function() { }
    592 WebInspector.reload = function() { }
    593 
    594 WebInspector.settings.continuousPainting = /** type {WebInspector.Setting} */ { }
    595 WebInspector.settings.showDebugBorders = /** type {WebInspector.Setting} */ { }
    596 WebInspector.settings.showScrollBottleneckRects = /** type {WebInspector.Setting} */ { }
    597 WebInspector.settings.forceCompositingMode = /** type {WebInspector.Setting} */ { }
    598 WebInspector.settings.showFPSCounter = /** type {WebInspector.Setting} */ { }
    599 WebInspector.settings.showPaintRects = /** type {WebInspector.Setting} */ { }
    600 
    601 /** @type {boolean} */
    602 window.dispatchStandaloneTestRunnerMessages;
    603